Issue Re sizing Images with hidden alpha channels

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Locked
nbalsamo
Posts: 2
Joined: 2016-05-04T08:07:55-07:00
Authentication code: 1151

Issue Re sizing Images with hidden alpha channels

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

snibgo
Posts: 13034
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Issue Re sizing Images with hidden alpha channels

Post 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
snibgo's IM pages: im.snibgo.com

Jason S
Posts: 103
Joined: 2010-12-14T19:42:12-07:00
Authentication code: 8675308

Re: Issue Re sizing Images with hidden alpha channels

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

snibgo
Posts: 13034
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Issue Re sizing Images with hidden alpha channels

Post 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?
snibgo's IM pages: im.snibgo.com

nbalsamo
Posts: 2
Joined: 2016-05-04T08:07:55-07:00
Authentication code: 1151

Re: Issue Re sizing Images with hidden alpha channels

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

brooksrichardbrown
Posts: 3
Joined: 2016-11-09T11:32:58-07:00
Authentication code: 1151

Re: Issue Re sizing Images with hidden alpha channels

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

snibgo
Posts: 13034
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Issue Re sizing Images with hidden alpha channels

Post 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.
snibgo's IM pages: im.snibgo.com

brooksrichardbrown
Posts: 3
Joined: 2016-11-09T11:32:58-07:00
Authentication code: 1151

Re: Issue Re sizing Images with hidden alpha channels

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

User avatar
fmw42
Posts: 26383
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Issue Re sizing Images with hidden alpha channels

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

brooksrichardbrown
Posts: 3
Joined: 2016-11-09T11:32:58-07:00
Authentication code: 1151

Re: Issue Re sizing Images with hidden alpha channels

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

Locked