Image optimizer : Optimize images and reduce it's size

Introduction

An extension to optimize images and reduce their size with loosing very little details!

If you want to upload it to the web database then you can optimize it and upload. It will save space in the database.

Required permissions:

android.permission.READ_EXTERNAL_STORAGE
android.permission.WRITE_EXTERNAL_STORAGE


Documentation

Each block's purpose and its work

optimizedimage

  • Raised when the image is optimized

image: optimized image path
size: optimized image size in bytes

failed

  • Raised when failed to optimize

message: error message

optimizeBlock

  • Optimize the image given

returns: whether successful

setoutput

  • Set the output path of the image

defaultValue: /storage/emulated/0/compressed.png

getoutput

  • Get the output path set
returns: image path output


Download extension

  1. Direct download: com.kumaraswamy.imageoptimizer.aix [8.3 KB]
  2. Alternate download: micode.vercel.app/ImageOptimizer.html


If you find any bugs, then let me know!
Thanks!



Website: micode.vercel.app

19 Likes

Nice extension @Kumaraswamy

1 Like

I am a liitle bit confused. What does this block returns?

2 Likes

Btw nice extension

1 Like

If it failed it returns false if not, it returns true.

1 Like

Fails to optimize an image in assets, Android 10 companion, using // ?

Sorry, I don't think it can optimize images from assets :thinking:

works with full path:

/storage/emulated/0/Android/data/edu.mit.appinventor.aicompanion3/files/assets/

2 Likes

I will fix the issue soon. Thanks :grinning:

1 Like

That said does a good job, optimised a 1.9mb image file to 55kb. which looks fine on a phone screen.

Could you add an option to retain the original file name and append -compressed (or better -opt) to it,
or option to name the compressed/optimised file?

2 Likes

So you mean like :

if(append)

the file name should be : "compressed" + orginal name.
Am I right?

What does optimized mean? Original: left, opt: right

This looks like compression with a large loss of quality.

No wonder:

grafik

What is the resolution of both images?

Please give me some time.

for example (append means add to end)

original file name: myImage1.png
optimised: myImage1-opt.png

That's not an issue. There is nothing to fix.

2 Likes

Sorry but the is the quality of output


Yes, but we can just add it in the output name?

1 Like

It's perfectly fine. I just wanted to know how the compression is done.

2 Likes