-
Notifications
You must be signed in to change notification settings - Fork 103
Add Qt image plugins for AVIF, JXL, and HEIC/HEIF support (Docker) #499
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
base: develop
Are you sure you want to change the base?
Add Qt image plugins for AVIF, JXL, and HEIC/HEIF support (Docker) #499
Conversation
- Add multi-stage Docker build with 7 optimized stages - Build and install Qt image plugins: qt-avif-image-plugin, qt-jpegxl-image-plugin, qt-heic-image-plugin - Build libjxl 0.10.2 from source (required version not in Ubuntu noble) - Use system packages for AVIF (libavif16) and HEIC (libheif1) - No YACReader source code changes - uses Qt's dynamic plugin loading - Improves build caching and reduces rebuild times Enables support for modern image formats without code modifications, following YACReader's Qt plugin architecture as suggested in YACReader#498
|
BTW: I didn't port these updates over to the |
|
@luisangelsm I'd love to get this merged so that this version it was available on DockerHub. What can I do to help make that happen? |
To make this happen, it needs to be negligible in terms of added maintenance and support workload for @luisangelsm. The best way to achieve this is to simply add kimageformat as a dependency (widely available on Ubuntu and other Linux distros) instead of introducing build processes and dependencies on non-packaged plugins and libraries. As a general rule of thumb, YACReader only supports image formats supported by Qt itself. Adding support for additional formats is out of scope. We still support adding these as a community effort or where doing so is a no-brainer, but supplying the necessary plugins for all variants of YACReader is not something that is feasible with the limited resources. That means your options are:
I can help getting this cleaned up and into a good shape, but the final decision rests with @luisangelsm . PS: If possible, please keep the usage of AI/LLM at a minimum |
|
In this PR I directly followed the instructions given by @luisangelsm :
@selmf you said:
Those are different instructions.
Can you clarify what you want to cleaned up? Are you just asking to switch from For whatever it's worth, I've been using this image to host my library for the iOS app since creating this PR and I've added/read a number of AVIF/JXL comics without issue. Stray comments:
That's fine by me, I agree regular old JPG/PNG should be the target of your limited resources.
Sorry, I already help maintain and publish Simple Comic so one OSS comic tool is more than enough 😆
I write lots of Dockerfiles for my day job, but I don't know much about QT, so that part was shored up by LLMs in this PR. If there is a more QT-native way to do this within the constraints of a Dockerfile let me know. If YACReader's position is that LLM-generated code is not welcome here, that should be made clear in the contribution guidelines |
|
The main problem is that adding plugins compilation is adding another dependency that I would need to take care of in the future, if compiling a plugin starts to fail it would block the whole CI/CD pipeline. Is not that AI generated content is not welcome, but the more verbose the PR is the more time requires to be reviewed because I need to fully understand everything if I want to be able to maintain it in the future. If installing And now that we are talking about the contribution guidelines, the very first thing I say there is Anyway, I truly appreciate the interest in the project and I always encourage people to join YACReader and participate in any way they can, not only coding, UI/UX design, writing user guides, testing... |
|
BTW, there are two Docker files Dockerfile and Dockerfile.aarch64. If you are willing to give the I had some troubles setting up the arm version with Qt6, I am planning to drop Qt5 support, I would really appreciate if you can help with that. |
Sorry if this is confusing.
Kimageformats installed as a package via apt-get with a minimal diff for the dockerfile would be the goal. As a bonus we could also clean up the dependencies - build-essential already pulls stuff like g++ and gcc.
As @luisangelsm said we are not anti LLM luddites, we just don't like some of its quirks. Sorry if that came along a little harsh. You're welcome to use the tools you are productive with. I personally like to refine LLM generated code by using "KISS" and "compact/concise" as part of the prompt or asking it explicitly to summarize or distill info drops into short sections of text. That is my way of "keeping it to a minimum" :) |
- Replace 3 separate image plugin builders (AVIF, JXL, HEIC) with single kimageformats build - Reduce Dockerfile from 8 stages to 6 stages (25% reduction) - Build kimageformats 6.0.0 from KDE frameworks (patched for Qt 6.4 compatibility) - Support AVIF (avif, avifs) and JPEG XL (jxl) formats - Add 30+ bonus image formats (PSD, QOI, XCF, HDR, etc.) - Simplify build dependencies and maintenance - Note: HEIC/HEIF support not included (kimageformats 6.0.0 limitation) This provides a minimal diff alternative to PR YACReader#499 as requested by maintainers, using well-maintained KDE framework instead of multiple custom plugin builds.
- Step-by-step testing instructions - Expected outputs and success criteria - Known limitations (HEIC/HEIF not supported) - Troubleshooting section - Comparison with original PR YACReader#499 approach
Add Qt Image Plugins for Modern Image Format Support (Docker)
Summary
This PR adds support for modern image formats (AVIF, JXL, HEIC/HEIF) to the YACReaderLibraryServer Docker image using Qt image plugins. No source code changes are required - this follows YACReader's existing plugin architecture as suggested in #498.
Motivation
Modern image formats like AVIF and JPEG XL offer significant advantages:
Users with comics containing these formats currently cannot view them in YACReader, despite the formats becoming more common.
Implementation
This PR follows the maintainer's guidance from #498 to use Qt's dynamic plugin loading system rather than adding custom decoders to the codebase.
Docker Multi-Stage Build (8 Stages)
The updated Dockerfile uses an optimized multi-stage architecture with a shared base layer for maximum build caching and parallelization:
Stage 0-1: Base Layers
Stage 2-5: Independent Plugin Builders (all FROM plugin-base, build in parallel)
Stage 6-7: Assembly
Key Optimizations:
Qt Image Plugins Used
All plugins are from @novomesk's excellent collection:
Note on libjxl: Ubuntu noble ships libjxl 0.7.0, but qt-jpegxl-image-plugin requires 0.10.0+ for
JxlEncoderDistanceFromQuality. We build 0.10.2 from source and merge it with the plugin build in a single optimized stage (stage 4).How It Works
/usr/lib/x86_64-linux-gnu/qt6/plugins/imageformats/QImageReadertransparently uses plugins for supported formatsTesting
Prerequisites
# Pull the updated Docker image docker pull yacreader/yacreader-library-server:latestVerify Format Support
Test with Real Comics
Sample Test Files
Create test CBZ files to verify:
Build Performance
Recent Optimizations (Latest Commit)
The Dockerfile was further optimized to reduce build times and improve caching:
Image Size
Build Time (First Build)
Cached Rebuild
Compatibility
Backwards Compatibility
✅ Fully backwards compatible
Platform Support
Client Support
Server serves native bytes - clients decode using their capabilities.
Changes
Modified Files
docker/Dockerfile- Complete rewrite with multi-stage architectureNo Source Code Changes
Dependencies
New Runtime Dependencies
All dependencies are open source with permissive licenses:
Plugin Licenses
Future Considerations
When libjxl 0.10+ Reaches Ubuntu Repos
Once Ubuntu ships libjxl 0.10.0+:
apt-get install libjxl-devAdditional Formats
More Qt image plugins available:
Same pattern: build plugin, copy to imageformats/, done.
References
Checklist
Note: This PR addresses #498's feedback by using Qt plugins instead of custom decoders. The approach is cleaner, more maintainable, and aligns with YACReader's existing architecture. No source code changes means no risk to existing functionality.