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.
Can I resize ui.image pictures in Pythonista?
-
I know I can do resizing with pillow(i.e. reducing the dimensions of the picture), but to start with I have the picture as a
ui.image
object. So can I resize it as that (before I send it over to pillow)? -
@halloleooo try
import ui ui_image = ui.Image.named('test:Lenna') w,h = ui_image.size ui_image.show() print(w,h) wi = 100 hi = wi*h/w with ui.ImageContext(wi,hi) as ctx: ui_image.draw(0,0,wi,hi) ui_resize = ctx.get_image() print(ui_resize.size) ui_resize.show()
-
Thanks @cvp! This is fantastic - exactly what I need!
-
@halloleooo did you see my little script in your other topic "How to debug crash of image script when it's called as extension"
-
@cvp Yes I did. Thx.