Page 1 of 1

Imagick trimImage function issue

Posted: 2018-09-10T03:23:44-07:00
by mjamal
Hello Team,

Can any one please let me know how I am getting the two different image mode for the trim output of an image.

Like I am checking the below command on my two different servers which are having different image magick versions installed.

Server 1: Version "ImageMagick 6.7.8-9" is installed and when I am executing the below command then the output image mode in photoshop is showing "RGB" and which is correct because my input image mode is also in "RGB".

Server 2: Version "ImageMagick 6.9.4-10" is installed and when I am executing the below command then the output image mode in photoshop is showing "Grayscale" and which is I think incorrect because my input image mode is in "RGB".

COMMAND:
exec("convert iuputImg.jpg -fuzz 1% -trim +repage outputImg.jpg");

Please any one let me know what exactly I am doing wrong or what need to be added in mentioned command. Also I used the PHP "trimImage " function and same issue faced with this also.
Let me know if anyone need the input image for checking.

Thanks in advanced

Re: Imagick trimImage function issue

Posted: 2018-09-10T03:42:25-07:00
by snibgo
mjamal wrote:Let me know if anyone need the input image for checking.
Yes, we do. Otherwise we can only guess.

My guess is that the trimmed image contains no colour, all the pixels are some shade of gray. Some versions of IM will realise this, and save the image in the most efficient way.

Re: Imagick trimImage function issue

Posted: 2018-09-10T04:36:12-07:00
by mjamal
Hello Snibgo,

Here is the input image which I am using for testing in both of my servers. Also yes the input image is having gray shades but in both of my servers the image mode is showing different.

INPUT IMAGE:
Firstlayerfile_final_0.jpg
Firstlayerfile_final_0.jpg (133.06 KiB) Viewed 83756 times

Re: Imagick trimImage function issue

Posted: 2018-09-10T04:43:33-07:00
by snibgo
So my guess was correct, and IM saves the image in the most space-saving mode. "-type truecolor" will force RGB mode, ie the output will contain colour channels.

Re: Imagick trimImage function issue

Posted: 2018-09-11T02:08:25-07:00
by mjamal
@ Snibgo, Yes from "-type truecolor", I am now able to get the image mode in RGB. Thank you.