Skip to content

PolyfillImage produces gif, instead of png on iOS < 14 #47

@djlastnight

Description

@djlastnight

Hi there. It might be me, but I get gif image output instead of png

image

Here's the code, which I wrote for tests

// How I imported it
import { WebpMachine } from "webp-hero/dist-cjs/index.js";
...
// How I initialize it at GameLoader's constructor
this.webp = new WebpMachine({useCanvasElements: false, webpSupport: false});
...
// On each resource load, I am adding new img to the body for test only
    private async onAfterResourceLoaded(resource: PIXI.LoaderResource, next: (...args: any[]) => void, loader: GameLoader) {
        if (resource.extension == "webp") {
                let image = resource.data as HTMLImageElement;
                await loader.webp.polyfillImage(image);
                image.width = 100;
                image.height = 100;
                if (!image.src.endsWith("webp")) {
                    // Conversion was made by webp-hero
                    image.style.cssText = "position: fixed; left: 0px; top:50px; width: 100px; height: 100px";
                    document.body.appendChild(image);
                }
        }
        
        next();
    }

On iOS 14 and 15 I can see the png images rendered as they should. At iOS 13 and lower I can not see anything and the img is gif.
Please note all the images has the same src.

npm list webp-hero returns [email protected]
Any help appriciated.
Thx in advance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions