Get Image width and height before passing it to an image or sprite component

62 views
Skip to first unread message

Salvatore Caffarelli

unread,
May 13, 2019, 1:44:27 AM5/13/19
to MIT App Inventor Forum
With an android.intent.action.PICK I get the path to an image file (.jpg or .png), how can I get height and width before passing it to an image or sprite component

Ghica

unread,
May 13, 2019, 9:26:16 AM5/13/19
to MIT App Inventor Forum
Use Taifun’s image metadata extension: https://puravidaapps.com/metadata.php
Cheers, Ghica

Salvatore Caffarelli

unread,
May 13, 2019, 2:09:54 PM5/13/19
to MIT App Inventor Forum
Thanks Ghica. I would have liked a simple call to an android.intent.action.?????
Thanks again.

Chris Ward

unread,
May 13, 2019, 6:35:05 PM5/13/19
to MIT App Inventor Forum
Hi Salvatore

Have you tried using an Image Component? You can load the image into an image component and verify the image dimensions. Note, if you don't want the User to see the image, load to a seperate Screen.

ImageSize.png


Eniac55

unread,
May 14, 2019, 2:44:21 AM5/14/19
to MIT App Inventor Forum
Thanks Chris Ward. But using your method I do not get the real dimensions but already adapted dimensions.
Anyway, thanks for answering my question.

Chris Ward

unread,
May 14, 2019, 3:27:28 AM5/14/19
to MIT App Inventor Forum
Hi again

Yes, you are absolutely right - my suggestion is total rubbish, sorry about that :)


Reply all
Reply to author
Forward
0 new messages