Page 1 of 1

Problems converting PNG -> TIF

Posted: 2017-05-05T08:18:09-07:00
by erikwahlstrom
Hi everyone,

I'm having trouble converting a PNG to TIF. Bear with me.

Input:
test.png PNG 1844x1240 1844x1240+0+0 8-bit sRGB 256c 829KB 0.000u 0:00.000

I want to convert this file to a sRGB TIF. I've tried the following.

convert test.png test.tif

This converts the png to a grayscale tif for some reason. Why? The input png contains only grayscale information (a grayscale screenshot created with webkit2png) - could this be the origin of the trouble?

Output:
test.tif TIFF 1844x1240 1844x1240+0+0 8-bit Grayscale Gray 976KB 0.000u 0:00.000

I've tried forcing input and output profiles to sRGB but it still generates an grayscale tif.

convert test.png -profile sRGB\ Profile.icc -profile sRGB\ Profile.icc output_srgb.tif

Please help? A big thanks in advance.

Re: Problems converting PNG -> TIF

Posted: 2017-05-05T08:30:57-07:00
by snibgo
Try:

Code: Select all

convert test.png -type truecolor test.tif

Re: Problems converting PNG -> TIF

Posted: 2017-05-05T09:08:08-07:00
by fmw42
If snibgo's solution does not work, then please post your IM version and platform and your input image. You can upload to any free hosting service such as dropbox.com and put the URL here.

Re: Problems converting PNG -> TIF

Posted: 2017-05-05T09:25:34-07:00
by snibgo
I should expand. Using IM v6.9.5-3 on Windows 8.1:

Code: Select all

f:\web\im>%IM%convert rose: -colorspace gray test.png

f:\web\im>exiftool test.png
ExifTool Version Number         : 9.02
File Name                       : test.png
Directory                       : .
File Size                       : 2.4 kB
File Modification Date/Time     : 2017:05:05 17:19:53+01:00
File Access Date/Time           : 2016:07:14 17:28:41+01:00
File Permissions                : rw-rw-rw-
File Type                       : PNG
MIME Type                       : image/png
Image Width                     : 70
Image Height                    : 46
Bit Depth                       : 8
Color Type                      : Grayscale
Compression                     : Deflate/Inflate
Filter                          : Adaptive
Interlace                       : Noninterlaced
Gamma                           : 2.2
Background Color                : 255
Modify Date                     : 2017:05:05 17:19:53
Datecreate                      : 2017-05-05T17:19:53+01:00
Datemodify                      : 2017-05-05T17:19:53+01:00
Image Size                      : 70x46
test.png has one channel: "Bit Depth : 8"

Code: Select all

f:\web\im>%IM%convert test.png -type TrueColor test.tiff

f:\web\im>exiftool test.tiff
ExifTool Version Number         : 9.02
File Name                       : test.tiff
Directory                       : .
File Size                       : 4.0 kB
File Modification Date/Time     : 2017:05:05 17:20:24+01:00
File Access Date/Time           : 2013:12:30 22:41:06+00:00
File Permissions                : rw-rw-rw-
File Type                       : TIFF
MIME Type                       : image/tiff
Exif Byte Order                 : Little-endian (Intel, II)
Image Width                     : 70
Image Height                    : 46
Bits Per Sample                 : 8 8 8
Compression                     : Adobe Deflate
Photometric Interpretation      : RGB
Fill Order                      : Normal
Strip Offsets                   : 8
Orientation                     : Horizontal (normal)
Samples Per Pixel               : 3
Rows Per Strip                  : 46
Strip Byte Counts               : 3886
Planar Configuration            : Chunky
Page Number                     : 0 1
Predictor                       : Horizontal differencing
Image Size                      : 70x46
test.tif has three channels: "Bits Per Sample : 8 8 8"