Canvas save to image .jpg

HOW TO SAVE CANVAS TO IMAGE WITH TIME, CAN YOU HELP ME??
WHATS WRONG WITH MY BLOK

Your blocks look fine
You now should have an image stored in the ASD of your app
That directory however is not directly accessible easily....

Why do you think, that it did not work?

Taifun.

Also learn to switch screens correctly...

Taifun

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.

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.