Canvas save to image .jpg

Are you sure slashes (/) are allowed in file names?

Also, Most file operations take time to complete.
Opening another screen immediately during a file operation sounds risky.
(I am unsure of how to determine when a Canvas Save operation completes, though.)

1 Like

Perhaps this instead:

Yes, I'm sure, but colon(s) are not allowed:

Of course, the slashes do not become part of the file name, but they create new subdirectories.

According to what @ABG has said, the file saving operation takes time. So, typically I use this trick to be sure that the filesave operation has been completed:
image
where "MezzoSX" is a canvas whose dimensions are 1 pixel Height and 1 pixel Widht. So it's invisible, but until the block has not been accomplished the flow of the codeblocks won't go on (instead of using a clock).

Cheers.

EDIT:
whether someone is willing to try the "trick", the annexed .aia does the job. It just contains the following blocks:


The rationale is to write a new text into a label only after the background image of one canvas has been stored into a file (I don't care where) and then retrieved into another canvas (with 1,1 dimensions). As far as I have seen in my old apps this trick allows to "wait" for a file write completion (though it's a matter of only a few tenths or hundreths of milliseconds, Murphy's laws are always lurking....).

CanvasSave.aia (8.7 KB)

Use this block

image

1 Like

i can't find the image in my phone

can i get the link to download File Extension

File is a native app inventor component
documentation

like this???

I have yet to test the synchronous background image setting trick.

You could add a special purpose clock Timer devoted to checking a global variable for a nonblank screen name, then doing the fancy screen switch trick.

No

Yes, because as already mentioned I can't see the folder ASD on my mobile - #14 by Taifun

You can use the FileExists method to find out, if the file exists

Taifun

This block doesn't help because it immediately returns true as soon as a single byte is written to this file. Check it by downloading a larger file (10-30MB). You will find that the File.Exists method returns true immediately after the download starts, long before the download is complete.

Then use a clock timer...

What should that change?
To know exactly when the copying process is completed, one can only guess. Well, at the latest when you can display this file. (To know exactly, there would have to be a Copied event.)

But here we are not downloading a 30mb file from somewhere, if we were we could use the Web1.GotFile block to confirm file is present.

Canvas SaveAs generally takes less than a second, so a clock timer of @ that mark should be sufficient, in most cases, to confirm creation.

As I already explained, it was just an example to show that the File.Exists method is useless because it returns true before the process (copy/download) is completed.

Use component to Image extension. It has the When image created event.

i find the file in my phone, now how to view in galery
cuurent file ///storage/emulated/0/Android/data/appinverter...../file/
how to make storage in /DCIM/Camera/

This is the ASD of your app
Images stored there can't be displayed in the gallery
You have to copy or move it to shared storage and then use the GalleryRefresh method from the tools extension

Taifun

Set the DefaultFileScope = Legacy in the Designer and use this path /DCIM/Camera/... in Canvas.SaveAs_fileName to save the image directy in one of the Shared folders.