There are several extensions available for resizing/compressing images
Thanks for replying @TIMAI2, most of them (I've seen one or two) are redirected to web.archive.org which does not have any link to download. Anyway, I'll searching in other places in order to find it. Thank you.
Thank you!!!
Do you have any example of use? My goal is to take a picture, compress it (or resize it) and after this convert to base64 string and save into a table from SQLite.
Try here:
target = file to be converted
output = destination and filename of converted file.
Thank you!! Will try it now.
Do you wish to put a limit on size? Like compress an image to 200 kb or less.
Hi, a simple way to resize the image taken is to use canvas,
- add a canvas on your screen app, with your favorite size
- take a picture and set the canvas background with the image taken
- the image is automatically resized with the canvas size
- use canvas saveas to save the image resized
Best Regards
Marco
..... that might degrade image quality, so best to make a small test app to see if it is satisfactory for the project.
You can reduce the byte size just by converting the camera's jpg image to webp.
An extension that can reduce the dimensions and compress, all quickly done without the App User having to make an input might be the way to go.
Exactly!!! What I need is to to do this, save it in SQLite and after send to a remote server (MySQL).
Another question is: How do you deal with saving images into a SQLite table? I tried to save the photo (in Base64 string) and I noticed that companion stops working. So what are your experiences about it?
Maybe I have to open a new post about it...
......I have never used it and I don't know the developer.
Developer reputation is important as extensions often require upgrades to work with new versions of Android and App Inventor.
You are right!!
That's something that could be best to test as an APK rather than Companion.
I'm testing now TIMAI2's extension.
Understood.
If you want to store the images as base64 then you could do this:
- Take your Picture
- Set an Image component to the output size you want, e.g. 400x300 (it does not have to be visible)
- Set the taken picture "image" to the image component
- Use this extension to convert the imagePicture to base64
- Store the base64 string created to your sqlite record (you will need a TEXT field for the base64 string)
hmm, just been testing, extension does not appear to be working in companion for some reason!
Yeah, that's what I'm looking here too... companion stops working. Maybe I have to test with APK.