Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Sample sketch, not working?
-
I cannot use Sketch .py in samples.The moment I put on 'Save image', shut down program.
I found function:save_image(92 row in code) was in document 'Deprecated Functions' category.
I change function:save_image() to create_image_asset() instead as written in document.
But, it does not work.there are a code(from row89)and an error code:with ui.ImageContext(self.width, self.height) as ctx: self.image_view.image.draw() img = ctx.get_image() photos.create_image_asset(img) #photos.save_image(img) console.hud_alert('Saved')
Traceback (most recent call last): File "/private/var/mobile/Containers/Shared/AppGroup/738A76EA-5C4E-4440-85BA-1FD3DC0E35E9/Pythonista3/Documents/Examples/User Interface/Sketch.py", line 95, in save_action photos.create_image_asset(img) TypeError: argument 1 must be str, not _ui.Image
I am beginner, I don't know what to do,even if I think a few days.
Is any way to work this program? -
@JoeJack
photos.create_image_asset is the inverse of a save, it reads a file and creates an asset.
It's parameter is thus a string containing the path of the file to read... -
@cvp
O.k.thank you. I will look for method of how to 'save' in different way. -
-
@cvp
Thank you very much. I could save ui.image as jpeg image. It is very easy....I thought too much. Thanks for your help. -