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

don't conflate SetImageColorspace and TransformImageColorspace #75

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

smparkes
Copy link

rmagick is conflating SetImageColorspace and TransformImageColorspace. This is the difference between "convert foo.png -set colorspace rgb ..." and "convert foo.png -colorspace rgb ..."

The former is like a reinterpret-cast in C++: it doesn't change the data, it just says the data is in the given colorspace. The latter is a transform that changes the data based on the original image colorspace and the parameter.

I need SetImageColorspace and, in the current code, it's not available if TransformImageColorspace is available.

This is a partial patch. I didn't wire in or test image.transform_colorspace(colorspace). If you're interested, I can ...

@bschwartz
Copy link

👍 to this. We've been bitten by this problem several times. Without this patch, if you do something like this:

image.colorspace = Magick::RGBColorspace

... it will trigger a colorspace transformation and mess up the colors of the image. Like the author of this patch, I'd expect that call to inform imagemagick that the image is RGB rather than transforming it to RGB.

This comment is related to this problem as well: rmagick/rmagick@b87199c

@freerobby
Copy link

👍 Please pull this in! Thank you @smparkes for the fix.

@jamesfzhang
Copy link

👍

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.

4 participants