Can I reduce the resolution of image files?

I wonder how is it possible to reduce the size of the image file created by the phone when taking a selfie. Modern phones have high resolution cameras, and the image file they create has a big size of several MB. Downloading those files from web storage consumes a lot of data and takes several seconds (depending on the size of the file, and the data conection of the phone in the mobile network). Such a high resolution image is not necessary just to be displayed on a small window of the mobile screen.

  • May be there is already a low resolution copy of the photo in the phone (like the thumbs in gallery) that I can use.
  • May be there is a way to configure the resolution of the mobile camera, when it is comanded from my app to take the picture.
  • Or may be I will need to use an external web service to make a low res copy of the picture in a different folder of cloud storage.

Any clue or advice will be welcome.
Thank you in advance.

You might want to try the image extension and its Resize method


Thanks Taifun.
I'll do.


This handles the misnamed camera images (should be jpg but are named png)

Tanks for offering your extension.
I tried it. But I must be doing something wrong, because I got a Runtime Error (undefined, when running it in the companion).
Could you, please provide some more information on the correct values for the arguments I should enter to the .Resize block?

This is working for me in companion, resizing a file to a new name in the ASD

Hi Taifun.
I tried the .Resize block of your extension.
Something strange happened to me:
For the first couple of times, it worked fine, and I could see in the second image component a much smaller image.
But from the third time on, I got the same size and a message like : "sorry file has to be ,jpg".
The strange thing is, I always downloaded the same target file (a .png one).

I'll try using your blocks

The PNG/JPG issue will be fixed in the SDK 31 update.


Yes. It works.
Despite what the hint in the .Resize block says, It looks that the Output file name has to be different from Target to avoid this error.
Thanks a lot to all of you.

Strange, this worked for me previously, but I do get the same error if trying to overwrite the file. I will have a look at the code.


Could you please try this version of the extension where target=output
(of course, ensure that target is writeable, e.g. not in assets) (8.5 KB)

Unfortunately you forgot to provide a screenshot of your relevant blocks...

Yes, the image must be jpg as the error message is trying to tell you


Hi Tim
Sorry for the delay in answering. I'm having some issues to convert big files with a slow mobile conection and lack of memory in my old tablet.

I tested the the Resize block of your V3OW with target=output file names.
It worked fine with a .png and a .jpg file.
I got a RunTime Error with another .jpg one (of some bigger file size, which may be is hitting the limits of memory of my tablet).

Thanks a lot for rewieving your code.
In fact, for me it's not a problem to set up a new name for the local storage of the converted file in the tablet. Because I finally upload the converted file to cloud storage (where there is no problem to overwrite the original file). I just have to delete 2 files from local, instead of one.

1 Like

Thanks for testing :slight_smile:

1 Like

Thanks a lot Taifun.

Here are my blocks (thanks to TIMAI2 for his ImageConvertor extension, version3, and the .Resize block).
May be they can help somebody who wants to resize a .jpg or .png image file in Google's FireBase Storage.
In my case, is intended to reduce the "wheight" of selfie photograps taken by the high resolution cameras of modern mobile phones, when the user registers in a carpooling service. (The service uses each other pictures to introduce the passengers and car drivers who can travel toghether, because they go in nearly the same direction).

Write your FireBase project's name in StorageBD global variable, and the folder's name in Carpeta global variable ("SLF" in my case).
Set in the corresponding Text Boxes the image file name and the desired size for the converted picture, and hit the button.
Resized image file will have the same file name, and will replace the original one in the same folder of cloud Storage.

1 Like

Very good, can you attach the aia?

There you are
FireBaseStorageImageFileResize.aia (15.1 KB)

1 Like

Someting is wrong with those blocks.
It doesn't delete the file from de ASD on the device (neither in Android11 nor in older versions).
I'm stuck with this for tree days now
¿Can somebody help?

Do you need to add a forward slash, / , before the filename with the Delete block ?