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.
Converting images to webp or jpeg2000 in Pythonista
-
@JonB You're really the champion. Where could go this forum without you?
Thanks for everybody.
Sincerely, I don't know why I have even tried. -
@cvp You did the heavy lifting . A minor update above adds the quality parameter (at quality=1, lenna is 445kB. at 0, it is 3kB...
-
@JonB, cannot guess the UTI for WebP. Would require a recompile of Pythonista to get the symbol included?
-
I read somewhere that webp is not supported on iOS. Or, possibly, that newer safari versions might support display of webp, but I doubt that writing webp has been implemented in CGDestinationCreate.
Found this on GitHub:
// kUTTypeWebP seems not defined in public UTI framework, Apple use the hardcode string, we define them :) #define kSDUTTypeWebP ((__bridge CFStringRef)@"org.webmproject.webp")
So, you might try
ns('org.webmproject.webp')
.but again no guarantee that iOS can write webp without libwebm or freeimage or some other library.
-
@JonB, wanted to try, given iOS 14 Safari works with WebP no problem.
But with
imagedest = CGImageDestinationCreateWithData(d, ns('org.webmproject.webp'), 1, None)
, conversion fails. -
@mikael public.webp? or com.google.webp?
-
@cvp, nice try, no bonus.