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

[ColorWidget] Add CMYK support #57361

Merged
merged 12 commits into from
May 23, 2024
Merged

[ColorWidget] Add CMYK support #57361

merged 12 commits into from
May 23, 2024

Conversation

troopa81
Copy link
Contributor

@troopa81 troopa81 commented May 7, 2024

This is the first PR regarding CMYK QEP

Adds CMYK support in color widget so we can select CMYK color.

A new setting activeCmykComponent has been introduced, while the old one activeComponent refers now only to the Rgb/Hsv part

colorwidget

Funded by Métropôle de Bordeaux

@troopa81 troopa81 added Feature GUI/UX Related to QGIS application GUI or User Experience labels May 7, 2024
@github-actions github-actions bot added this to the 3.38.0 milestone May 7, 2024
Copy link

github-actions bot commented May 7, 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 1ad2b4b)

@nyalldawson
Copy link
Collaborator

@troopa81 There's a fair amount of wasted space in the dialog caused by putting the combo box in the top left corner. Could we try moving it here instead?

image

How does this look in the vertical orientation mode used in the styling dock color buttons too? Can you share a screenshot showing that?

@nyalldawson
Copy link
Collaborator

Question: is the use of rounded integer 0-255 values an issue when using CMYK colors? It's been on my wishlist for a while to revisit these widgets and make them return qreal values for the color components, so that we aren't losing information when a color is changed via the widget and are better equipped to handle higher precision color models in future (since these are already supported by both Qt and our color reading/writing code, it's really only the color widget itself holding us back).

@troopa81
Copy link
Contributor Author

Question: is the use of rounded integer 0-255 values an issue when using CMYK colors?

As much as RGB color I think. Do you have a specific issue in mind ? or just the lack of precision when you use the color wheel widget for instance

@troopa81
Copy link
Contributor Author

@troopa81 There's a fair amount of wasted space in the dialog caused by putting the combo box in the top left corner. Could we try moving it here instead?

Way better indeed. Done and updated video accordingly

@spacehobo
Copy link

spacehobo commented May 16, 2024

Question: is the use of rounded integer 0-255 values an issue when using CMYK colors?

As much as RGB color I think. Do you have a specific issue in mind ?

One reason to use CMYK is so that you can hit very specific spot colours used by your printers. This allows prints to get very high DPI at the tones you specify, because they don't need to use screens to dither various colours together.

If I can't specify the exact percentages from my printer's catalogue of spot colours, and have them propagate all the way through to a CMYK-colourspace PDF put out by the Layout Manager, then the result will be a very expensive print of a map with degraded quality.

@troopa81
Copy link
Contributor Author

@nyalldawson I remoed the warning message

@spacehobo Good point, I'll try to deal with this in another PR if I have the time/budget.

@nyalldawson nyalldawson added the Freeze Exempt Feature Freeze exemption granted label May 17, 2024
src/gui/qgscolorwidgets.h Outdated Show resolved Hide resolved
src/gui/qgscolorwidgets.cpp Show resolved Hide resolved
src/ui/qgscompoundcolorwidget.ui Outdated Show resolved Hide resolved
src/ui/qgscompoundcolorwidget.ui Outdated Show resolved Hide resolved
src/gui/qgscompoundcolorwidget.cpp Show resolved Hide resolved
tests/src/python/test_qgscolorwidget.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@nyalldawson nyalldawson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one little change left

tests/src/gui/testqgscompoundcolorwidget.cpp Show resolved Hide resolved
@troopa81 troopa81 merged commit eaa0261 into qgis:master May 23, 2024
29 checks passed
@zacharlie zacharlie added the Changelog Items that are queued to appear in the visual changelog - remove after harvesting label Jun 18, 2024
@qgis-bot
Copy link
Collaborator

@troopa81

This pull request has been tagged for the changelog.

  • The description will be harvested so please provide a "nearly-ready" text for the final changelog
  • If possible, add a nice illustration of the feature. Only the first one in the description will be harvested (GIF accepted as well)
  • If you can, it's better to give credits to your sponsor, see below for different formats.

You can edit the description.

Format available for credits
  • Funded by NAME
  • Funded by URL
  • Funded by NAME URL
  • Sponsored by NAME
  • Sponsored by URL
  • Sponsored by NAME URL

Thank you!

@zacharlie zacharlie added ChangelogHarvested This PR description has been harvested in the Changelog already. and removed Changelog Items that are queued to appear in the visual changelog - remove after harvesting labels Jun 18, 2024
@tannenfreund87
Copy link

tannenfreund87 commented Jun 29, 2024

Question: is the use of rounded integer 0-255 values an issue when using CMYK colors?

Usually CMYK values are given as percentages of the maximum amount of ink for the specific print. At least here in Germany. So if I get values, I need to convert them from percent to integer values. Otherwise, the colours become too light. See for example the table starting on page 11 of this pdf:

Anhang_zu_den_Richtlinen_für_die_Forsteinrichtung_im_Körperschaftswald.PDF

https://www.gesetze-bayern.de/Content/Document/BayVwV257553-78
cmyk_percentage_vs_integer

image

@troopa81
Copy link
Contributor Author

Usually CMYK values are given as percentages of the maximum amount of ink for the specific print.

That makes sense.

GIMP displays it in percentage (CMYK in its last version)

https://librearts.org/2022/08/gimp-2-99-12-cmyk/gimp-2-99-12-sample-points.webp

Krita offers to switch between % and 0-255 range

krita_percent

Not sure this is relevant to display CMYK in 0-255, so I'll propose a modification to display it always in percent.

@andreasneumann
Copy link
Member

I just double checked with the "Swiss World Atlas" team (the printed school atlas) - and they confirmed that they enter values in percentages (usually 5% step increments).

@troopa81
Copy link
Contributor Author

@andreasneumann thanks for the confirmation. Let's go for percent so!

@nyalldawson
Copy link
Collaborator

@troopa81 a couple of thoughts:

  1. We should offer a toggle (like gimp, inkscape, etc do) to switch between raw values and percent
  2. This should be respected by both CMYK color components + RGB + alpha
  3. We should ensure we aren't using setting the QColor components via integer values, but rather using the float methods to avoid loss of precision

@troopa81
Copy link
Contributor Author

We should offer a toggle (like gimp, inkscape, etc do) to switch between raw values and percent

I was afraid you said so :) Why not, but I'm not sure exactly what is the avantage of selecting CMYK in raw value, or RGB in percent ?

We should ensure we aren't using setting the QColor components via integer values, but rather using the float methods to avoid loss of precision

Yes, It's in my todo list

@nyalldawson
Copy link
Collaborator

@troopa81

I was afraid you said so :) Why not, but I'm not sure exactly what is the avantage of selecting CMYK in raw value, or RGB in percent ?

I'm unsure if there's any valid use case for setting CMYK as raw values, and I'm not opposed to just showing in percent always. (We've always shown HSV/alpha values as percent and not the raw values and there's been no requests in decades to expose these as raw values!)

RGB as percent is important if we remove the forced integer rounding... and I'd argue that for many users setting a value to 50% percent is a much more natural choice then "127.5". But I don't want to add GUI work for you for my wants, so I'm happy to add this toggle myself after we get the non-int rounding in place 👍

@spacehobo
Copy link

I'm unsure if there's any valid use case for setting CMYK as raw values, and I'm not opposed to just showing in percent always. (We've always shown HSV/alpha values as percent and not the raw values and there's been no requests in decades to expose these as raw values!)

My primary goal for CMYK colours is to be compatible with printers' "spot colours" when generating a PDF for submission. All printers I'm aware of use percentages (although they don't show the % symbol) and I'm slightly nervous that conversion errors between byte ratio values and decimal could "break" a spot colour back into a screen mix.

@troopa81
Copy link
Contributor Author

@spacehobo This has been taken care in #58376 so now CMYK color are edited in percent, not raw values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ChangelogHarvested This PR description has been harvested in the Changelog already. Feature Freeze Exempt Feature Freeze exemption granted GUI/UX Related to QGIS application GUI or User Experience
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants