Hue / Saturation / Brightness Issue ...

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.
Post Reply
dbee

Hue / Saturation / Brightness Issue ...

Post by dbee »

I'm using Imagick / ImageMagick with PHP

PHP 5.1.6 (cli)
Version: ImageMagick 6.3.7 01/09/08 Q16 http://www.imagemagick.org

I have a problem adjusting the Hue/Saturation/Brightness. Everytime i make an adjustment, the photo goes completely black.

Code: Select all

        ( $val == 'more') ? ( $d = 100 && $e=90 ) : ( $d=-100 && $e=-90 ) ;

        // Modulate Image - Brightness, Saturation, Hue
        $r_pic->modulateImage($d,$d,$e);
I've played around with it, but I can't seem to get it to work right. Everything else works fine, I can resize, crop, create effects etc... Imagick seems to be installed properly. So is this a bug then or what ?
dbee

Re: Hue / Saturation / Brightness Issue ...

Post by dbee »

Should I post this in bugs then ?
mkoppanen
Posts: 309
Joined: 2007-06-09T07:06:32-07:00

Re: Hue / Saturation / Brightness Issue ...

Post by mkoppanen »

I hate to say but works for me. I am using ImageMagick 6.4.0 and modulateImage seems to be working as it should be.
Mikko Koppanen
My blog: http://valokuva.org
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Hue / Saturation / Brightness Issue ...

Post by fmw42 »

there was a bug before IM 6.4.0-10, but it was fixed.
DarkKlown

Re: Hue / Saturation / Brightness Issue ...

Post by DarkKlown »

I'm using having the same problem with the following setup, I'm trying to turn a colour photo into black and white and it just comes out black.

Maybe someone can suggest another way to turn a image into black and white?

I've compiled the imagick against ImageMagick 6.3.7 02/18/08 Q16 http://www.imagemagick.org

and i'm using the following code:

Code: Select all

        $thumb->readImage($row['imageFileName']);
        $thumb->thumbnailImage(160, 160, true);
        $thumb->modulateImage(0, -100, 0);
        $thumb->writeImage($row['imageFileName']);
imagick
imagick module enabled
imagick module version 2.2.1
imagick classes Imagick, ImagickDraw, ImagickPixel, ImagickPixelIterator
ImageMagick version ImageMagick 6.3.7 02/18/08 Q16 http://www.imagemagick.org
ImageMagick copyright Copyright (C) 1999-2008 ImageMagick Studio LLC
ImageMagick release date 02/18/08
ImageMagick Number of supported formats: 179
ImageMagick Supported formats A, AI, ART, ARW, AVI, AVS, B, BMP, BMP2, BMP3, C, CAPTION, CIN, CIP, CLIP, CMYK, CMYKA, CR2, CRW, CUR, CUT, DCM, DCR, DCX, DFONT, DJVU, DNG, DOT, DPS, DPX, EPDF, EPI, EPS, EPS2, EPS3, EPSF, EPSI, EPT, EPT2, EPT3, EXR, FAX, FITS, FRACTAL, FTS, G, G3, GIF, GIF87, GRADIENT, GRAY, HISTOGRAM, HTM, HTML, ICB, ICO, ICON, INFO, IPL, JNG, JP2, JPC, JPEG, JPG, JPX, K, K25, KDC, LABEL, M, M2V, MAP, MAT, MATTE, MIFF, MNG, MONO, MPC, MPEG, MPG, MRW, MSL, MSVG, MTV, MVG, NEF, NULL, O, ORF, OTB, OTF, PAL, PALM, PAM, PATTERN, PBM, PCD, PCDS, PCL, PCT, PCX, PDB, PDF, PEF, PFA, PFB, PFM, PGM, PGX, PICON, PICT, PIX, PJPEG, PLASMA, PNG, PNG24, PNG32, PNG8, PNM, PPM, PREVIEW, PS, PS2, PS3, PSD, PTIF, PWP, R, RAF, RAS, RGB, RGBA, RGBO, RLA, RLE, SCR, SCT, SFW, SGI, SHTML, SR2, SRF, STEGANO, SUN, SVG, SVGZ, TEXT, TGA, THUMBNAIL, TIFF, TIFF64, TILE, TIM, TTC, TTF, TXT, UIL, UYVY, VDA, VICAR, VID, VIFF, VST, WBMP, WMF, WMZ, WPG, X, X3F, XBM, XC, XCF, XPM, XV, XWD, Y, YCbCr, YCbCrA, YUV

Directive Local Value Master Value
imagick.locale_fix 0 0
DarkKlown

Re: Hue / Saturation / Brightness Issue ...

Post by DarkKlown »

Ok i figured it out. all the values should be set to 100 and then subtract whatever you want from them.

so the line should read:

Code: Select all

        $thumb->modulateImage(100, 0, 100);
This will leave the hue at 100%, take down the saturation by 100%, and leave the brightness at 100%.

Rather annoying. I hope this saves someone else a few moments of hair pulling.
Post Reply