Page 1 of 1

Problem with saving image with transparency in TIFF format

Posted: 2006-12-13T08:46:08-07:00
by Caesar
Hello.

I'm trying to convert png image with transparency into TIFF format and have strange problems.

Please see example files: http://decay.ru/trash/ref.png

That is the png file with black text on transparent background. As you can see there are smooth transparency fade-out (or fade-in?) on edges of letters.

I'm trying to convert it into tiff file and allways getting strange results:
http://decay.ru/trash/out.tiff

I'm using Adobe Photoshop to view resulting image and i'm confused by three issues:

1) Photoshop shows file as the image with two layers: 'gray' channel that is almost completely filled by black color and 'alpha' channel with actual image information where opaque areas represents orginal image from ref.png.

Mixing of that two layers never gives me anything similar with original image.

2) There are no any smooth transparency fade-out on edges of text.
3) There are very strange vertical lines in both channels. That lines are four pixels wide and consists of horizontal gradients from 25% black to 0%.

converting out.tiff to png with the same utility does not produce anything similar with source image (see http://decay.ru/trash/out.png)

Please can anybody tell if this imagemagick or libtiff or libpng bug?

And is there any way to convert transparent png to tiff that produces output similar to photoshop-driven conversion (that preserves smooth transparency fade-outs on edges and produces file understandable by photoshop)?

Some system info and commands used to generate example images:

Code: Select all

$ ./convert ref.png out.tiff
$ ./convert out.tiff out.png
$ ./convert -version
Version: ImageMagick 6.3.1 12/13/06 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2007 ImageMagick Studio LLC

$ grep -a LIBTIFF /usr/lib/libtiff.so
LIBTIFF, Version 3.6.1
$ uname -a
Linux ****** 2.6.12-1.1372_FC3smp #1 SMP Fri Jul 15 01:30:03 EDT 2005 i686 i686 i386 GNU/Linux
Thanks in advance for any help!

Posted: 2006-12-13T12:26:54-07:00
by magick
Try this command:
  • convert ref.png -depth 8 ref.tif

Posted: 2006-12-13T23:55:31-07:00
by Caesar
Thanks! That's works, gives me smooth edges but still produces file that photoshop does not understands: it shows image as two separate layers ('gray' now contains black rectangle that bounds area containing text in initial image and alpha layer that is looks like inverted original image. Is there any way to produce tiff that will be shown in photoshop correctly?

And one more question: is there any fast way to set all channels to zero values for pixels where the alpha channel is zero? (i know that i can do it using -fx command, but it will be very slow)

Posted: 2006-12-14T08:18:21-07:00
by magick
TIFF is a fairly versatile image format, however, very few readers can grok the full TIFF specification. Its possible Photoshop requires a specific subset of the TIFF format.

To set particular pixels of an image to use -clip-mask to define which pixels to affect and -evaluate to set the pixels to zero.

Posted: 2006-12-19T06:19:09-07:00
by Caesar
Thanks a lot! I'll try this way.