What's bloating my png?
Background:
I am working on making a bunch of PNGs as small as possible. I'm playing with tools like PngOut, PngCrush, and OptiPng.
Problem:
I ran across a file that is 1434 KB in size but it's only 230 x 230 pixels. When I open the file in Paint.Net and save it as a new file, the new file is only 77 KB. That's a whopping 1.325 MB of extra junk in there!
Objectives:
I would like to understand what exactly could be bloating the file, and also how I can automatically get rid of such bloat when it is encountered, and am having trouble accomplishing either of these objectives. OptiPng is not removing the metadata.
Progress:
I found exiftool which seems all-around awesome, but it's not showing any crazy tags.
RIOT can produce a new version of the image without the extra data, but it doesn't give me any solid clues as to what the bloat is--it's definitely not XMP info or Comments (the only metadata I can choose to include). But RIOT automatically and forcibly removes IPTC info and EXIF profiles--could it be one of those?
Desired Feedback
Your thoughts on how to programatically or automatically losslessly crush and remove metadata from PNGs (and for that matter, other image types) are appreciated. However, I'd like to not just throw away information in a file without first understanding what it is.
Update
I found Steel Bytes Jpeg & PNG Stripper, and it does strip the metadata from the file (and has a command-line mode), yielding an 84 KB file which I can then PNG optimize, but this still doesn't help me understand what I'm removing, and I feel like I need to understand before proceeding. I don't need to get permission to optimize these images used in a production public-facing web site, but I do need to be confident of what I'm doing before making such a change.
Update 2
I didn't notice that OptiPng has an option, -strip all
, which strips metadata. This is better than the Steel Bytes Stripper by a long shot, as it has a lot more options for backup handling of the original file -- keep a backup, or output the optimized file to a new location. It also can optimize the image data of the PNG at the same time, requiring only one tool instead of two.
Addendum
Here's what exiftool -a -G [file.png]
shows:
[ExifTool] ExifTool Version Number : 9.60
[File] File Name : file.png
[File] Directory : .
[File] File Size : 1446 kB
[File] File Modification Date/Time : 2014:03:31 16:37:20-07:00
[File] File Access Date/Time : 2014:05:15 15:47:53-07:00
[File] File Creation Date/Time : 2014:05:15 15:47:53-07:00
[File] File Permissions : rw-rw-rw-
[File] File Type : PNG
[File] MIME Type : image/png
[PNG] Image Width : 230
[PNG] Image Height : 230
[PNG] Bit Depth : 8
[PNG] Color Type : RGB with Alpha
[PNG] Compression : Deflate/Inflate
[PNG] Filter : Adaptive
[PNG] Interlace : Noninterlaced
[PNG] Significant Bits : 8 8 8 8
[PNG] Pixels Per Unit X : 2834
[PNG] Pixels Per Unit Y : 2834
[PNG] Pixel Units : Meters
[PNG] Creation Time : 3/31/14
[PNG] Software : Adobe Fireworks CS6
[XMP] XMP Toolkit : Adobe XMP Core 5.3-c011 66.145661, 2012/02/06-14:56:27
[XMP] Creator Tool : Adobe Fireworks CS6 (Macintosh)
[XMP] Create Date : 2012:10:24 19:01:30Z
[XMP] Modify Date : 2014:03:31 23:34:45Z
[XMP] Format : image/png
[Composite] Image Size : 230x230
The raw pixel data of your 230x230 pixel image should not be that big, even when badly or not at all compressed. Therefore, all of this data must reside in a non-standard PNG data chunk.
Use pngcheck
to find out what chunks are in the file, and how big they are. Then use the W3C PNG Specifications to find out the use of particular chunks, and, if necessary, look elsewhere for "private data" chunks.
Unless you are dealing with a seriously non-standard chunk, all whose name indicate are not "required", are possible candidates for removal.
链接地址: http://www.djcxy.com/p/20436.html上一篇: 在3NF中找到关系,但在BCNF中找不到
下一篇: 什么膨胀我的PNG?