tif to png no longer works with IM6.8.9

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
User avatar
michelle
Posts: 31
Joined: 2011-08-24T06:45:50-07:00
Authentication code: 8675308

tif to png no longer works with IM6.8.9

Post by michelle »

Hi there,

I have 2 PCs with IM:
Old PC: ImageMagick-6.7.1-10-Q16-windows-dll installed
New PC: ImageMagick-6.8.9-2-Q16-x64-dll installed

I run this command on each:
(1) convert original.tif[0] -scale @400000 newpng_6.7.1.png (6.7.1 this works)
Magick: original.tif: unknown field with tag 292 (0x124) encountered. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/707.
(2) convert original.tif[0] -scale @400000 newpng_6.8.9.png (6.8.9 creates a blank png!)
(no warning or error messages printed from 6.8.9)

The problem:
6.7.1 converts the .tif into a .png without a problem, but 6.8.9 creates a blank png.

Files can be viewed here:
http://sndprecision.com/pics/original.tif
http://sndprecision.com/pics/newpng_6.7.1.png
http://sndprecision.com/pics/newpng_6.8.9.png

Question:
Could anyone suggest what I am doing incorrectly? Or perhaps I have to install a "helper tool" something like what GhostScript is to pdf??

Thank-you in advance, Michelle
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: tif to png no longer works with IM6.8.9

Post by fmw42 »

This seems to work for me on IM 6.8.9.4 Q16 Mac OSX

Code: Select all

convert original.tif[0] -scale @400000 PNG8:tmp.png
User avatar
michelle
Posts: 31
Joined: 2011-08-24T06:45:50-07:00
Authentication code: 8675308

Re: tif to png no longer works with IM6.8.9

Post by michelle »

Is there anything I should be installing in addition to ImageMagick? I remember installing vcredist_x64.exe with the earlier version for stability... (I think). Any clues on how I can figure out what the problem is? I really need this functionality :(

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

Re: tif to png no longer works with IM6.8.9

Post by fmw42 »

michelle wrote:Is there anything I should be installing in addition to ImageMagick? I remember installing vcredist_x64.exe with the earlier version for stability... (I think). Any clues on how I can figure out what the problem is? I really need this functionality :(

Thanks again.
Did you try my command with the PNG8: before the output?

The only other thing that I can think of is to update your libpng and libtif delegate libraries.

convert -list format

should tell you what versions you have installed. For example, mine is


PNG* PNG rw- Portable Network Graphics (libpng 1.6.10)

TIFF* TIFF rw+ Tagged Image File Format (LIBTIFF, Version 4.0.3)
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: tif to png no longer works with IM6.8.9

Post by snibgo »

It isn't totally white on v6.8.9-0 in Windows 8.1, but the marks could easily be mistaken for a dirty screen.

It converts fine with v6.8.0 but not 6.8.1. It is a 1-bit image, which naturally doesn't scale well if kept at 1-bit. "-depth 16" cures it.

Code: Select all

convert original.tif -depth 16 -scale @400000 n.png
Or, as Fred says, "PNG8:".
snibgo's IM pages: im.snibgo.com
User avatar
michelle
Posts: 31
Joined: 2011-08-24T06:45:50-07:00
Authentication code: 8675308

Re: tif to png no longer works with IM6.8.9

Post by michelle »

fmw42 wrote: Did you try my command with the PNG8: before the output?
Oops! Sorry Fred I completely missed your recommendation. I've just tried your command now and it works!
snibgo wrote:...It is a 1-bit image, which naturally doesn't scale well if kept at 1-bit. "-depth 16" cures it. Or, as Fred says, "PNG8:".
Equally, Snibgo, I tried your command and it also works.

Lastly, just quoting a bit of documentation should anyone reading this post like further explanation of "PNG8:"
http://www.imagemagick.org/script/command-line-options.php wrote: png:format=value
valid values are png8, png24, png32, png48, png64, and png00. This property can be useful for specifying the specific PNG format to be used, when the usual method of prepending the format name to the output filename is inconvenient, such as when writing a PNG-encoded ICO file or when using mogrify. Value = png8 reduces the number of colors to 256, only one of which may be fully transparent, if necessary. The other values do not force any reduction of quality; it is an error to request a format that cannot represent the image data without loss (except that it is allowed to reduce the bit-depth from 16 to 8 for all formats). Value = png24 and png48 allow transparency, only if a single color is fully transparent and that color does not also appear in an opaque pixel; such transparency is written in a PNG tRNS chunk. Value = png00 causes the image to inherit its color-type and bit-depth from the input image, if the input was also a PNG.

Thank-you gentlemen, my problem is solved! :)
User avatar
michelle
Posts: 31
Joined: 2011-08-24T06:45:50-07:00
Authentication code: 8675308

Re: tif to png no longer works with IM6.8.9

Post by michelle »

Hello.

Since this problem had to do with transparency and contrary to .png files .jpeg files don't have transparency - - could I have avoided the problem completely by choosing to convert .tif to .jpg as apposed to .png?

Thanks again,
Michelle
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: tif to png no longer works with IM6.8.9

Post by snibgo »

Try it and see!

Yes, that works too. Not because of transparency, but because JPG can't store 1 bit/channel/pixel. The usual JPG format is 8 bits/channel/pixel, so it works the same as Fred's "PNG8:" suggestion.

As this is mostly flat colour, the best quality jpeg compression, which still mangles pixels, gives a larger filesize than lossless PNG.
snibgo's IM pages: im.snibgo.com
User avatar
michelle
Posts: 31
Joined: 2011-08-24T06:45:50-07:00
Authentication code: 8675308

Re: tif to png no longer works with IM6.8.9

Post by michelle »

snibgo wrote:Try it and see! Yes, that works too. Not because of transparency, but because JPG can't store 1 bit/channel/pixel. The usual JPG format is 8 bits/channel/pixel, so it works the same as Fred's "PNG8:" suggestion...
Great thanks Snibgo. I gave it a try just after posting but never had any previously problematic files to convert. Also, I'm having problems with the jpeg conversion. I'll play around for a bit longer and then start another thread if need be about the jpeg. Thanks again, enjoy the day
User avatar
michelle
Posts: 31
Joined: 2011-08-24T06:45:50-07:00
Authentication code: 8675308

Re: tif to png no longer works with IM6.8.9

Post by michelle »

Hi fmw42 and Snibgo, just a little note in the hope I may catch your attention as you helped me with my png problem previously - - - please if you get a minute could you take a look at my related post: Converting problematic pdf's to png

Thank-you once again for your help both now and in the past. Michelle
Post Reply