Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to make browser compatible with HEIC via userscript #32

Open
pyorot opened this issue Nov 9, 2024 · 0 comments
Open

How to make browser compatible with HEIC via userscript #32

pyorot opened this issue Nov 9, 2024 · 0 comments

Comments

@pyorot
Copy link

pyorot commented Nov 9, 2024

I'm curious if this has been tried before. I want to add HEIC support to a photo-viewer web app on my local machine only. I've tried to make a userscript but have no experience with these. The goal is to get it to replace any <img> tag with an HEIC source with a render of the image.

This is as far as I got. It gives the error Could not parse HEIF file Invalid input: No 'meta' box.

// ==UserScript==
// @name      heif
// @match     https://www.blank.org/
// @grant     GM_xmlhttpRequest
// @require   https://cdn.jsdelivr.net/npm/[email protected]/libheif/libheif.js
// ==/UserScript==

(function() {
    'use strict';
    libheif = libheif()
    const decoder = new libheif.HeifDecoder();

    GM.xmlHttpRequest({
        method: "GET",
        url: "https://github.com/tigranbs/test-heic-images/raw/refs/heads/master/image1.heic",
        onload: function(response) {
            const file = response.responseText
            console.log(file)
            const data = decoder.decode(file);
        }
    });
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant