rmagick / rmagick

Ruby bindings for ImageMagick
https://rmagick.github.io/
MIT License
696 stars 140 forks source link

don't conflate SetImageColorspace and TransformImageColorspace #46

Closed bf4 closed 1 month ago

bf4 commented 9 years ago

Issue by smparkes Sunday Apr 21, 2013 at 23:04 GMT Originally opened as https://github.com/rmagick/rmagick/pull/75


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 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 ...


smparkes included the following code: https://github.com/rmagick/rmagick/pull/75/commits

bf4 commented 9 years ago

Comment by bschwartz Wednesday Mar 26, 2014 at 02:14 GMT


:+1: 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: https://github.com/rmagick/rmagick/commit/b87199c992c0f97f75e936f0f21e5c82665356cd

bf4 commented 9 years ago

Comment by freerobby Wednesday Mar 26, 2014 at 02:54 GMT


:+1: Please pull this in! Thank you @smparkes for the fix.

bf4 commented 9 years ago

Comment by jamesfzhang Wednesday Mar 26, 2014 at 13:30 GMT


:+1:

linduxed commented 8 years ago

Original PR here: https://github.com/rmagick-temp/rmagick/pull/75