Page 1 of 1

Alpha channel gets removed from grayscale image with IM 7.x

Posted: 2019-02-18T01:27:09-07:00
by slgaficon
I recently needed to upgrade from IM 6.7 to IM 7.x and ran into trouble with grayscale images. Precisely, I have a PSD file with alpha channel and clipping path which converted well with the existing generic script. But now, using the very same script, the alpha channel is removed.

Command line:
magick convert -units PixelsPerInch in.psd[0] -units PixelsPerInch -type TrueColor -depth 8 -density 300 -unsharp 0.0x0.0+0.0+0.0 +profile 8bim -alpha off out.psd

I tried several variations of the script but the alpha channel stays removed in the output image. Any ideas?

Re: Alpha channel gets removed from grayscale image with IM 7.x

Posted: 2019-02-18T10:43:51-07:00
by fmw42
First, In IM 7 use magick, not magick convert. Can you post your PSD file so that we can see it and investigate? What is your exact version of ImageMagick 7.x.x.x and date of version and platform?

Re: Alpha channel gets removed from grayscale image with IM 7.x

Posted: 2019-02-18T10:55:16-07:00
by snibgo
I don't understand the problem. The command has "-alpha off". This removes the alpha channel. Why is this a problem?

Re: Alpha channel gets removed from grayscale image with IM 7.x

Posted: 2019-02-18T11:30:31-07:00
by fmw42
Also why do an unsharp masking with all zero values?

Re: Alpha channel gets removed from grayscale image with IM 7.x

Posted: 2019-03-11T07:43:27-07:00
by slgaficon
To your last comment: You are absolutely right, the unsharp mask is worth nothing.
The command line given is the result of a longer script that generates it - with some overhead.

Re: Alpha channel gets removed from grayscale image with IM 7.x

Posted: 2019-03-11T11:14:21-07:00
by fmw42
try

-type TrueColorAlpha

Or leave -type TrueColor out, since if your input is color with alpha, then your output should also be.

Please always provide your full IM version and platform when asking questions, since syntax may vary. Also provide your input image if possible.

Re: Alpha channel gets removed from grayscale image with IM 7.x

Posted: 2019-03-15T06:36:47-07:00
by slgaficon
IM Version: 7.0.8-27 Q16 x64
Platform Windows x64

I changed the command to:
magick convert -units PixelsPerInch 5845394_02_1c_DE.psd[0] -units PixelsPerInch -depth 8 -density 300 +profile 8bim converted/5845394_02_1c_DE.psd

PhotoShop cannot read the created psd file: ... file is not compatiple with this version of PhotoShop.

Next, using TrueColorAlpha:
magick convert -units PixelsPerInch 5845394_02_1c_DE.psd[0] -units PixelsPerInch -type TrueColorAlpha -depth 8 -density 300 +profile 8bim converted/5845394_02_1c_DE.psd

PSD is readlable but has no alpha channel.

What is wrong?

Re: Alpha channel gets removed from grayscale image with IM 7.x

Posted: 2019-03-15T08:41:16-07:00
by slgaficon
Original file available here: http://nas.gaficon.de/sharing/V21Fgfu3c

Re: Alpha channel gets removed from grayscale image with IM 7.x

Posted: 2019-03-15T10:22:13-07:00
by fmw42
This command works fine for me on IM 7.0.8.33 Q16 Mac OSX. As I said above, do not use magick convert. Use simply magick. Adding [0] prevents imagemagick from accessing the background alpha. So I removed it.

Code: Select all

magick 5845394_02_1c_DE.psd +profile 8bim -depth 8 -units PixelsPerInch -density 300 -type TrueColorAlpha 5845394_02_1c_DE_fred.psd

Re: Alpha channel gets removed from grayscale image with IM 7.x

Posted: 2019-03-18T06:34:29-07:00
by slgaficon
Thanks, using your recommendations, I do get a transparent image. Next step after conversion is to draw a shadow.
With ImageMagick 6 and the cited command, the shadow was drawn around the object. Now, the shadow is drawn at the border of the canvas.

This seems to be because the apha channel is no longer explicitely present (PhotoShop only shows Greyscale channel)

IM command parameter: magick .\converted\5845394_02_1c_DE.psd[0] -resize 1500x1500> -colorspace sRGB ( +clone -background rgb(68,68,68) -shadow 100x8.0+5+5 ) +swap -background white -layers merge +repage ( -strip -gravity center -crop 1524x1523+0+0 +repage -resize 1500x1499 -density 72 -extent 1500x1499 ) .\converted\shadow\5845394_02_1c_DE.jpg

Re: Alpha channel gets removed from grayscale image with IM 7.x

Posted: 2019-03-18T06:38:03-07:00
by snibgo
Fred removed [0] because that image has no alpha.

You replaced [0], and get an image with no alpha.

So, try removing [0], or use [1] instead, or whatever.

Re: Alpha channel gets removed from grayscale image with IM 7.x

Posted: 2019-03-18T07:53:36-07:00
by slgaficon
Thanks for reply. Leaving out [0] everywhere solves the issue.
Can anyone tell me why this worked in previous IM Versions? Is it a general recommendation to leave out [0]?