[Free] Image Convertor: extension to convert image format jpg / png / webp


com.kumaraswamy.convertor.aix (6.9 KB)

Just enter the image you want to convert with the new image path.
The image will be accordingly encoded to the mime/file type (JPG, PNG, WEBP) of the output path :slight_smile:

See post 14 for extension update
See post 15 for second update to extension, which includes a resize function
Now updated to version 3.2 - image: conversion, rotate, resize, setOpacity, crop, dimensions (width,height,size),thumbnail ImageConvertorV3.2.aix

6 Likes

@Kumaraswamy Thanks a lot!!!

1 Like

Added to

1 Like

It would be a better idea to publish it as an extension and not hide it somewhere in the posts :grin:

Yeah but, personally don't like creating small topics :cry:

thank you for your contribution
for new extensions, please always start a new thread to present the extension...
like this we will be able to find it later again...
and add a link to the extension here into this thread... thank you...
I will now move it to a new thread...

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.

2 Likes

What File types can this convert to png ?
Only jpg and webp ? Or any other file types too ?

I want a tool to convert almost all image formats (except gif).

Will this work ?

How about just trying it out?
And then let us know.

1 Like

Extension Remix and Update

  • fixed file paths to allow for ASD
  • added quality option to the block (works for jpg and webp, png is lossless) scale of 0 -100, 100 gives best visual appearance.
  • Coded to handle deprecation of WEBP, which is replaced with WEBP_LOSSY from API 30. Devices on less than 30 will use WEBP, those above WEBP_LOSSY
  • error handling and error messaging improved

For clarity, extension converts between jpg, png and webp file formats (these are the only ones available for Bitmap.CompressFormat) or you can reduce quality / filesize of existing file format. Files to be converted must have a valid extension (e.g. file1.jpg / file2.png / file3.webp)

Image Convertor

image

Credits @Kumaraswamy for original extension.

#####################################################################
This work by TIMAI2 is licensed under an
MIT Licence
#####################################################################

5 Likes

2022-05-18

Update to remixed extension, now adds a resize function.

component_method

Description:

Resizes an image file, with format: jpg,png,webp.

A single size is required (will adjust to the longest side), and aspect ratio will be retained.

Important! use the same extension for target and output.

Use the same path for target and output if you want to overwrite the target file - this is irreversible.

2022-09-02

Updated again to V8. The extension now uses events to return the output file path, and file sizes for the new file (formatted and in bytes) and target file (in bytes)

2023-07-11

Updated again now to V2.10. Included are Rotate and SetOpacity methods.

image

image

SetOpacity will only work with png and webp sources.

2023-07-27

Updated again to V2.11. Revised code for Opacity.

Thanks @Martin_Herraiz & @Juan_Antonio for encouragement and advice

Extension:
Image Convertor

Credits @Kumaraswamy for original extension.
Credits to Asad Ali Choudhry for their resize and keep aspect java code

#####################################################################
This work by TIMAI2 is licensed under an
MIT Licence
#####################################################################

3 Likes

Hello. Thanks for this image converter extension.
I would like to convert a jpg image to a png image, but control the overall transparency/opacity of the png file (same transparency for all the image).
Is this functionality available in an other extension (I searched without success), or would it be possible to add a parameter: percentage of transparency (value of alpha channel) to the convert block?
Thank you very much

New version created to include Rotate and SetOpacity methods.
Please download from the same url as above.
ImageConvertor V2.11

1 Like

Hi Tim
Thanks you very much for your very quick feedback and for adding this feature to your extension. I really appreciate
I am now trying to use your extension, but I am facing some issues:

  • I did not find the documention of the extension, and on the parameters. e.g. I assume the quality is between 1 and 100 (100: best quality): Is it true
  • I try to convert a JEPEG photo taken from the standard camera stored in /DCIM/Camera/ and convert it to a png file in App folder, but it fails. here are my blocks and the test result of these blocks

I am sure I am missing something, but unable to find it. Could you give me some tip?

Thanks

What android version are you testing with ?

Version 11 RKQ1 on a Xiaomi Mi11 Ultra
DefaultFileScope is set to Legacy (Thanks to Anke information), and it does not look like a permission issue

Any reason for setting the filescope to Legacy, other than for this activity ?

Works fine with filescope set to App (tested with companion app on android 13 device)

(This for a camera image taken by the device camera component, not from within the app)

Thanks a lot, it works fine. I use ASD for the destination, so it works for both the companion and the installed APP

1 Like

I now also checked resize and opacity: BOTH works fine
Thank you very much

1 Like

Attached is my test Application: ImageConvertor. Hope it will ease your extension usage.

ImageConvertor.aia (50.2 KB)

Kind Regards

Jacques

1 Like

Dear TIMAI2
While using your ImageConvertor, can we zoom in / zoom out with finger tips?
Regards