omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    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

    Pythonista
    5
    27
    7135
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • cvp
      cvp @JonB last edited by

      @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.

      JonB 1 Reply Last reply Reply Quote 0
      • JonB
        JonB @cvp last edited by

        @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...

        mikael 1 Reply Last reply Reply Quote 1
        • mikael
          mikael @JonB last edited by

          @JonB, cannot guess the UTI for WebP. Would require a recompile of Pythonista to get the symbol included?

          1 Reply Last reply Reply Quote 0
          • JonB
            JonB last edited by

            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.

            mikael 1 Reply Last reply Reply Quote 0
            • mikael
              mikael @JonB last edited by

              @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.

              cvp 1 Reply Last reply Reply Quote 0
              • cvp
                cvp @mikael last edited by cvp

                @mikael public.webp? or com.google.webp?

                mikael 1 Reply Last reply Reply Quote 0
                • mikael
                  mikael @cvp last edited by

                  @cvp, nice try, no bonus.

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post
                  Powered by NodeBB Forums | Contributors