Page 1 of 1
BUG converting to png with resize - Filesize
Posted: 2011-04-19T11:39:14-07:00
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
Re: BUG converting to png with resize - Filesize
Posted: 2011-04-19T12:39:29-07:00
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
Re: BUG converting to png with resize - Filesize
Posted: 2011-04-19T12:50:30-07:00
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?
Re: BUG converting to png with resize - Filesize
Posted: 2011-04-19T17:35:26-07:00
by anthony
Do it at least once. It will let you see how much of that image size really is a 'constant sized' profile.
Re: BUG converting to png with resize - Filesize
Posted: 2011-04-19T18:28:57-07:00
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.
Re: BUG converting to png with resize - Filesize
Posted: 2011-04-20T00:35:55-07:00
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?
Re: BUG converting to png with resize - Filesize
Posted: 2011-04-20T04:51:34-07:00
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.
Re: BUG converting to png with resize - Filesize
Posted: 2011-04-23T17:57:06-07:00
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.