BUG converting to png with resize - Filesize

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
zaratol
Posts: 43
Joined: 2010-04-21T08:30:43-07:00
Authentication code: 8675308
Contact:

BUG converting to png with resize - Filesize

Post by zaratol »

Hi,

all converts are done in Windows:
Version: ImageMagick 6.6.9-4 2011-04-01 Q16

i did convert a rather simple tif file to a png File:
convert input.tif -resize 400x400 png32:output.png

http://home.arcor.de/durius.obsidian/input.tif is 1,8 MB, http://home.arcor.de/durius.obsidian/output.png is 700 kb, which is way to much after this kind of resize.
So i did first a resize to tif:

convert input.tif -resize 400x400 tifout.tif
http://home.arcor.de/durius.obsidian/tifout.tif 104 kb thats more like it. so what will happen when i convert this file to png

convert tifout.tif png32:firsttif.png
http://home.arcor.de/durius.obsidian/firsttif.png 60 kb, yeah

Of course i can do that in one commandline via pipe, but something is wrong here :-)
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA
Contact:

Re: BUG converting to png with resize - Filesize

Post by fmw42 »

try adding -strip to your command

convert input.tif -strip -resize 400x400 input1.png
identify input1.png
input1.png PNG 400x400 400x400+0+0 8-bit DirectClass 50.2KB 0.000u 0:00.010
zaratol
Posts: 43
Joined: 2010-04-21T08:30:43-07:00
Authentication code: 8675308
Contact:

Re: BUG converting to png with resize - Filesize

Post by zaratol »

I would like to preserve profile Information.

if i do it via tif first the final png ist still only 60kb WITH profile

or do i miss something?
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia
Contact:

Re: BUG converting to png with resize - Filesize

Post by anthony »

Do it at least once. It will let you see how much of that image size really is a 'constant sized' profile.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W
Contact:

Re: BUG converting to png with resize - Filesize

Post by glennrp »

Your output png contains a "tiff profile" that is 1.4MB, compressed to
a little under 700kb and stored in a zTXt chunk. If you don't want to
lose that profile, then that's probably the best we can do. Apparently
the profile got lost in the tif-to-tif conversion.

Run "identify -verbose" on your files to
see what's happening.

When you convert the second tif to png there are some
profiles, but the big "tiff" one is gone.
zaratol
Posts: 43
Joined: 2010-04-21T08:30:43-07:00
Authentication code: 8675308
Contact:

Re: BUG converting to png with resize - Filesize

Post by zaratol »

The Subimage in tag 37724?

I was wondering about that warning message, espacialy since i did create the most simple image.

Regarding the Information here: http://www.awaresystems.be/imaging/tiff ... edata.html this is some kind Image Source Data only used by Adobe photoshop

id did a quick search in the Forum after this tag, it seems ImageMagick does not know/care about this tag. I would guess it is only a recent addition of how Photoshop cs4/5 writes tif Images.
Normaly unknown Tags are discarded, this happens in the tif to tif conversion (i tried tif to jpg conversion, the tag is also discarded)

Since i do not know what is saved in this tag i would suggest that a png conversion discards unknown tif tags - standard ImageMagick behaviour.
I even tried convert input.tif -resize 400x400 +profile "8BIM" png32:output.png no change in filesize.

Should i open a sperated thread about the tag 37724? If i search after this tag here i find 3 Pages worth of Post, is there no better way to handle this Tag?
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W
Contact:

Re: BUG converting to png with resize - Filesize

Post by glennrp »

That would be the job of the TIFF decoder to discard the unknown data, not the PNG encoder's.
Yes, there is a small 8bim profile in there as well, but discarding that does not get rid of the
unknown profile.
zaratol
Posts: 43
Joined: 2010-04-21T08:30:43-07:00
Authentication code: 8675308
Contact:

Re: BUG converting to png with resize - Filesize

Post by zaratol »

@Glennrp: I agree this should be done in the TIFF decoder if teh data is not usable.
In thread: viewtopic.php?f=3&t=18557 magick states:
magick wrote:We could add an option to ignore a tag but it is not currently supported.
(problem with the same Tag) So i guess this not an option right now.

Perhaps i should clarify what i want to preserve:
  • XMP
    IPTC
    ICC/ICM Color Profiles
right now i run with this command line:

convert input.tif +profile "!XMP, !IPTC, !ICC, *" -resize 400x400 output.png

this seems to do the trick, still it would be better if such non usable data would be handled directly.
Post Reply

Who is online

Users browsing this forum: No registered users and 7 guests