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

[Feature Request] Add support for newer image formats #73

Open
rohan-gt opened this issue May 10, 2024 · 5 comments
Open

[Feature Request] Add support for newer image formats #73

rohan-gt opened this issue May 10, 2024 · 5 comments

Comments

@rohan-gt
Copy link

Hi, is it possible to add support for newer image formats like AVIF, HIEC, JPEG XL etc.?

@maforget
Copy link
Owner

Possibly at one point.

But are there any content using these? All this depends on existing library support for these file types. Right now except DjVU or WebP that uses external library most of the format are the one used by .NET.

Using ImageMagisk might be a solution.

@5h4k3
Copy link

5h4k3 commented May 30, 2024

This could be an interesting addition. All my comics are now in AVIF format. This allowed me to go from a 100MB Comic to a 5/10MB one, even less sometimes while maintaining high quality (according to my taste). As a result, my entire database is on my tablet.

To achieve this, I use ComicRack-Plugin-MIFS (Modern Image Formats Support) with CR OG but unfortunately this plugin doesn't seem to work with CR CE…

So for now I'm still on Comicrack Original.

PS: I don't know if the plugin could be hard to make it viable, it seems a little bit hacky and it's "just" a decoding plugin, it doesn't add anything to CR's export/conversion integrated functions.

@maforget
Copy link
Owner

Interesting technique. I had the idea to use Harmony already to use with scripting, but injecting the code on launch is a way better technique than what I was doing with my RAR5 Pack.

That being said, it's could be very possible to basically copy/paste the code and integrate it easily. This is basically the way WebP & DejaVu are implemented, they are just converted to JPEG internally. So this would need to taken into account when patching issue #74 .

Also I believe the reason it isn't working is that it references the original dll, which are signed. ComicRackCE aren't so the signature isn't the same. Just a rebuild with the correct dll should do the trick. Although the dll version changes every build, I don't know if that is that important for Harmony.

Although if I were to implement this I would look for the source of these native libraries. If we could find libraries that would also create the files, it could be added to the export feature.

@maforget
Copy link
Owner

maforget commented Jun 4, 2024

Depending on when you tested that plugin, one reason it will not work anymore, is that I changed the signature of one of the function that is fixed by the Harmony patch. I needed to access the size, so I changed the string to a ProviderImageInfo. Patch will need to be updated for that.

@maforget
Copy link
Owner

maforget commented Aug 1, 2024

I've added support for Decoding & Encoding AVIF & HEIF.

I've only added binaries for 64bit. I didn't want to bother since this already adds 4 libraries to the Resources folder. I don't know if it's worth the trouble these days on modern computer, that are all 64bit. If you are running in 32bit you won't be able to read & export to these formats.

The HEIF format is only a container and as all kind of different subformats it supports. Things like 10bit images, sequences, etc. The images this creates are in 8bit and may or may not support any of these extra features. Finding images for testing seems hard so I can't tell if all the different format will work. ComicRack will read .heic, .heif & .avif extension types. It uses a function from the libheif library to read the images header and determine if it can read the file. Some format aren't supported.

See code related to the header detection here:
https://github.com/strukturag/libheif/blob/15ff08fea0695624c875ab92f48556d67fb453f0/libheif/api/libheif/heif.cc#L103-L146

I believe some iPhone pictures may be in mif1 or mif2 format, which the library says it's a maybe. But I don't try to read maybes, so they may not work.

If anyone can test it with various files. I also still need to add support for JpegXL. So I will leave this open.

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

3 participants