sara55
Apr 26, 2018 - 20:43
I am new to python and Pythonista.
I would like to save ui.image and not create it very time from JPEG.
Is it possible?
Thanks
I am new to python and Pythonista.
I would like to save ui.image and not create it very time from JPEG.
Is it possible?
Thanks
Yes, that's possible, here's an example:
import ui
img = ui.Image('test:Lenna') # Just load a sample image here...
# Save as PNG:
with open('test.png', 'wb') as f:
f.write(img.to_png())
# Save as JPEG:
with open('test.jpg', 'wb') as f:
quality = 0.9 # From 0.0 (more compression) to 1.0 (better quality)
f.write(img.to_jpeg(quality))
Thank you very much, I will try.
Thanks, it worked.
How would I load a JPG image ?
Img = ?
img = ui.Image('test.jpg')
Thank you very much