Unable to resize photo in App Inventor

Hello, I've developed a "work-attendance based on posting picture" Application in App Inventor using camera component, and still improving it. after 3 months of "no updating", then I'm trying to made some improvement in other features. as it turns out I've got the problem with "work-attendance" feature, which before updating the photo could resize and the format was .jpg, but after updating now the photo couldn't resize and the format was .png, and comes out with notification "Sorry, File To Resize must be JPG". I'm using TaifunImage and SimpleBase64. Is there any solution for my problem? Please Help. Thanks!

1 Like

A change by MIT in the last release has meant that the file extension for camera image capture has been changed to png from jpg. However the actual file is still a jpg. Try changing the filename extension to jpg and see if that then works. (You will need to do a "Move" to change the filename - you can do this with the file component or Taifun's File extension, unless you know of another method)

3 Likes

1 Like

Thank you for your reply, but I still have no idea how to change the filename extension to jpg, and then how to use Taifun's File Extension? is there any exact references to use the extension changing the filename extension?

I've had seen your block, and if i may ask is there any extensions that you've used? like the block from "call file1.MakeDirectory" and "FileScope"

CameraTest.aia (2.6 KB)

No.

2 Likes

If i try to move to the same directory - Pictures - (but with jpg extension instead of png, it crashes my companion (Android 10)

No issues on my (real) test devices (Android 10, 11, 12) with Companion.

Blocks

The camera image starts in the Pictures folder, so I do not need to create it ?

Crashes on Android 12 (real device) too :wink:

Ah, I think I see, the file block does not want a full file path....

Create what?
I created a new folder in my first example (blocks), as I decided to move the picture there (in a new sub-folder of ASD (/myPic).
But in my second example I only moved the png file to a jpg file (pic1.jpg).

My app doesn't crash on Android 10, 11, 12.
Post your aia.

Did you test with my aia (CameraTest.aia)?

Working now. its a file path thing :wink:

This is (almost) the same as I've shown.

For others:

The File1.MoveTo block starts at the ASD/files (when filescope is set to App)

/storage/emulated/0/Android/data<packageName>/files

The camera image block returns a full file path

file:///storage/emulated/0/Android/data<packageName>/files/Pictures/appinventor_123456789.png

I had forgotten this, until @Anke kindly reminded me to remove the matching part of the camera image's path (and the file:// at the beginning)

just leaving

/Pictures/appinventor_123456789.png

to apply to the File1.MoveTo block's toFilename sockets

but still i am unable to resize the photo, is there any add on which able to resize the photo? or maybe i get wrong

This is all you need:

CameraTest2.aia (32.0 KB)

i've followed your block, and it didn't show any result like the resized images, is there anything wrong with it?

You need to use the full path to the file with the resize block (well I did!)

could you give me all of your blocks, bcz i still have no idea to handle it.