Page 1 of 1

Rotate tiff to tiff results in black image

Posted: 2012-05-29T23:46:43-07:00
by edge
I have created a web user interface where users could view tiff files and rotate them to their correct orientation if necessary. All the tif files are 1-bit Black&White group4 compressed single pages. I used exec() command from PHP to run ImageMagick at command-line (when I run the commands directly on the cmd.exe of windows 7, I receive the same result).

The result image background is turned into black when viewed in many tiff viewers and Safari Browser (since the image itself is black and white, nothing could be seen).
IrfanView displays an image that has green over black stripes as the background and the data is in black placed on top of it.

It gives an "error:Unsupported bits/sample(1)" when I tried to view it at Alternatiff plugin for firefox and , Windows XP's Image and Fax Viewer can't dislplay it at all.

But when it is viewed in Windows Image Viewer of Wİndows 7 it looks fine!!!!!

My command is simple: convert test1.tif –rotate 90 test2.tif

I have also tried many variations of the following in the command after -rotate 90 with no luck:
-monochrome
-type bilevel
-depth 1
-alpha On
-compress group4
-colorspace transparent
-colorspace-color white

I have attached the original test1.tif and the result test2.tif for your you.
test1.tif
test2.tif

Here is the result of convert test1.tif –verbose info:

Image: test1.tif
Format: TIFF (Tagged Image File Format)
Class: DirectClass
Geometry: 2551x3581+0+0
Resolution: 300x300
Print size: 8.50333x11.9367
Units: PixelsPerInch
Type: Bilevel
Base type: Bilevel
Endianess: Undefined
Colorspace: Gray
Depth: 1-bit
Channel depth:
gray: 1-bit
Channel statistics:
Gray:
min: 0 (0)
max: 1 (1)
mean: 0.987535 (0.987535)
standard deviation: 0.110947 (0.110947)
kurtosis: 75.2396
skewness: -8.78861
Colors: 2
Histogram:
113866: ( 0, 0, 0) #000000 gray(0,0,0)
9021265: (255,255,255) #FFFFFF gray(255,255,255)
Rendering intent: Undefined
Gamma: 1
Interlace: None
Background color: gray(255,255,255)
Border color: gray(223,223,223)
Matte color: gray(189,189,189)
Transparent color: gray(0,0,0)
Compose: Over
Page geometry: 2551x3581+0+0
Dispose: Undefined
Iterations: 0
Compression: Group4
Orientation: TopLeft
Properties:
date:create: 2012-05-30T07:34:14+03:00
date:modify: 2012-03-01T14:45:18+02:00
signature: 584786a432b2d3eb5e9d6e826df0ac1669c0911c1a4b64164f853b4e056ce93e
tiff:endian: lsb
tiff:photometric: min-is-white
tiff:rows-per-strip: 3581
tiff:software: Pixel Translations Inc., PIXTIFF Version 57.5.218.4430
Artifacts:
filename: test1.tif
verbose: true
Tainted: False
Filesize: 16.1KB
Number pixels: 9.135M
Pixels per second: 186.4MB
User time: 0.047u
Elapsed time: 0:01.048
Version: ImageMagick 6.7.7-2 2012-05-25 Q16 http://www.imagemagick.org

Here is the result of convert test2.tif –verbose info:

Image: test2.tif
Format: TIFF (Tagged Image File Format)
Class: DirectClass
Geometry: 3581x2551+0+0
Resolution: 300x300
Print size: 11.9367x8.50333
Units: PixelsPerInch
Type: Palette
Base type: TrueColor
Endianess: Undefined
Colorspace: sRGB
Depth: 1-bit
Channel depth:
red: 1-bit
green: 1-bit
blue: 1-bit
Channel statistics:
Red:
min: 0 (0)
max: 1 (1)
mean: 0.987535 (0.987535)
standard deviation: 0.110947 (0.110947)
kurtosis: 75.2396
skewness: -8.78861
Green:
min: 0 (0)
max: 1 (1)
mean: 0.987535 (0.987535)
standard deviation: 0.110947 (0.110947)
kurtosis: 75.2396
skewness: -8.78861
Blue:
min: 0 (0)
max: 1 (1)
mean: 0.987535 (0.987535)
standard deviation: 0.110947 (0.110947)
kurtosis: 75.2396
skewness: -8.78861
Image statistics:
Overall:
min: 0 (0)
max: 1 (1)
mean: 0.987535 (0.987535)
standard deviation: 0.110947 (0.110947)
kurtosis: 75.2396
skewness: -8.78861
Colors: 2
Histogram:
113866: ( 0, 0, 0) #000000 black
9021265: (255,255,255) #FFFFFF white
Rendering intent: Perceptual
Gamma: 0.454545
Chromaticity:
red primary: (0.64,0.33)
green primary: (0.3,0.6)
blue primary: (0.15,0.06)
white point: (0.3127,0.329)
Interlace: None
Background color: white
Border color: srgb(223,223,223)
Matte color: grey74
Transparent color: black
Compose: Over
Page geometry: 3581x2551+0+0
Dispose: Undefined
Iterations: 0
Compression: None
Orientation: TopLeft
Properties:
date:create: 2012-05-30T09:26:29+03:00
date:modify: 2012-05-30T09:26:29+03:00
signature: 35e4de30fa40ee430e9e7d6dda3bedd08bca69f18db7e8a878255252223c3cce
tiff:document: test2.tif
tiff:endian: lsb
tiff:photometric: RGB
tiff:rows-per-strip: 6
tiff:software: Pixel Translations Inc., PIXTIFF Version 57.5.218.4430
Artifacts:
filename: test2.tif
verbose: true
Tainted: False
Filesize: 3.43MB
Number pixels: 9.135M
Pixels per second: 7.638MB
User time: 1.186u
Elapsed time: 0:02.196
Version: ImageMagick 6.7.7-2 2012-05-25 Q16 http://www.imagemagick.org


I am working on:
Windows 7 Pro 32 bit
ImageMagick-6.7.7-2-Q16-windows-static.exe

Is this a bug or am I doing something wrong here?

Thank you.

Re: Rotate tiff to tiff results in black image

Posted: 2012-05-30T05:04:09-07:00
by magick
We can reproduce the problem you posted and have a patch. Look for it in the ImageMagick 6.7.7-4 release within a few days. Thanks.

Re: Rotate tiff to tiff results in black image

Posted: 2012-05-30T05:58:04-07:00
by edge
Ok thank you, Something must be going wrong when saving the tif file, because it does it not only at -rotate but any command requires recreating the file.

Re: Rotate tiff to tiff results in black image

Posted: 2014-12-22T12:12:26-07:00
by edge
Well its been couple of years now. I am using ImageMagick-6.7.7-5-Q16-windows-dll version and seems like the problem still exist?
Funny thing is that if I rotate it 89 and than 1 before saving it. It works!

Re: Rotate tiff to tiff results in black image

Posted: 2014-12-22T12:49:35-07:00
by fmw42
I think you should upgrade to a more current version of IM. Your version is about 125 versions old.