Sepia effect with imagick like in photoshop

IMagick is a native PHP extension to create and modify images using the ImageMagick API. ImageMagick Studio LLC did not write nor does it maintain the IMagick extension, however, IMagick users are welcome to discuss the extension here.
Locked
bseeleib
Posts: 2
Joined: 2014-09-06T01:35:05-07:00
Authentication code: 6789

Sepia effect with imagick like in photoshop

Post by bseeleib »

I'm converting a image from color to sepia with imagick+php, using the sepiaToneImage function. While the effect is good i would like it be more like the photoshop sepia filter (pictured below). Is this possible and how? I've already tried modulateImage but i couldn't get nere the photoshop effect. As far as i unterstand it, imagick is converting the picture to grayscale and then applies color, ist it possible to convert to sepia without grayscale (as this might be the fix)?

Example picture:
Image

Code: Select all

$img = new Imagick("test.jpg");
$img->setImageFormat('jpeg');
$img->sepiaToneImage(80);
header("Content-Type: image/jpeg");
echo $img;
Any help is appreciated.

User avatar
fmw42
Posts: 26383
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Sepia effect with imagick like in photoshop

Post by fmw42 »

The sepia colorization in PS is much different from IM. You can try changing the color with

1) duotone processing such as http://www.imagemagick.org/Usage/color_mods/#duotone
2) -color-matrix such as http://www.imagemagick.org/Usage/color_ ... lor-matrix
3) convert to grayscale and clut such as http://www.imagemagick.org/Usage/color_mods/#clut
4) convert to graylevel and +level-colors such as http://www.imagemagick.org/Usage/color_ ... vel-colors

But to reproduce PS exactly, the best way is to create a HALD image, take it to PS, apply the PS sepia process, then take the processed HALD image back to IM and use -hald-clut. See http://www.imagemagick.org/Usage/color_mods/#hald-clut

bseeleib
Posts: 2
Joined: 2014-09-06T01:35:05-07:00
Authentication code: 6789

Re: Sepia effect with imagick like in photoshop

Post by bseeleib »

The HALD image did the trick, @fmw42 thank you very much!!!

Locked