[F/OS] 🖼️ ImageUtil - Additional Tools To The Image Component!

:computer: Introduction

A non-visible extension that provides additional tools to the built-in Image component.

:package: Package name: com.gordonlu.imageutil.aix

:clock1: Version: 5

:date: Release date: 2022-03-08T06:00:00Z

:lollipop: Minimum API: 19 (Android 4.4 KitKat)

:open_book: Documentation

Method blocks

ApplyGrayscaleAndFade

image

Applies grayscale effect to an image and fades the image.

Parameters: component = image

ApplyWatermark

image

Applies watermark text to the given image's content. Set the text of the watermark via the watermark parameter, and the x and y parameters are the co-ordinates of the watermark located on the image. The parameter color is the text color of the watermark, and alpha is the luminance of the watermark. The size parameter is the size of the watermark in points. Specify whether to underline the watermark via the underline boolean parameter. Use the blocks in the properties of this extension for the font parameter. If useCurrentFont is true, the font parameter will be ignored.

Parameters: image = component, watermark = text, x = number (int), y = number (int), color = color, alpha = number (int), size = number (int), underline = boolean, font = text, useCurrentFont = boolean

ColorBoost

image

Applies color boost to the content of the given content. To find out the type parameter, go to: Color Boost the image(Bitmap) in ImageView (Android) ~ Hamad's blog | Android News,Tutorials and Code-snippets. type should be a value, either 1, or 2, or 3.

Parameters: image = component, type = number (int), percent = number (float)

GammaEffect

image

Applies gamma effect to the given image.

Parameters: image = component, red = number (double), green = number (double), blue = number (double)

HueFilter

image

Sets the hue filter for the image, with the given level.

Parameters: image = component, level = number (int)

ImageAlpha

image

Returns the alpha that was applied to this ImageView. This will probably be a value between 0 and 255.

Returns: number (int)

Parameters: image = component

IsCroppedToPadding

image

Checks whether this image is cropped to padding.

Returns: boolean

Parameters: image = component

RoundCorners

image

Applies round corners to the Image, with the radius parameter as the radius of each corner.

Parameters: image = component, radius = number (int)

SepiaToningEffect

image

Turns the image to a Sephia Toned version of the image, by specifying the depth, red, green and blue parameters.

Parameters: image = component, depth = number (int), red = number (double), green = number (double), blue = number (double)

SetBrightness

image

Sets the brightness of the content for the given image, according to the value parameter.

Parameters: image = component, value = number (int)

SetColorDepth

image

Sets the color depth of the image.

Parameters: image = component, bitOffset = number (int)

SetCropToPadding

image

Sets whether the image should crop to padding.

Parameters: image = component, cropToPadding = boolean

SetImageAlpha

image

Sets the alpha value that should be applied to the image.

Parameters: image = component, alpha = number (int)

SetImageTintColor

image

Change the image tint color. You can use too alpha values if you want with the 'make a list' block. Do not forget to use the 'make color' block together with the 'make a list' block.

Parameters: image = component, tint = color

SetPadding

image

Sets the padding of the given image.

Parameters: image = component, left = number (int), top = number (int), right = number (int), bottom = number (int)

UndoGrayscaleAndFade

image

Undos the grayscale and fade effects applied with the AplyGrayscaleAndFade method.

Parameters: image = component

:inbox_tray: Downloads

AIX:
com.gordonlu.imageutil.aix (14.8 KB)

For the source code, here you go. Go to the GitHub repo, and don't forget to :star2: it!

Please click the beautiful :heart: Like button if you like the extension, it took a lot of effort and time to make it.

20 Likes

tests:

Companion

aiStarter emulator - does not work.

Xiaomi RedMi Note 10 - Works.

Profile.aia (87.4 KB)

interestingly, during testing, i figured out how to turn the image to black-and-white.

and then undo it via the UndoGrayscaleAndFade method.

1 Like

Two new methods added in version 2.

ApplyWatermark

image

Applies watermark text to the given image's content.

Parameters: image = component, watermark = text, x = number (int), y = number (int), color = color, alpha = number (int), size = number (int), underline = boolean

RoundCorners

image

Applies round corners to the Image, with the radius parameter as the radius of each corner.

Parameters: image = component, radius = number (int)

1 Like

:confetti_ball: Version 3!

  • Updated ApplyWatermark. You can now set the watermark font to Serif, Monospace, Default and Sans Serif!

ApplyWatermark

image

Applies watermark text to the given image's content. Set the text of the watermark via the watermark parameter, and the x and y parameters are the co-ordinates of the watermark located on the image. The parameter color is the text color of the watermark, and alpha is the luminance of the watermark. The size parameter is the size of the watermark in points. Specify whether to underline the watermark via the underline boolean parameter. Use the blocks in the properties of this extension for the font parameter. If useCurrentFont is true, the font parameter will be ignored.

Parameters: Parameters: image = component, watermark = text, x = number (int), y = number (int), color = color, alpha = number (int), size = number (int), underline = boolean, font = text, useCurrentFont = boolean

By defining the font parameter, say hello to these properties.

image

  • Cool effects for your images!

ColorBoost

image

Applies color boost to the content of the given content. To find out the type parameter, go to: Color Boost the image(Bitmap) in ImageView (Android) ~ Hamad's blog | Android News,Tutorials and Code-snippets. type should be a value, either 1, or 2, or 3.

Parameters: image = component, type = number (int), percent = number (float)

GammaEffect

image

Applies gamma effect to the given image.

Parameters: image = component, red = number (double), green = number (double), blue = number (double)

:partying_face: Version 4!

  • Some more cool effects for your Images!

SepiaToningEffect

image

Turns the image to a Sephia Toned version of the image, by specifying the depth, red, green and blue parameters.

Parameters: image = component, depth = number (int), red = number (double), green = number (double), blue = number (double)

SetBrightness

image

Sets the brightness of the content for the given image, according to the value parameter.

Parameters: image = component, value = number (int)

  • Customizing your image by setting paddings!

SetCropToPadding

image

Sets whether the image should crop to padding.

Parameters: image = component, cropToPadding = boolean

SetPadding

image

Sets the padding of the given image.

Parameters: image = component, left = number (int), top = number (int), right = number (int), bottom = number (int)

EDIT 1: This extension is now added on GitHub.

:partying_face: Version 5!

  • More cool effects for your images!

HueFilter

image

Sets the hue filter for the image, with the given level.

Parameters: image = component, level = number (int)

SetColorDepth

image

Sets the color depth of the image.

Parameters: image = component, bitOffset = number (int)

4 Likes

Hello Gordon.

I have used your extension and i must to say its a nice extension for use it.
I want to ask you.
If i apply the filters, there is a way to reset the filter?
In gray scale works, but in the others DON'T. Can you point me in a direction to do it with sepia, gamma and bright? I try to use them for this test.

hi, I'm not sure if can post here for my issue with ImageUtil.
I have downloaded the extension from AICODE - ImageUtil and imported into my project to test out.
But turns out to be like below;


I don't what's wrong here and the AI companion in my phone gone white and blank.
Did anyone encountered such incident before?
Please help as I wanted to use the tint color block for my project.
Thank you very much.

Hello,

What happens, when you download the extension from this topic and connect to the Companion? I don't think this is a problem with the extension, rather with the specific topic.

hi @gordonlu310,

noted and i will try again with the extension. thanks.

I am saving a image to grayscle and trying to share it, but when I share, the image gets back to original color,I have attached the blocks, can anyone help on this, I want to share a gray colored image
Sharing Image 01

where are you saving the image? To apply a grey scale doesn't save the image.

I am not saving the image, I import the image from the gallery then change it to grey scale and then share the image

Does ImageUtil have block to export a modified image back to a file?

No, the above are the only blocks, I am not so professional

I tried using this method, this changes the image to BW, but when sharing the image turns back to original color, can you help.mw on this

1 Like

Use the component2Image extension

Thank you, I will try this

The website for downloding the extesion is not opening

The website is live now.
Thanks

2 Likes