Skip to first unread message
Assigned to josmas...@gmail.com by halab...@google.com

michele....@gmail.com

unread,
Jun 10, 2014, 11:06:16 AM6/10/14
to mitappinv...@googlegroups.com
Hi, I checked that using the Canvas Metod "Save As File Name" there is a bug.
If you set Canvas Tool "hidden" and you load an image from Image Picker by setting the background of the Canvas with the selected image, (in hidden), then when I saving the image using the method mentioned above, (Canvas Save As File Name) it resize the image automatically in 32x48 pixel, although the height and width are set to default automatically.
It only works by setting fixed parameters (such as 300x300 pixels)


Is it possible to risolve this problem?

Thank you

Scott Ferguson

unread,
Jun 10, 2014, 12:36:56 PM6/10/14
to mitappinv...@googlegroups.com
I am not clear on a few things so please provide the following:
What is your Canvas width and height set to?
What is the original image width and height?
What width and height do you want the image to be saved as?
What is the width and height of the saved image?

Try setting the canvas visible and try again.
Does it work correctly?
Thanks
---
Scott

Taifun

unread,
Jun 10, 2014, 1:22:12 PM6/10/14
to mitappinv...@googlegroups.com
I also tested a little bit...
that's funny...I didn't know we can resize images?
that's not a bug, that's a feature ;-)
Taifun

michele....@gmail.com

unread,
Jun 10, 2014, 3:14:30 PM6/10/14
to mitappinv...@googlegroups.com
Hi.

My Canvas width and height are set to "Automatic"
The original width and height of image are 3264 x 2448 (picture taken with Galaxy S2 Camera)
I want to save the image with the original width and height (3264 x 2448).
If, I set to automatic Canvas Background image to 3264 x 2448, (like the original) I can't show it, because the resolution is too high, so I set to "hidden" the Cavans tool, to have the original resolution, and save it.
But.. in this way, it saves an image to 32*48.
If I use the Image Tool, instead, (width and height automatic) and I set it hidden, if I try to share it the image, the resolution of the image that i will share, is original (3264 x 2448).
But I need to take a picture from gallery, change the name of this image, and to save a new copy.. but with Image tool is not possible, because there isn't a method to save an image, only share, while with the Canvas tool is possible to take an image from gallery with image picture tool, and to save a new copy, but if I set automatic width and height, in hidden, it doesn't respect the original resolution.

I hope is clear now. I'm sorry for my bad English.

michele....@gmail.com

unread,
Jun 10, 2014, 3:17:26 PM6/10/14
to mitappinv...@googlegroups.com
Oh.. that's not good. I cry..

Is there any solution for me?

I need to take an image from gallery with image picker, change its name taking data from 2 Spinner, to save the image and to share it.

michele....@gmail.com

unread,
Jun 11, 2014, 7:51:47 AM6/11/14
to mitappinv...@googlegroups.com
Is there no solution for my problem?

Thank you..

Taifun

unread,
Jun 11, 2014, 11:01:53 AM6/11/14
to mitappinv...@googlegroups.com
to pick an image and rename it without resizing it worked for me only with a visible canvas and setting the width and height manually to the width and height of the image,
in my example I used a portrait image 1836x3264, see example project attached
Taifun


michele.aia
Message has been deleted
Message has been deleted

michele....@gmail.com

unread,
Jun 11, 2014, 5:45:52 PM6/11/14
to mitappinv...@googlegroups.com
Dear Taifun, thank you for your help.
I've tried to use your michele.aia, but when I save the image, in the path Al/myimage.jpg, I can see the file "myimage.jpg" only like a file, but I can't open it. It hasn't any information. 

But the very problem is that I have not been able to explain well my problem, so I've attacched the project .aia.

The real project is an application for photographers.
Their customers will choose an image from smartphone gallery.
They will see a little preview, and after customers will choose format and number of copies that he will print.
The image will be saved with the spinners data, and when they will send the photo by mail for example, or ftp space, the photographer will receive the image with the format and number of copies for printing.

Is there a way with Mit App Inventor to create this procedure?

I need to share the image with the button "Good Share", because It saves the information about resolution.. but I need also to change the name of image that I will share, and this it's possible only with the button "Bad Share".. but, in this case, I lost information about resolution.
Taifun.aia

michele....@gmail.com

unread,
Jun 13, 2014, 9:44:28 AM6/13/14
to mitappinv...@googlegroups.com
I have no hope Taifun? :(

Taifun

unread,
Jun 13, 2014, 3:37:20 PM6/13/14
to mitappinv...@googlegroups.com
are you testing with the emulator? did you try my example with a device?
if my example does not work for you on a device, I'm currently out of more ideas...
my example worked fine for me on Nexus 5
Taifun

michele....@gmail.com

unread,
Jun 13, 2014, 7:22:22 PM6/13/14
to mitappinv...@googlegroups.com
I've tried your application on my device (Galaxy S2), I've installed it.
When i choose the image the application gives "Runtime Error - End Application"

Have you tried my .aia?

michele....@gmail.com

unread,
Jun 15, 2014, 7:03:47 PM6/15/14
to mitappinv...@googlegroups.com

I've tried again your application, changing only the first method, Set Canvas Visible to False - and this is the result: 

Result

Like you can see, when the Canvas is hidden, the image will be saved in 32x48
For me, this is a bug. If I set the component Image hidden, and I set an image on it with image picker, if I share later the content of Image component, the resolution is correct.

If I set Canvas Visible, the application crashes. (I think that it's caused by the high resolution of the image, 1836 x 3264 showed in the screen).

Anyway, thanks a lot for help and support.



Scott Ferguson

unread,
Jun 16, 2014, 8:05:46 PM6/16/14
to
the Bad share button works now. Your specified resolution of 3264x2448 is being used for the saved, renamed image.

The problems:

1) When Canvas1 is set to Visible false, it's size reverts to 32x48 no matter what you set it to.
2) Screen must be set to Scrollable true before a Canvas SaveAs.

The solution:

1) Make Canvas1 visible.
Since Canvas1 is below the Img preview image, Canvas1's BackgroundImage does not show on my test tablet and the user cannot scroll down to see it since Screen Scrollable is unchecked.
However, if Canvas1 does show on some devices you can add space between it and the Img image using a label or screen arrangement to push it out of view.

2) set Screen Scrollable true before saveAs-ing the Canvas, then you can set it Scrollable false afterward. (If you don't do that you will get a runtime error for some reason :()

In my test, when I clicked the Bad Share button I selected to email the image which worked just fine.

Thanks to Hal and team for allowing Canvas sizes larger than 999px in the Designer!
---
Scott

SharedImage.aia

michele....@gmail.com

unread,
Jun 17, 2014, 7:03:56 PM6/17/14
to mitappinv...@googlegroups.com
Thanks, thanks, thanks a lot Scott Ferguson.
We have not solved the problem, but somehow, it's bypassed.

I've tried SharedImage.aia, with a Samsung Galaxy S2, and when I save, appears a runtime error anyway (I followed step 1 and 2, but there is the problem anyway)
I don't know at this point if depends also from the device used.

Anyway.. there is a good solution.

I followed the point "Solution" 1 and 2 and:

If I Set Cavans with the following resolutions, the file will be saved correctly:

1280x1024 pixel - ok.
1600x1200 pixel - ok
2048x1536 pixel - ok.
2280x1700 pixel - error - the file will be saved but without resolution and information. (.jpeg empty).

There si hope.
I can proceed and complete now, my project with Mit App Inventor ;) 

josmasflores

unread,
Jun 18, 2014, 2:17:50 PM6/18/14
to mitappinv...@googlegroups.com
I'm not sure I am understanding this completely, but when you choose from the Image picker, you get a path to the file. Can you use the File component to save that file wherever you want, with the name that you want, and share it from there?

michele....@gmail.com

unread,
Jun 18, 2014, 2:48:28 PM6/18/14
to mitappinv...@googlegroups.com
Dear josmasflores,

this is a good idea. I'm trying to do this procedure.. but when I try, there is an error (I can't create.. path, image picker.. etc). Where is the error? Where did I wrong?




Taifun

unread,
Jun 18, 2014, 2:53:40 PM6/18/14
to mitappinv...@googlegroups.com
probably you have to use the File.ReadFrom method first to read the image (as text) before you can store it..
Taifun

ReadFrom(text fileName)
Reads text from a file in storage. Prefix the filename with / to read from a specific file on the SD card. for instance /myFile.txt will read the file /sdcard/myFile.txt. To read assets packaged with an application (also works for the Companion) start the filename with // (two slashes). If a filename does not start with a slash, it will be read from the applications private storage (for packaged apps) and from /sdcard/AppInventor/data for the Companion.

josmasflores

unread,
Jun 18, 2014, 3:00:22 PM6/18/14
to mitappinv...@googlegroups.com
Actually, I don't think there's a way to save anything that is not text in the File component. Didn't realise that; that's not going to work. We should add that functionality to File.

michele....@gmail.com

unread,
Jun 18, 2014, 3:10:05 PM6/18/14
to mitappinv...@googlegroups.com
Thank you Taifun.
Thank you josmasflores. Yes... it dosn't work with file .jpg. 
i will be very glad if you will be add that functionality to component File. I hope!!

josmasflores

unread,
Jun 18, 2014, 11:54:36 PM6/18/14
to mitappinv...@googlegroups.com
We have added this to our TODO list. No ETA for delivery though. Thanks for the suggestion.

michele....@gmail.com

unread,
Jun 19, 2014, 7:11:17 AM6/19/14
to mitappinv...@googlegroups.com
Thank you, Mit App Inventor Team! Thank you at all!
Reply all
Reply to author
Forward
0 new messages