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

[ImageCache] don't convert CYMK image to RGB #57417

Merged
merged 1 commit into from
May 16, 2024

Conversation

troopa81
Copy link
Contributor

@troopa81 troopa81 commented May 14, 2024

This PR is related to CMYK QEP

CMYK image support has been added in Qt 6.8.0. For now, it's not possible to render in a CMYK image, and as a consequence to scale it. So, QGIS will report a warning message to user if requested size is different from the CMYK image one.

Funded by Métropôle de Bordeaux

@github-actions github-actions bot added this to the 3.38.0 milestone May 14, 2024
Copy link

github-actions bot commented May 14, 2024

🪟 Windows builds ready!

Windows builds of this PR are available for testing here. Debug symbols for this build are available here.

(Built from commit dba9913)

@troopa81 troopa81 force-pushed the fix_dont_convert_cmyk_image branch from f2a05c3 to 7264389 Compare May 14, 2024 13:59
@nyalldawson
Copy link
Collaborator

For now, it's not possible to render in a CMYK image, and as a consequence to scale it

Out of interest, is addressing this limitation on kdab's roadmap? From a niave pov I can't see why scaling a CMYK image is any different then scaling a rgba one

@troopa81
Copy link
Contributor Author

Out of interest, is addressing this limitation on kdab's roadmap? From a niave pov I can't see why scaling a CMYK image is any different then scaling a rgba one

Quoting KDAB developer own words

  • Then the second step would be to support a minimal set of operations
    that make sense and are relatively easy to add: cropping, mirroring,
    90° rotations, and possibly a few others. Scaling is possibly
    already tricky to do correctly.

I take a look on qimage.cpp transform method (in charge of scaling) and there is two way of scaling

The second wouldn't work as painting on CMYK image is not possible. Regarding the first, CMYK8888 format is not among the smoothscaled allowed formats, so that's maybe an oversight (I'm gonna reach out KDAB developer regarding this). Funny thing is I can force call of smoothscaled method by asking a 2 times smaller scale and it works without error.

Anyway, long story short, we cannot make assumption of what Qt would return when we scale an image, and there is no way to detect if scaling has worked or not (except for the message QPainter::begin: Cannot paint on an image with the QImage::Format_CMYK8888 format that would pop-up). So I propose to get rid of the QgsMessageLog part. What do you think?

CMYK image support has been added in Qt 6.8.0. For now, it's not possible to
render in a CMYK image, and as a consequence to scale it. So, QGIS
will report a warning message to user if requested size is different
from the CMYK image one.
@troopa81 troopa81 force-pushed the fix_dont_convert_cmyk_image branch from 7264389 to dba9913 Compare May 16, 2024 14:58
@nyalldawson nyalldawson merged commit 7d1419e into qgis:master May 16, 2024
29 checks passed
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

Successfully merging this pull request may close these issues.

None yet

2 participants