Page 1 of 1

Convert PSD or TIF to JPG ignore alpha

Posted: 2018-05-25T11:20:30-07:00
by JaredA
We have recently updated our RHEL ImageMagick from 6.7.8 to 7.0.3-8. Previous to the upgrade I was getting undesirable results in converting TIF files containing alpha channels converting to JPG format. Now post upgrade I am seeing the same with PSDs containing alpha channels to JPG.

The bad behavior is that the alpha channel is displayed in the JPG, here shown as the word "ALPHA".

PSD to JPG in PS: Image in IM: Image

Code: Select all

magick <input-file>[0] -intent relative -sample -quality 95 -colorspace sRGB -strip
I've tried adding the various -alpha commands to try to ignore, such as Transparent, Remove, Off, Disassociate and have not yet had good results. Can anyone help? I want the alpha channel to be ignored.

Re: Convert PSD or TIF to JPG ignore alpha

Posted: 2018-05-25T11:41:58-07:00
by fmw42
I do not see any "ALPHA" in your IM result! In your command line -sample needs a <geometry> value. You do not show the output in your command. Is that all that is missing? Please show the actual command line with image names. It would be best if you could provide your input PSD file. Have you tried:

Code: Select all

magick <input-file>[0] -alpha off -intent relative -sample -quality 95 -colorspace sRGB -strip <output-file>

Re: Convert PSD or TIF to JPG ignore alpha

Posted: 2018-05-25T12:06:49-07:00
by Bonzo
fmw42 "Alpha" is on the second image towards the bottom - may not show up depending on the monitor calibration?
But as you say it is important to provide a link to the input image.

Re: Convert PSD or TIF to JPG ignore alpha

Posted: 2018-05-25T12:17:22-07:00
by JaredA
Thank you for the quick responses, here is the link to the example: http://s000.tinyupload.com/?file_id=032 ... 3421656023

Re: Convert PSD or TIF to JPG ignore alpha

Posted: 2018-05-25T12:23:29-07:00
by JaredA
Moving the "-alpha off" argument to be earlier in the sequence has no effect, undesired result still occurs.

Code: Select all

magick Alpha_Example.psd[0] -alpha off -intent relative -quality 95 -colorspace sRGB -strip Alpha_Example.jpg

Re: Convert PSD or TIF to JPG ignore alpha

Posted: 2018-05-25T12:55:44-07:00
by fmw42
try this

Code: Select all

magick -define psd:alpha-unblend=off Alpha_Example.psd[0] result.jpg
See http://www.imagemagick.org/script/comma ... php#define

Personally, I think there is a bug, since your alpha channel is disabled in the PSD file and should not show. But the IM developers will need to comment further.

Re: Convert PSD or TIF to JPG ignore alpha

Posted: 2018-05-30T12:07:20-07:00
by JaredA
@fmw42 the "psd:alpha-unblend=off" command has done the trick. If you think this could be a bug, should I open a new thread in the IM "Bugs" forum?

Re: Convert PSD or TIF to JPG ignore alpha

Posted: 2018-05-30T12:36:13-07:00
by fmw42
It would not hurt to ask if that is a bug. My thinking is that IM should not display a disabled layer. But Imagemagick's handling of PSD and TIFF files have been a bit limited in the past and may have bugs. But they are being worked on slowly. The define I suggested may be the current way to handle this, though that define is not obvious that it relates. Perhaps a more direct -define would be useful such as PSD/TIFF:hidden-layer-ignore=yes/no