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
Raised when the image is optimized
image: optimized image path
size: optimized image size in bytes
Raised when failed to optimize
message: error message
returns: whether successful
Set the output path of the image
defaultValue: /storage/emulated/0/compressed.png
returns: image path output
Download extension
Direct download: com.kumaraswamy.imageoptimizer.aix [8.3 KB]
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
Kumaraswamy:
I am a liitle bit confused. What does this block returns?
2 Likes
If it failed it returns false if not, it returns true.
1 Like
TIMAI2
January 9, 2021, 11:00am
6
Fails to optimize an image in assets, Android 10 companion, using //
?
Sorry, I don't think it can optimize images from assets
TIMAI2
January 9, 2021, 11:05am
8
works with full path:
/storage/emulated/0/Android/data/edu.mit.appinventor.aicompanion3/files/assets/
2 Likes
I will fix the issue soon. Thanks
1 Like
TIMAI2
January 9, 2021, 11:11am
10
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?
Anke
January 9, 2021, 11:16am
12
What does optimized mean? Original: left, opt: right
This looks like compression with a large loss of quality.
What is the resolution of both images?
Please give me some time.
TIMAI2
January 9, 2021, 11:32am
17
for example (append means add to end)
original file name: myImage1.png
optimised: myImage1-opt.png
Anke
January 9, 2021, 11:34am
18
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
Anke
January 9, 2021, 12:07pm
20
Kumaraswamy:
is the quality of output
It's perfectly fine. I just wanted to know how the compression is done.
2 Likes