See the App Inventor Extensions document about how to use an App Inventor Extension.
For questions about this extension or bug reports please start a new thread in the
App Inventor community. Thank you.
For feature requests please contact me by email.
To be a sponsor of a new method already is possible starting from only 10 USD! With your contribution you will help the complete App Inventor community. Thank you.
Mar 22th, 2016: Initial Version 1 as of 2016-03-22 for App Inventor version ai2extensions7 and Companion version 2.36cdk1
Aug 11th, 2016: Version 1a: avoid DX execution failed error: build each extension separately
Aug 17th, 2016: Version 2: crop method added
Jan 26th, 2016: Version 3: Enable jpeg for all methods, new method Rotate added
March 8th, 2017: Version 4: IsLandscape, Scale and Overlay methods added
Oct 25th, 2021: Version 5: SDK30 update, image to manipulate must be in the ASD - application specific directory
Image Extension for basic image manipulation.
Required permissions: android.permission.READ_EXTERNAL_STORAGE, android.permission.WRITE_EXTERNAL_STORAGE
Returns whether Warnings should be suppressed
Specifies whether Warnings should be suppressed
Resize a jpg image file in the ASD - application specific directory.
Thank you Tanja for being the sponsor of this block!
Rotate a jpg image file in the ASD - application specific directory by 0, 90, 180 or 270 degrees in clockwise direction.
Thank you teen-code.com for your generous donation!
Crop Image. Enter the distance in pixel for left, top, right and bottom.
Thank you Husain for being the sponsor of this block!
Create chunks of a jpg image file in the ASD - application specific directory.
For example rows=4 and columns=3 will create 12 chunks of the original image, see screenshot
The chunks will also be stored in the ASD - application specific directory.
The following name convention will be used: imageFileName_rowNumber_columnNumber.jpg.
Return true if image in the ASD - application specific directory is in landscape format, else return false.
Scale a jpg image file in the ASD - application specific directory.
The parameter scalingLogic expects the value FIT or CROP.
CROP keeps the aspect ratio, resulting either in the width or the height of the source image being cropped.
Thank you Andreas for the scaling tutorial and the image scaling code sample project.
Overlay images in the ASD - application specific directory.
The second image should be an image in png format with transparency to get the overlay effect.
Thank you Christian for being the sponsor of this block!
Note: Both images must be available in the ASD - application specific directory.
Event indicating that chunks have been created. A list of filenames will be provided as result.
Event indicating that image has been rotated.
Parameter successful is indicating true (successful) or false. Parameter result provides error message in case of error or filename in case of success.
Event indicating that image has been scaled.
Parameter successful is indicating true (successful) or false. Parameter result provides error message in case of error or filename in case of success.
before resize
after resize
Note: the larger image (on the left) looks like it is smaller compared to the shrinked image (on the right).
I currently do not know why this happens, actually the same size in the image component should be displayed...
Some more blocks to get the current image size, width and height using the Image Metadata Extension
displaying chunk # 5 out of 12 chunks created (4 rows and 3 columns)
An example overlay image in png format, here size 1200x1800 (portrait), transparent background.
Scale an image exactly to the size you need and at the same time crop the image to keep the aspect ratio, then add an overlay image (could be for example a watermark or similar).
Developing and maintaining snippets, tutorials and extensions for App Inventor takes a lot of time.
I hope it saved some of your time. If yes, then you might consider to donate a small amount!
or donate some mBTC to Address:
1Jd8kXLHu2Vkuhi15TWHiQm4uE9AGPYxi8
Thank you! Taifun
Download TaifunImage extension Version 4 (aix file).
Download Resize test project (aia file)
Download Create Chunks test project (aia file)
Download Crop test project (aia file)
Download Rotate test project (aia file)
Download Scale & Overlay test project (aia file)
Back to top of page ...
This work by Pura Vida Apps
is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License
with attribution (name=Pura Vida Apps and link to the source site) required.