Convert PSD or TIF to JPG ignore alpha

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
JaredA
Posts: 5
Joined: 2018-05-25T07:08:49-07:00
Authentication code: 1152

Convert PSD or TIF to JPG ignore alpha

Post 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.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Convert PSD or TIF to JPG ignore alpha

Post 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>
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Convert PSD or TIF to JPG ignore alpha

Post 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.
JaredA
Posts: 5
Joined: 2018-05-25T07:08:49-07:00
Authentication code: 1152

Re: Convert PSD or TIF to JPG ignore alpha

Post by JaredA »

Thank you for the quick responses, here is the link to the example: http://s000.tinyupload.com/?file_id=032 ... 3421656023
JaredA
Posts: 5
Joined: 2018-05-25T07:08:49-07:00
Authentication code: 1152

Re: Convert PSD or TIF to JPG ignore alpha

Post 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
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Convert PSD or TIF to JPG ignore alpha

Post 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.
JaredA
Posts: 5
Joined: 2018-05-25T07:08:49-07:00
Authentication code: 1152

Re: Convert PSD or TIF to JPG ignore alpha

Post 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?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Convert PSD or TIF to JPG ignore alpha

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