22

WebP depends on WebKit supporting it. In theory we could hack WebKit to support it on older platforms, but with 1,500 other issues I do not see this coming any time soon.

4 months later

I'd really like to see this too, as I am stuck on Catalina.

Maybe someone could write an extension that added in webp support, rather than a full hack of webkit?

    4 days later

    onerob I hadn't thought of this. In fact, this could be a perfect workaround.

    You got me digging some projects for a while and found this:

    https://github.com/chase-moskal/webp-hero

    I've tried a series of injectors and ultimately failed at making this work at all. I am not even sure if is doable as a user since I am not a webdev. Vlad is this approach realistic?

      Steps to reproduce:
      <Include steps to reproduce the bug; Did you try using Compatibility mode? If applicable, does Safari behave in the same way?>
      When I open https://detail.tmall.com/item.htm?abbucket=1&id=642552646227 When the URL is displayed, the picture is not displayed properly.

      Expected behavior:
      <What you expected to happen?>
      I want to be able to access all of tmall.com's websites.

      Orion, OS version; hardware type:
      macOS 10.15.7

      Image/Video:
      <Copy/paste or drag and drop to upload images or videos (up to 20MB)>

        3 months later
        Merged 2 posts from Unable to access pictures for WebP picture format pages.

          webpsupporter Thanks. Note there is Flag as Duplicate option under Reply menu, that you can use to do this in the future

            15 days later

            The odd thing is that AVIV image support works in 0.99.123 in Catalina and doesn't seem to rely on OS level support (AVIV doesn't work in regular Safari in Catalina). But the same is not true for webp.

              Thanks for the link. That explains the fact of Safari having to wait on OS updates in order to support newer image formats but still leaves me puzzled as to why I can see AVIF images in Orion in Catalina. Does Orion use WebkitGTK as opposed to plain Webkit?

              Additionally, the reply to this Stack Overflow question is interesting. It's possible to compile webkitGTK with a webp library.

              https://stackoverflow.com/questions/71238404/webkitgtk-build-webp-libraries-were-not-found-when-i-have-installed-the-webp-l

              • Vlad replied to this.

                onerob This post is about WebP support, please keep it on topic.

                AFAIK WebKit uses system AVIF support, not built in one, and since macOS does not support AVIF for 10.x, that is why it does not work.

                  I am talking about webp, though. My system (MacOS 10.15.7) doesn't support webp or AVIF but Orion does let me see AVIF. The implication is that WebKit in Orion is not relying on system support for AVIF, therefore perhaps it doesn't need to rely on system support for webp?

                    onerob Those are different things. However you can ask the question on WebKit.org, specific to WebP support in Mojave and share an answer here.

                      Alright, I found a solution onerob . It is far from ideal, but it does work.

                      It relies on custom script execution. According to Vlad this is meant to be implemented natively soon. Keep in mind this will decode every webp image on the client side.

                      Here the steps:

                      1. Install https://addons.mozilla.org/en-US/android/addon/codeinjector/ in normal firefox
                      2. Inside the add-on, create a new rule. Use whatever URL, it doesn't matter. As of today, the add-on is unable to detect the current loaded site in Orion.
                      3. While creating the rule, go to Files. Add the following two paths and save:

                      https://unpkg.com/webp-hero@0.0.2/dist-cjs/polyfills.js
                      https://unpkg.com/webp-hero@0.0.2/dist-cjs/webp-hero.bundle.js

                      1. Open the add-on options. Export the rule. This will save a .json file.

                      2. Install the extension in Orion and import the same file.

                      3. Restart Orion

                      4. Open any website that loads webp images. Click on the extension, select the dropdown menu besides your rule and click "inject"

                      5. Nothing will happen! You still need to apply the injection. Open the console (F12) and execute the following:

                        var webpMachine = new webpHero.WebpMachine()
                        webpMachine.polyfillDocument()

                      6. Webp images will start loading. Done.

                      Keep in mind that you will need to 1) inject the rule on every new tab and 2) execute the console commands every time new webp elements are loaded. The images will be decoded one at a time. I don't have enough time to find out how to make it work automatically. It should be possible, but extensions support is still very buggy. If you find a way, let me know.

                      Vlad This should not be considered a solution for the reasons stated above. I would keep this open until something more elegant is found. WebKit has support for webp since 2013 (see https://bugs.webkit.org/show_bug.cgi?id=47512) so this might actually be activated through some compilation flag?

                        Thanks for the code injection tip, webpsupporter. I think it's a bit too involved to be a realistic workaround, as I can always open the page in Firefox if I want to see the webp images.

                        As for compilation flags etc.., see the Stack Overflow link above. It contains further links to two libraries needed to enable webp in WebKit (or at least WebKitGTK). These are featured in Ubuntu packages and I don't know if they're capable of working on Mac.

                          onerob Agree. In my case, I've almost moved my whole workflow to Orion, so this workaround serves some purpose at least.

                          Vlad I will try to do so over the weekend. Keep in mind that my workaround makes use of a polyfill so it is unrelated to the WebKit engine itself. On the other hand, I am not so sure if they will provide a patch/solution since Apple's port relies the OS libraries and might be marked as "invalid", but it is worth the shot I guess.

                            a month later

                            Hi, just a little update.

                            I am trying to compile WebKit myself with a series of changes. Will see where this leads.

                            Regarding @onerob curious finding, this PR might explain why you can decode AVIF in Catalina, but I haven't looked further into it. Maybe Vlad can make sense of it.