2017년 1월 13일 금요일

How can I automatically change a picture's name.


I want that, when I save a picture to a specific folder, I want to save it with a specific name, "Picture.jpg" as an example, but, when I take another picture and save it in the same folder, I want it to be automatically named "Picture2.jpg".
Does anyone know how?

--
What have you tried Luna?

App Inventor has no tool to automatically change an the name of a photo taken with the AI2 Camera component.

A way to do this would be to:

1) Take a photo and use the Camera.AfterPicture block to get some information.
2) The orange image block contains the exact path and current automatic picture name that the Android assigns.
3) You have to capture the path.
4) Probably assign the path to a Canvas1.BackgroundImage.
5)Once you have the image in the Canvas, save the Canvas with the new name    picture1.jpg   for instance
6) Save the Canvas (Taifun demonstrates how to save a canvast   http://puravidaapps.com/snippets.php#2canvassave  ) to a directory of your choice.

7) you might want to use the File control to DELETE the original image you just took with the Camera .... delete   using the orange image block information perhaps?

Steps 1 - 7 saves picture1.jpg.      You want the next picture saved as picture2?    You need many if..then and logic blocks to automatically know what picture to assign next...that will involve using a TinyDB if you want to always save a new picture like picture3 etc so you have a persistant record) or  you can forget about that if you do not turn your app off during a photo taking session and the next session starts saving with picture1.jpg.

Sounds like lots of fun.  When you get a solution (and there is one), please post it for others to learn from.  Thanks.

Maybe you will get lucky and someone will share an easier method.

--

댓글 없음:

댓글 쓰기