Convert Tiff to PNG

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.
Post Reply
jasmintondreau
Posts: 2
Joined: 2014-02-24T14:35:05-07:00
Authentication code: 6789

Convert Tiff to PNG

Post by jasmintondreau »

I try to convert with command line a Tiff file from a scan (gray and 600dpi). I tried many command and every time I had the result of a completely black image.

I tried to convert to jpg with many example to remove the transparency and i had the same result a black image.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Convert Tiff to PNG

Post by fmw42 »

What was your exact command line? What version of Imagemagick? What platform? Can you post a link to your tiff image? You can upload to any free hosting service such as dropbox (public folder) and put a link here.
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Re: Convert Tiff to PNG

Post by glennrp »

jasmintondreau wrote:I try to convert with command line a Tiff file from a scan (gray and 600dpi). I tried many command and every time I had the result of a completely black image.

I tried to convert to jpg with many example to remove the transparency and i had the same result a black image.
Without seeing the image I can only guess. Maybe you've got a 10-bit or 12-bit image that gets converted to 16 bits without properly shifting.
There are various ways of fixing that but I don't have any handy. Maybe "-auto-level". It's been discussed recently on one of the forums here.
jasmintondreau
Posts: 2
Joined: 2014-02-24T14:35:05-07:00
Authentication code: 6789

Re: Convert Tiff to PNG

Post by jasmintondreau »

Version: ImageMagick 6.5.4-7 2014-02-10 Q16 OpenMP http://www.imagemagick.org
Platform Linux Red Hat CentOS release 6.4

A link for the file (you must download)
https://drive.google.com/file/d/0B3Xg3e ... sp=sharing

The standard convert command: "convert source.tif destination.png"

I tried many other but I don't find any command is working, it's why I don't write-it.

Here the information from the identify of the tiff I want to convert

Format: TIFF (Tagged Image File Format)
Class: DirectClass
Geometry: 5100x6600+0+0
Resolution: 600x600
Print size: 8.5x11
Units: PixelsPerInch
Type: Bilevel
Base type: Bilevel
Endianess: MSB
Colorspace: RGB
Depth: 8/1-bit
Channel depth:
gray: 1-bit
Channel statistics:
gray:
min: 0 (0)
max: 255 (1)
mean: 0.0386364 (0.000151515)
standard deviation: 3.1386 (0.0123082)
kurtosis: 6595
skewness: 81.2219
Histogram:
33654900: ( 0, 0, 0) #000000 black
5100: (255,255,255) #FFFFFF white
Rendering intent: Undefined
Interlace: None
Background color: white
Border color: rgb(223,223,223)
Matte color: grey74
Transparent color: black
Page geometry: 5100x6600+0+0
Dispose: Undefined
Iterations: 0
Compression: JPEG
Orientation: TopLeft
Properties:
date:create: 2014-02-24T14:00:00-05:00
date:modify: 2014-02-24T13:56:06-05:00
signature: f118b7f782e24ec78dfdba8d00d8469e1fa89146616ffe2cf02db365e5923a2e
tiff:photometric: min-is-black
tiff:rows-per-strip: 6600
Artifacts:
verbose: true
Tainted: False
Filesize: 862kb
Number pixels: 32.1mb

Thanks for your help
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Convert Tiff to PNG

Post by fmw42 »

I get an error message when trying to view with Mac Preview that the file is damaged or a format not recognized.

When looking at the verbose info, IM says it is endian=msb but the tiff:endian is lsb. So that may be the issue.

2014-01-30 6.8.8-5 Glenn Randers-Pehrson <glennrp@image...>
Fixed new "-define png:swap-bytes" option (reference viewtopic.php?f=2&t=24818).

This works but require a relatively current IM version, though I get an error message or warning.

convert doc01521320140224135532_001.tif -define png:swap-bytes doc01521320140224135532_001.png

convert: Depreciated and troublesome old-style JPEG compression mode, please convert to new-style JPEG compression and notify vendor of writing software. `OJPEGSetupDecode' @ warning/tiff.c/TIFFWarnings/850.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Convert Tiff to PNG

Post by snibgo »

On IM v6.8.8-7 on Windows 8.1, the conversion ...

Code: Select all

convert doc01521320140224135532_001.tif x.png
... works fine for me, with the same warning message as fmw42.
jasmintondreau wrote:Version: ImageMagick 6.5.4-7
That is a very old version. I suggest you upgrade.
snibgo's IM pages: im.snibgo.com
lfall911
Posts: 3
Joined: 2015-11-16T15:34:02-07:00
Authentication code: 1151

Re: Convert Tiff to PNG

Post by lfall911 »

Hello,

I am having the same issue with a TIFF file. I am able to display the bi-tonal image successfully. However, for the grayscale image, I encouter the following warning:

OJPEGSetupDecode: Warning, Depreciated and troublesome old-style JPEG compression mode, please convert to new-style JPEG compression and notify vendor of writing software.

And when I display the image in Qt, the image is completely black.

This is the output from the bi-tonal image that displays correctly:
06 Nov 2015 15:38:14,045 [cashbox.ficut.CWFDepositItemView] [DEBUG]: onExpandItem()
06 Nov 2015 15:38:14,046 [common.CWFTiffToXpmConverter] [DEBUG]: readDirectory()
06 Nov 2015 15:38:14,046 [common.CWFTiffToXpmConverter] [DEBUG]: 1 bits per sample.
06 Nov 2015 15:38:14,046 [common.CWFTiffToXpmConverter] [DEBUG]: 1 samples per pixel.
06 Nov 2015 15:38:14,046 [common.CWFTiffToXpmConverter] [DEBUG]: Fill order is 1.
06 Nov 2015 15:38:14,046 [common.CWFTiffToXpmConverter] [DEBUG]: Photo metric is 0.
06 Nov 2015 15:38:14,046 [common.CWFTiffToXpmConverter] [DEBUG]: Planar config is 1.
06 Nov 2015 15:38:14,046 [common.CWFTiffToXpmConverter] [DEBUG]: 1200 columns.
06 Nov 2015 15:38:14,046 [common.CWFTiffToXpmConverter] [DEBUG]: 544 rows.
06 Nov 2015 15:38:14,046 [common.CWFTiffToXpmConverter] [DEBUG]: convertRasterInMemory()
06 Nov 2015 15:38:14,051 [common.CWFTiffToXpmConverter] [DEBUG]: convertTiffToRaster()
06 Nov 2015 15:38:14,051 [common.CWFTiffToXpmConverter] [DEBUG]: Converting 544 rows, 1200 columns.
06 Nov 2015 15:38:14,061 [common.CWFTiffToXpmConverter] [DEBUG]: reduce()
06 Nov 2015 15:38:14,066 [common.CWFTiffToXpmConverter] [DEBUG]: Scaled from 544x1200 to 272x600.
06 Nov 2015 15:38:14,066 [common.CWFTiffToXpmConverter] [DEBUG]: getXpmFile()
06 Nov 2015 15:38:14,069 [common.CWFSICFile] [DEBUG]: Close
06 Nov 2015 15:38:14,069 [common.CWFSICUtil] [DEBUG]: Loading from xpm...

This is the output from the grayscale image that displays as a completely black image:
06 Nov 2015 16:48:16,998 [common.CWFTiffToXpmConverter] [DEBUG]: readDirectory()
06 Nov 2015 16:48:16,998 [common.CWFTiffToXpmConverter] [DEBUG]: 8 bits per sample.
06 Nov 2015 16:48:16,998 [common.CWFTiffToXpmConverter] [DEBUG]: 1 samples per pixel.
06 Nov 2015 16:48:16,998 [common.CWFTiffToXpmConverter] [DEBUG]: Fill order is 1.
06 Nov 2015 16:48:16,998 [common.CWFTiffToXpmConverter] [DEBUG]: Photo metric is 1.
06 Nov 2015 16:48:16,998 [common.CWFTiffToXpmConverter] [DEBUG]: Planar config is 1.
06 Nov 2015 16:48:16,998 [common.CWFTiffToXpmConverter] [DEBUG]: 600 columns.
06 Nov 2015 16:48:16,998 [common.CWFTiffToXpmConverter] [DEBUG]: 272 rows.
06 Nov 2015 16:48:16,998 [common.CWFTiffToXpmConverter] [DEBUG]: convertRasterInMemory()
OJPEGSetupDecode: Warning, Depreciated and troublesome old-style JPEG compression mode, please convert to new-style JPEG compression and notify vendor of writing software.
06 Nov 2015 16:48:17,002 [common.CWFTiffToXpmConverter] [DEBUG]: convertTiffToRaster()
06 Nov 2015 16:48:17,002 [common.CWFTiffToXpmConverter] [DEBUG]: Converting 272 rows, 600 columns.
06 Nov 2015 16:48:17,004 [common.CWFTiffToXpmConverter] [DEBUG]: reduce()
06 Nov 2015 16:48:17,005 [common.CWFTiffToXpmConverter] [DEBUG]: Scaled from 272x600 to 136x300.
06 Nov 2015 16:48:17,005 [common.CWFTiffToXpmConverter] [DEBUG]: getXpmFile()
06 Nov 2015 16:48:17,006 [common.CWFSICFile] [DEBUG]: Close
06 Nov 2015 16:48:17,006 [common.CWFSICUtil] [DEBUG]: Loading from xpm...

Thanks for any help!
Liz
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: Convert Tiff to PNG

Post by dlemstra »

Which version of ImageMagick are you using? And what is your operating system.
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
lfall911
Posts: 3
Joined: 2015-11-16T15:34:02-07:00
Authentication code: 1151

Re: Convert Tiff to PNG

Post by lfall911 »

Hi,

We are using imageMagick 5.0 and RHEL - Version 6.2.

Thanks1
Liz
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Re: Convert Tiff to PNG

Post by glennrp »

ImageMagick 5.0 is more than 10 years old. How old are the libpng and the libtiff that you're using with it?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Convert Tiff to PNG

Post by fmw42 »

Above he says ImageMagick 6.5.4-7. So I suspect 5.0 is not correct, though still about 380 versions old.
lfall911
Posts: 3
Joined: 2015-11-16T15:34:02-07:00
Authentication code: 1151

Re: Convert Tiff to PNG

Post by lfall911 »

Hi,

It looks like we are using 3.9.4 for the libtiff.

Thanks,
Liz
Post Reply