image icon indicating copy to clipboard operation
image copied to clipboard

make() changes colorspace of the image

Open jespejoh opened this issue 8 years ago • 3 comments

Hi there!

I update the issue as after doing some more tests I noticed the error is somewhere else. I'm pretty certain that the image I'm opening is CMYK, but it gets opened as SRGB, so whenever I try to resize it generates a new image but with a wrong color space, so the original and the thumbnail looks pretty different.

Cheers! Jesús E.

jespejoh avatar Sep 22 '16 09:09 jespejoh

I also got this problem. @jespejoh Have you found any solutions?

anhquancao avatar Nov 05 '16 04:11 anhquancao

Wow, it's open from 2016! long time! I've faced same issue at 2020

AminEshtiaghi avatar Sep 15 '20 05:09 AminEshtiaghi

I still got this issue also. For those using GD I don't know if a solution exists, but with Imagick we could use Imagick::transformImageColorspace.

For now I convert the image to sRGB (as this stackoverflow answer suggests) before doing any manipulation with Intervention. It's not efficient but it works. In my case it's not a big deal since I already cache my image in order to bypass the image processing, which yields good results in terms of performances.

$imagick = new \Imagick($inputPath);
$imagick->transformImageColorspace(\Imagick::COLORSPACE_SRGB);
$imagick->writeImage($outputPath);

Image::make($outputPath)->resize($maxsize, $maxsize, function ($constraint) {
  $constraint->aspectRatio();
  $constraint->upsize();
})->save($outputPath)

Hoping it will help some of us.

related to #707

EDIT : Actually I realize that the simple fact to use Imagick instead of gd fixed my issue, I didn't need to transform the colorspace beforehand. But it might depends on the version of Imagick you're using. On my side I use ImageMagick 6.9.10-23 Q16 x86_64 20190101 with the module version 3.4.4.

plaffitt avatar May 11 '21 22:05 plaffitt

This issue should no longer occur in version 3. However GD only supports RGB color space.

olivervogel avatar Dec 09 '23 09:12 olivervogel