Page 1 of 1

Issue Re sizing Images with hidden alpha channels

Posted: 2016-05-04T08:22:26-07:00
by nbalsamo
I am attempting to resize a tif image that has hidden alpha channels but the rendered tiff image does not look correct.

Original tif can be found here: https://drive.google.com/file/d/0BwIdg1 ... sp=sharing

Original tif screenshot: Image

Resized tif screenshot: Image

convert command: .\originalTif.tif[0] -background white -flatten -resize 53% .\resizedTif1.tif

version: Version: ImageMagick 6.8.9-1 Q16 x64

I'm not sure if we are missing a command line arguement or if this is a bug in the convert software.

Any help would be greatly appreciated!

Re: Issue Re sizing Images with hidden alpha channels

Posted: 2016-05-04T17:08:55-07:00
by snibgo
originalTif.tif contains an alpha channel that removes the visibility of two shoes. Your command makes those shoes white. If you want them to be visible, turn alpha off:

Code: Select all

convert originalTif.tif -alpha off -resize 53% r.tif

Re: Issue Re sizing Images with hidden alpha channels

Posted: 2016-05-04T20:01:19-07:00
by Jason S
The image has 3 "extra samples" per pixel, all of which are labeled as containing "unspecified" data (i.e. not necessarily alpha samples). As far as I can tell, if a TIFF image has one or more extra samples, ImageMagick 6.x always guesses that one of them (I'm not sure which one) is an alpha channel, and ignores the others. Maybe that works out well most of the time, but it seems like a slightly weird thing to do when there is more than one extra sample.

Re: Issue Re sizing Images with hidden alpha channels

Posted: 2016-05-04T20:21:02-07:00
by snibgo
Perhaps v7 will be able to read the "extra samples" channels. v7.0.1-0 doesn't seem to.

I probably misunderstood what you wanted. What is wrong with the "Resized tif screenshot"? What do you want changed?

Re: Issue Re sizing Images with hidden alpha channels

Posted: 2016-05-05T11:28:55-07:00
by nbalsamo
actually the -alpha off arg works as expected! We were trying to get the image to be resized and look as it does in Photoshop. Since those extra samples are "hidden" when you open the image in Photoshop - turning them off when running the image through convert worked. Greatly appreciate the help.

Re: Issue Re sizing Images with hidden alpha channels

Posted: 2016-11-23T10:08:09-07:00
by brooksrichardbrown
Unfortunately, if the image had real transparent portions (as opposed to a hidden alpha channel), turning off alpha would not be an option if you want to preserve transparency.

Re: Issue Re sizing Images with hidden alpha channels

Posted: 2016-11-23T10:22:01-07:00
by snibgo
True, and "-define tiff:alpha=XXX" may help there. See http://www.imagemagick.org/script/comma ... php#define . If that doesn't help, please show an example.

Re: Issue Re sizing Images with hidden alpha channels

Posted: 2016-11-25T10:04:54-07:00
by brooksrichardbrown
Hmm... is this discussion only about tiff images? My problem has to do with resizing PSD images with extra hidden alpha channels. In that case, I'm thinking that tiff:alpha=XXX won't work - from inspecting the code, pretty sure it won't. Is it okay if I provide an example of a PSD that manifests this problem?

Re: Issue Re sizing Images with hidden alpha channels

Posted: 2016-11-25T10:54:53-07:00
by fmw42
brooksrichardbrown wrote:Hmm... is this discussion only about tiff images? My problem has to do with resizing PSD images with extra hidden alpha channels. In that case, I'm thinking that tiff:alpha=XXX won't work - from inspecting the code, pretty sure it won't. Is it okay if I provide an example of a PSD that manifests this problem?
Please start a new topic.

Re: Issue Re sizing Images with hidden alpha channels

Posted: 2016-11-28T11:30:59-07:00
by brooksrichardbrown
I started a topic here a couple weeks ago, but I haven't heard anything, so I was searching for similar issues that others have reported. I provided a sample and a patch that I believe will help, at least in the case where the user is processing the merged layer. <url>https://www.imagemagick.org/discourse-s ... 30827</url>.