-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathpngcrush.c
9325 lines (8238 loc) · 334 KB
/
pngcrush.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/* pngcrush.c - recompresses png files
* Copyright (C) 1998-2002, 2006-2017 Glenn Randers-Pehrson
* (glennrp at users.sf.net)
* Portions Copyright (C) 2005 Greg Roelofs
*/
#define PNGCRUSH_VERSION "1.8.14"
#undef BLOCKY_DEINTERLACE
/* This software is released under a license derived from the libpng
* license (see LICENSE, below).
*
* The most recent version of pngcrush can be found at SourceForge in
* http://pmt.sf.net/pngcrush/
*
* This program reads in a PNG image, and writes it out again, with the
* optimum filter_method and zlib_level. It uses brute force (trying
* filter_method none, and libpng adaptive filtering, with compression
* levels 3 and 9).
*
* Optionally, it can remove unwanted chunks or add gAMA, sRGB, bKGD,
* tEXt/zTXt, and tRNS chunks. It will remove some chunks such as gAMA,
* cHRM, pHYs, and oFFs when their data fields contain all zero, which is a
* mistake.
*
* Uses libpng and zlib. This program was based upon libpng's pngtest.c.
*
* NOTICES:
*
* If you have modified this source, you may insert additional notices
* immediately after this sentence.
*
* COPYRIGHT:
*
* Copyright (C) 1998-2002, 2006-2017 Glenn Randers-Pehrson
* (glennrp at users.sf.net)
* Portions Copyright (C) 2005 Greg Roelofs
*
* LICENSE:
*
* Permission is hereby irrevocably granted to everyone to use, copy, modify,
* and distribute this source code, or portions hereof, or executable programs
* compiled from it, for any purpose, without payment of any fee, subject to
* the following restrictions:
*
* 1. The origin of this source code must not be misrepresented.
*
* 2. Altered versions must be plainly marked as such and must not be
* misrepresented as being the original source.
*
* 3. This Copyright notice, disclaimers, and license may not be removed
* or altered from any source or altered source distribution.
*
* DISCLAIMERS:
*
* The pngcrush computer program is supplied "AS IS". The Author disclaims all
* warranties, expressed or implied, including, without limitation, the
* warranties of merchantability and of fitness for any purpose. The
* Author assumes no liability for direct, indirect, incidental, special,
* exemplary, or consequential damages, which may result from the use of
* the computer program, even if advised of the possibility of such damage.
* There is no warranty against interference with your enjoyment of the
* computer program or against infringement. There is no warranty that my
* efforts or the computer program will fulfill any of your particular purposes
* or needs. This computer program is provided with all faults, and the entire
* risk of satisfactory quality, performance, accuracy, and effort is with
* the user.
*
* EXPORT CONTROL
*
* I am not a lawyer, but I believe that the Export Control Classification
* Number (ECCN) for pngcrush is EAR99, which means not subject to export
* controls or International Traffic in Arms Regulations (ITAR) because it
* and cexcept.c, libpng, and zlib, which may be bundled with pngcrush, are
* all open source, publicly available software, that do not contain any
* encryption software. See the EAR, paragraphs 734.3(b)(3) and 734.7(b).
*
* TRADEMARK:
*
* The name "pngcrush" has not been registered by the Copyright owner
* as a trademark in any jurisdiction. However, because pngcrush has
* been distributed and maintained world-wide, continually since 1998,
* the Copyright owner claims "common-law trademark protection" in any
* jurisdiction where common-law trademark is recognized.
*
* CEXCEPT COPYRIGHT, DISCLAIMER, and LICENSE:
*
* The cexcept.h header file which is bundled with this software
* is conveyed under the license and disclaimer described in lines 10
* through 18 of cexcept.h.
*
* LIBPNG COPYRIGHT, DISCLAIMER, and LICENSE:
*
* If libpng is bundled with this software, it is conveyed under the
* libpng license (see COPYRIGHT NOTICE, DISCLAIMER, and LICENSE, in png.h).
*
* If intel_init.c and filter_sse2_intrinsics.c are bundled with this
* software, they are conveyed under the libpng license (see the
* copyright notices within those files and the COPYRIGHT NOTICE, DISCLAIMER,
* and LICENSE in png.h).
*
* ZLIB COPYRIGHT, DISCLAIMER, and LICENSE:
*
* If zlib is bundled with this software, it is conveyed under the
* zlib license (see the copyright notice, disclaimer, and license
* appearing in zlib.h).
*
* ACKNOWLEDGMENTS:
*
* Thanks to Greg Roelofs for various bug fixes, suggestions, and
* occasionally creating Linux executables.
*
* Thanks to Stephan Levavej for some helpful suggestions about gcc compiler
* options and for a suggestion to increase the Z_MEM_LEVEL from default.
*
* Thanks to others who have made bug reports and suggestions mentioned
* in the change log.
*
* CAUTION:
*
* There is another version of pngcrush that has been distributed by
* Apple since mid-2008 as a part of the Xcode SDK. Although it claims
* to be pngcrush by Glenn Randers-Pehrson, it has additional options
* "-iPhone", "-speed", "-revert-iphone-optimizations", and perhaps others.
* It is an "altered version". I've seen output from a 2006 version that
* says on its help screen, "and modified by Apple as indicated in the
* sources".
*
* It writes files that have the PNG 8-byte signature but are not valid PNG
* files (instead they are "IOS-optimized PNG files"), due to at least
*
* 1. the presence of the CgBI chunk ahead of the IHDR chunk;
* 2. nonstandard deflate compression in IDAT, iCCP, and perhaps zTXt chunks
* (I believe this only amounts to the omission of the zlib header from
* the IDAT and perhaps other compressed chunks);
* 3. Omission of the CRC bytes from the IDAT chunk and perhaps other chunks;
* 4. the use of premultiplied alpha in color_type 6 files; and
* 5. the sample order, which is ARGB instead of RGBA in color_type 6 files.
*
* See http://iphonedevwiki.net/index.php/CgBI_file_format for more info.
*
* Although there is no loss in converting a CgBI PNG back to a regular
* PNG file, the original PNG file cannot be losslessly recovered from such
* files because of the losses that occurred during the conversion to
* premultiplied alpha.
*
* Most PNG decoders will recognize the fact that an unknown critical
* chunk "CgBI" is present and will immediately reject the file.
*
* It is said that the Xcode version of pngcrush is automatically applied
* when PNG files are prepared for downloading to the iPhone unless the
* user takes special measures to prevent it.
*
* It is said that the Xcode pngcrush does have a command to undo the
* premultiplied alpha. It's not theoretically possible, however, to recover
* the original file without loss. The underlying color data will either be
* reduced in precision, or, in the case of fully-transparent pixels,
* completely lost.
*
* I have not seen the source for the Xcode version of pngcrush. All I
* know, for now, is from running "strings -a" on an old copy of the
* executable, looking at two Xcode-PNG files, and reading Apple's patent
* application <http://www.freepatentsonline.com/y2008/0177769.html>. Anyone
* who does have access to the revised pngcrush code cannot show it to me
* anyhow because of their Non-Disclosure Agreement with Apple.
*/
/* To do (TODO, TO DO):
*
* (As noted below, some of the features that aren't yet implemented
* in pngcrush are already available in ImageMagick; you can try a
* workflow that makes a first pass over the image with ImageMagick
* to select the bit depth, color type, interlacing, etc., and then makes
* another pass with pngcrush to optimize the compression, and finally
* makes a pass with libpng's "pngfix" app to optimize the zlib CMF
* bytes.)
*
* 0. Make pngcrush optionally operate as a filter, writing the crushed PNG
* to standard output, if an output file is not given, and reading
* the source file from standard input if no input file is given.
*
* 1. Reset CINFO to reflect decoder's required window size (instead of
* libz-1.1.3 encoder's required window size, which is 262 bytes larger).
* See discussion about zlib in png-list archives for April 2001.
* libpng-1.2.9 does some of this and libpng-1.5.4 does better.
* But neither has access to the entire datastream, so pngcrush could
* do even better.
*
* This has no effect on the "crushed" filesize. The reason for setting
* CINFO properly is to provide the *decoder* with information that will
* allow it to request only the minimum amount of memory required to decode
* the image (note that libpng-based decoders don't make use of this
* hint, because of the large number of files found in the wild that have
* incorrect CMF bytes).
*
* In the meantime, one can just run
*
* pc input.png crushed.png
*
* where the "pc" script is the following:
*
* #!/bin/sh
* cp $1 temp-$$.png
* for w in 512 1 2 4 8 16 32
* do
* pngcrush -ow -w $w -brute temp-$$.png
* done
* mv temp-$$.png $2
*
* It turns out that sometimes this finds a smaller compressed PNG
* than plain "pngcrush -brute input.png crushed.png" finds.
*
* There are several ways that pngcrush could implement this.
*
* a. Revise the bundled zlib to report the maximum window size that
* it actually used, then rewrite CINFO to contain the next power-of-two
* size equal or larger than the size. This method would of course
* only work when pngcrush is built with the bundled zlib, and won't
* work with zopfli compression.
*
* b. Do additional trials after the best filter method, strategy,
* and compression level have been determined, using those settings
* and reducing the window size until the measured filesize increases,
* then choosing the smallest size which did not cause the filesize
* to increase. This is expensive.
*
* c. After the trials are complete, replace CINFO with smaller
* settings, then attempt to decode the zlib datastream, and choose
* the smallest setting whose datastream can still be decoded
* successfully. This is likely to be the simplest and fastest
* solution; however, it will only work with a version of libpng
* in which the decoder actually uses the CINFO hint.
* This seems to be the only method that would work with zopfli
* compression which always writes "7" (i.e., a 32k window) in CINFO.
*
* d. The simplest is to use pngfix, which comes with libpng16 and
* later, as a final step:
*
* pngcrush input.png temp.png
* pngfix --optimize --out=output.png temp.png
* # To do: find out if this works with zopfli output
*
* 2. Check for the possiblity of using the tRNS chunk instead of
* the full alpha channel. If all of the transparent pixels are
* fully transparent, and they all have the same underlying color,
* and no opaque pixel has that same color, then write a tRNS
* chunk and reduce the color-type to 0 or 2. This is a lossless
* operation. ImageMagick already does this, as of version 6.7.0.
* If the lossy "-blacken" option is present, do that operation first.
*
* 3. Add choice of interlaced or non-interlaced output. Currently you
* can change interlaced to non-interlaced and vice versa by using
* ImageMagick before running pngcrush. Note, when implementing this,
* disallow changing interlacing if APNG chunks are being copied.
*
* 4. Use a better compression algorithm for "deflating" (result must
* still be readable with zlib!) e.g., http://en.wikipedia.org/wiki/7-Zip
* says that the 7-zip deflate compressor achieves better compression
* (smaller files) than zlib. If tests show that this would be worth
* while, incorporate the 7-zip compressor as an optional alternative
* or additional method of pngcrush compression. See the GPL-licensed code
* at http://en.wikipedia.org/wiki/AdvanceCOMP and note that if this
* is incorporated in pngcrush, then pngcrush would have to be re-licensed,
* or released in two versions, one libpng-licensed and one GPL-licensed!
*
* Also consider Google's "zopfli" compressor, which is said to slow but
* achieves better compression. It is Apache-2.0 licensed and available from
* a GIT repository at SourceForge (see https://code.google.com/p/zopfli/).
* See also the "pngzop" directory under the pmt.sourceforge.net project.
* Note paragraph 1.c above; zopfli always writes "7" in CINFO. See
* my "pmt/pngzop" project at SourceForge and GitHub.
*
* 5. Optionally recognize any sRGB iCCP profile and replace it with the
* sRGB chunk. Turn this option on if the "-reduce" option is on. Also,
* if "-reduce" is on, delete any gAMA and cHRM chunks if the sRGB chunk
* is being written.
*
* 6. Accept "--long-option". For starters, just accept -long_option
* and --long_option equally.
*
* 7. Implement a "copy_idat" option that simply copies the IDAT data,
* implemented as "-m 176". This will still repackage the IDAT chunks
* in a possibly different IDAT chunk size.
*
* 8. Implement palette-building (from ImageMagick-6.7.0 or later, minus
* the "PNG8" part) -- actually ImageMagick puts the transparent colors
* first, then the semitransparent colors, and finally the opaque colors,
* and does not sort colors by frequency of use but just adds them
* to the palette/colormap as it encounters them, so it might be improved.
* Also it might be made faster by using a hash table as was partially
* implemented in pngcrush-1.6.x. If the latter is done, also port that
* back to ImageMagick/GraphicsMagick. See also ppmhist from the NetPBM
* package which counts RGB pixels in an image; this and its supporting
* lib/libppmcmap.c would need to be revised to count RGBA pixels instead.
*
* 9. Improve the -help output and/or write a good man page.
*
* 10. Finish pplt (MNG partial palette) feature.
*
* 11. Remove text-handling and color-handling features and put
* those in a separate program or programs, to avoid unnecessary
* recompressing. Note that in pngcrush-1.7.34, pngcrush began doing
* this extra work only once instead of for every trial, so the potential
* benefit in CPU savings is much smaller now.
*
* 12. Add a "pcRu" ancillary chunk that keeps track of the best method,
* methods already tried, and whether "loco crushing" was effective.
*
* 13. Try both transformed and untransformed colors when "-loco" is used.
*
* 14. Move the Photoshop-fixing stuff into a separate program.
*
* 15. GRR: More generally (superset of previous 3 items): split into
* separate "edit" and "crush" programs (or functions). Former is fully
* libpng-aware, much like current pngcrush; latter makes little or no use of
* libpng (maybe IDAT-compression parts only?), instead handling virtually
* all chunks as opaque binary blocks that are copied to output file _once_,
* with IDATs alone replaced (either by best in-memory result or by original
* _data_ resplit into bigger IDATs, if pngcrush cannot match/beat). "edit"
* version should be similar to current code but more efficient: make
* _one_ pass through args list, creating table of PNG_UINTs for removal;
* then make initial pass through PNG image, creating (in-order) table of
* all chunks (and byte offsets?) and marking each as "keep" or "remove"
* according to args table. Could start with static table of 16 or 32 slots,
* then double size & copy if run out of room: still O(n) algorithm.
*
* 16. With libpng17, png_write throws an "affirm()" with tc.format=256
* when attempting to write a sub-8-bit grayscale image.
*
* 17. Figure out why we aren't calling png_read_update_info() and fix.
*
* 18. Fix ADLER32 checksum handling in conjunction with iCCP chunk
* reading.
*
* 19. Fix Coverity "TOCTOU" warning about our "stat()" usage.
*
* 20. Warn about removing copyright and license info appearing in
* PNG text chunks.
*
* 21. Implement the "eXIf" chunk if it is approved by the PNG
* Development Group. Optionally, remove preview and thumbnail
* images from the Exif profile contained in the eXIf chunk.
*
*/
#if 0 /* changelog */
Change log:
Version 1.8.14 (built with libpng-1.6.34 and zlib-1.2.11)
Recognize the "-bail" option properly (bug fix by Hadrien Lacour).
Fix documentation about "-force/-noforce" to represent the default
behavior since 1.8.1 (bug report by Hadrien Lacour).
Version 1.8.13 (built with libpng-1.6.32 and zlib-1.2.11)
Add "exit(0)" after processing "-version" argument, to avoid
displaying the Usage information (bug report by Peter Hagan,
Issue #76).
Fix problem with MacOS prior to Sierra; it uses CLOCK_MONOTONIC
for some other purpose (bug report and help developing patch by
Github user "ilovezfs", Homebrew/homebrew-core PR#16391).
Version 1.8.12 (built with libpng-1.6.31 and zlib-1.2.11)
Added POWERPC-VSX support.
Report whether using optimizations.
Added filter_method 6 (same as filter 5 with -speed).
Added "methods" 149-176 (that use filter_method 6).
Changed default verbosity from 1 (normal) to 0 (quiet). Use "-v" to get
the previous default behavior and "-v -v" to get the previous "verbose"
behavior. The "-s" (silent) and "-q" (quiet) options behave as before.
Version 1.8.11 (built with libpng-1.6.28 and zlib-1.2.11)
Use png_set_option(PNG_IGNORE_ADLER32) to control ADLER32 handling.
Changed LD=gcc to LD=$(CC) in Makefile and Makefile-nolib (suggested
by Helmut G in Bug#850927 of some GIT project)
Version 1.8.10 (built with libpng-1.6.26 and zlib-1.2.8.1)
Changed ADLER32 checksum handling to only use inflateValidate()
during IDAT chunk handling; it broke iCCP chunk handling.
Version 1.8.9 (built with libpng-1.6.26 and zlib-1.2.8.1)
Added "-warn" option, to show only warnings.
Enabled method 149. For now it writes uncompressed IDAT but in
a future version of pngcrush it will just copy the IDAT data.
Version 1.8.8 (built with libpng-1.6.26beta06 and zlib-1.2.8.1)
Fixed "nolib" build (bug report by Hanspeter Niederstrasser).
Make sure we use system-png.h, and not the local file. It is now
possible to build either the regular pngcrush or the "nolib"
pngcrush in the complete pngcrush source directory (use
"make clean" before rebuilding!)
Fixed timing when using "clock()". Sometimes an additional second
was added when the timer crossed a one-second boundary, since
version 1.8.5.
Upgrade libpng to version 1.6.26beta06 and zlib to 1.2.8.1.
Use zlib-1.2.8.1 new "inflateValidate()" function to avoid checking
ADLER32 checksums. Version 1.8.7 did not work when the "-fix"
option was used.
Version 1.8.7 (built with libpng-1.6.25 and zlib-1.2.8)
Do not check the ADLER32 CRC while reading except during the final write
pass (requires libpng-1.6.26 or later and zlib-1.2.4 or later).
This saves some CPU time, around five to ten percent, in decoding.
Do not calculate the ADLER32 CRC while writing except during the final
write pass (writing raw deflate streams instead of zlib streams to
the IDAT chunks; these are invalid PNGs but since all we do is count
the bytes that does not matter). This saves some CPU time in encoding
but it is barely perceptible. Requires zlib 1.2.4 or later and modified
pngwutil.c.
Version 1.8.6 (built with libpng-1.6.25 and zlib-1.2.8)
Enabled ARM_NEON support.
Fixed error in handling of timer wraparound when interval exceeds one
second.
Disable high resolution timers by default in Makefile. To enable them,
you must enable/disable relevant CPPFLAGS and LIBS in Makefile.
Version 1.8.5 (built with libpng-1.6.24 and zlib-1.2.8)
Added "-benchmark n" option. It runs the main loop "n" times, and
records the minimum value for each timer.
After checking for CLOCK_ID, use clock() if none is found.
Avoid some timing when verbose<0 ("-s" or "--silent")
Added PNGCRUSH_CHECK_CRC (off by default) to use libpng default
CRC checking. Otherwise, CRC are only computed and checked during
the first read pass and while writing.
Accept "--option" (for now, by simply skipping the first "-").
Version 1.8.4 (built with libpng-1.6.24 and zlib-1.2.8)
Fixed handling of CLOCK_ID, removed some "//"-delimited comments.
Revised intel_init.c to always optimize 4bpp images, because the
poor optimization noted previously has been fixed.
Version 1.8.3 (built with libpng-1.6.24 and zlib-1.2.8)
Fixed bug introduced in 1.8.2 that causes trial 10 to be skipped when
using the default heuristic method.
Fixed incorrect typecast in call to png_create_write_struct_2() (Bug
report by Richard K. Lloyd).
Added intel_init.c, filter_sse2_intrinsics.c, and Makefile-sse,
to enable INTEL SSE optimization. Revised intel_init.c to optionally
only optimize 4bpp images, because the optimization appears to slow
down reading of 3bpp images.
Added PNGCRUSH_TIMERS (nanosecond resolution using clock_gettime), to
measure defiltering time in png_read_filter_row(). For now, this only
works with a modified libpng, on platforms that provide "clock_gettime()".
To enable all timers, define PNGCRUSH_TIMERS=11.
Revised "-q" to show a short summary of results (final size and timing)
To do: Add ZLIB_AMALGAMATED configuration; currently produces different output
https://blog.forrestthewoods.com/
improving-open-source-with-amalgamation-cf293592c5f4#.g9fb2tyhs
(added #ifndef NO_GZ / #endif to skip the gz* code in zlib_amalg.[ch]).
Added LIBPNG_UNIFIED configuration.
Version 1.8.2 (built with libpng-1.6.23 and zlib-1.2.8)
Fixed filesize reduction report when "-ow" option is used (Bug report #68).
When a single method is specified, turn -reduce off by default and skip
trial 0.
Version 1.8.1 (built with libpng-1.6.21 and zlib-1.2.8)
Added the LICENSE file to the tar and zip distributions.
Made "-force" force output even when the IDAT is larger, and added
"-noforce" option; "-noforce" is now the default behavior (Bug
report #68 at SourceForge by "wintakeall")
Use right filename in filesize reduction report (overwrite?inname:outname)
(bug report #69 by "wintakeall").
Removed some superfluous spaces from the Copyright statement.
Added "-speed" option; it avoids using the AVG or PAETH filters which
are slower to decode.
Version 1.8.0 (built with libpng-1.6.21 and zlib-1.2.8)
Made "-reduce" and "-force" the default behavior. Removed obsolete
options "-plte_len", "-cc", "-nocc", "-double_gamma", "-already_crushed",
and "-bit_depth". Removed "things_have_changed" code.
Version 1.7.92 (built with libpng-1.6.20 and zlib-1.2.8)
Deleted png_read_update_info() statement that was mistakenly added to
version 1.7.89. It caused "bad adaptive filter value" errors.
Version 1.7.91 (built with libpng-1.6.20 and zlib-1.2.8)
Suppress warning about "damaged LZ stream" when bailing out and building
with libpng-1.7.0beta.
Added a LICENSE file to the distribution. It points to the actual
license appearing in the NOTICES section near the top of pngcrush.c
Show if pngcrush is built with bundled or system libpng and zlib.
Fixed segfault while writing a -loco MNG (bug found with AFL, reported
by Brian Carpenter). Bug was introduced in pngcrush-1.7.35.
Version 1.7.88 (built with libpng-1.6.19 and zlib-1.2.8)
Eliminated a potential overflow while adding iTXt chunk (over-length
text_lang or text_lang_key), reported by Coverity.
Version 1.7.87 (built with libpng-1.6.18 and zlib-1.2.8)
Fixed a double-free bug (CVE-2015-7700). There was a "free" of the
sPLT chunk structure in pngcrush and then again in png.c (Bug report
by Brian Carpenter).
Added common-law trademark notice and export control information.
Rearranged some paragraphs in the comments at the beginning of pngcrush.c
Increased some buffer sizes in an attempt to prevent possible overflows.
Version 1.7.86 (built with libpng-1.6.18 and zlib-1.2.8)
Increased maximum size of a text chunk input from 260 to 2048
(STR_BUF_SIZE) bytes, to agree with the help screen (bug report by
Tamas Jursonovics).
Fixed bug that caused text chunks after IDAT to be written only when
the "-save" option is used.
Version 1.7.85 (built with libpng-1.6.16 and zlib-1.2.8)
Improved reporting of invalid chunk names. Does not try to put
non-printable characters in STDERR; displays hex numbers instead.
Fixed include path for utime.h on MSVC (Louis McLaughlin).
Eliminated "FAR" memory support (it was removed from libpng at version
1.6.0).
Disabled the "-already_crushed" option which does not really work well.
Version 1.7.84 (built with libpng-1.6.16 and zlib-1.2.8)
Cleaned up more Coverity-scan warnings. Fixing those also fixed
CVE-2015-2158.
Version 1.7.83 (built with libpng-1.6.16 and zlib-1.2.8)
Cleaned up some Coverity-scan warnings. Unfortunately one of these
changes introduced the vulnerability reported in CVE-2015-2158.
Version 1.7.82 (built with libpng-1.6.16 and zlib-1.2.8)
Version 1.7.81 (built with libpng-1.6.15 and zlib-1.2.8)
Fixed off-by-one error in calculation of plte_len. Bug reports by
Ivan Kuchin and Frederic Kayser.
Version 1.7.80 (built with libpng-1.6.14 and zlib-1.2.8)
Added "-reduce_palette" and "-noreduce_palette" options. Enable
reduce_palette when the "-new" or "-reduce" option is used.
Version 1.7.79 (built with libpng-1.6.14 and zlib-1.2.8)
Fixed bug in -plte_len N option.
Version 1.7.78 (built with libpng-1.6.14 and zlib-1.2.8)
Made "-s" and "-silent" options suppress libpng warnings.
Version 1.7.77 (built with libpng-1.6.13 and zlib-1.2.8)
Updated libpng to version 1.6.13.
Version 1.7.76 (built with libpng-1.6.12 and zlib-1.2.8)
Updated libpng to version 1.6.12.
Version 1.7.75 (built with libpng-1.6.10 and zlib-1.2.8)
Reverted libpng to version 1.6.10 due to a misplaced statement in png.c
Version 1.7.74 (built with libpng-1.6.11 and zlib-1.2.8)
Fixed "-zmem" option (only "-zm" would work since version 1.7.62).
Version 1.7.73 (built with libpng-1.6.10 and zlib-1.2.8)
Restored calls to png_set_crc_action() which had been removed from
version 1.7.72 for some testing and inadvertently not restored.
Changed "fix" internal variable name to "salvage" (still set with "-fix")
Added code to fix/salvage PNG with "bad adaptive filter value" error.
Avoid calculating CRC during compression trials except for the last trial,
when the output is actually written.
Fixed a bug with reducing 16-bit images to 8-bit using "-reduce" option.
Version 1.7.72 (built with libpng-1.6.10 and zlib-1.2.8)
Version 1.7.71 (built with libpng-1.6.9 and zlib-1.2.8)
Built the Windows binaries using -DTOO_FAR=32767; neglected to do this
in versions 1.7.42 through 1.7.70, which caused the Windows binaries
to produce different (usually a few bytes larger) results than Linux.
Thanks to F. Kayser for reporting the discrepancy.
Version 1.7.70 (built with libpng-1.6.8 and zlib-1.2.8)
Version 1.7.69 (built with libpng-1.6.6 and zlib-1.2.8)
Updated libpng to version 1.6.6.
Version 1.7.68 (built with libpng-1.6.4 and zlib-1.2.8)
Check for NULL return from malloc().
Undefine CLOCKS_PER_SECOND "1000" found in some version of MinGW.
Replaced most "atoi(argv[++i])" with "pngcrush_get_long" which does
"BUMP_I; strtol(argv[i],ptr,10)" and added pngcrush_check_long macro
to detect malformed or missing parameters (debian bug 716149).
Added global_things_have_changed=1 when reading -bkgd.
The "-bit_depth N" option did not work reliably and has been removed.
Version 1.7.67 (built with libpng-1.5.17 and zlib-1.2.8)
Fixed handling of "-text" and "-ztext" options for text input. They had been
reduced to "-t" and "-z" with an incorrect argument (3 instead of 2) in
version 1.7.62. Bug report and patch from Tsukasa Oi.
Version 1.7.66 (built with libpng-1.5.17 and zlib-1.2.8)
Revised pngcrush_examine_pixels_fn() to fix some incorrect reductions.
Version 1.7.65 (built with libpng-1.5.17 and zlib-1.2.8)
Do not allow any colortype or depth reductions if acTL is present.
Added warnings to explain why any requested reductions were not allowed.
Version 1.7.64 (built with libpng-1.5.17 and zlib-1.2.8)
Version 1.7.63 (built with libpng-1.5.16 and zlib-1.2.8)
Add "int dowildcard=-1;" in an attempt to get wildcard arguments working
in the cross-compiled MinGW executables.
Version 1.7.62 (built with libpng-1.5.16 and zlib-1.2.8)
Remove old filename before renaming, when using the "-ow" option on
any Windows platform, not just CYGWIN (see log entry for pngcrush-1.7.43).
Reverted error with handling single-character options like "-v", introduced
in 1.7.61.
Version 1.7.61 (built with libpng-1.5.16 and zlib-1.2.8)
Check sBIT chunk data to see if reduction to gray or to 8-bit is permitted,
i.e., the RGB sBIT values are equal to each other or the sBIT values are
not greater than 8, respectively.
Do not try to make_opaque if the tRNS chunk is found.
Added warning when ignoring an invalid commandline option.
Improved brute_force handling with specified level, filter, or strategy.
Version 1.7.60 (built with libpng-1.5.16 and zlib-1.2.8)
Revise -reduce so reducing from color-type 6 to grayscale works.
Issue a warning if reducing bit depth or color type would violate various
chunk dependencies, and do not perform the action:
Do not reduce to grayscale if a color bKGD chunk, sBIT or iCCP chunk
is present.
Do not reduce bit depth if bKGD or sBIT chunk is present.
Do not reduce palette length if the hIST chunk is present.
Set "found_iCCP" flag to zero to avoid re-reading a bad iCCP chunk.
Version 1.7.59 (built with libpng-1.5.16 and zlib-1.2.8)
Show the acTL chunk in the chunk list in verbose output.
Fixed several bugs reported by pornel at users.sf.net:
Do not call png_set_benign_errors when PNG_BENIGN_ERRORS_SUPPORTED
is not defined
Renamed PNG_UNUSED() macro PNGCRUSH_UNUSED().
Moved a closing bracket inside the PNGCRUSH_LOCO block.
Moved the declaration of "new_mng" outside a PNGCRUSH_LOCO block.
Put reference to "input_format" inside a PNGCRUSH_LOCO block.
Moved declarations of mng_out and mngname inside a PNGCRUSH_LOCO block.
Version 1.7.58 (built with libpng-1.5.15 and zlib-1.2.7-1)
Do not enable reduce_palette by default for "-reduce", "-new", or "-old".
It still is failing for some files.
Version 1.7.57 (built with libpng-1.5.15 and zlib-1.2.7-1)
Added "-new" option that turns on "-reduce" which will be
the default setting for version 1.8.0 and beyond.
Added "-old" option that turns off "-reduce" which is the
current default setting.
Updated copyright year for zlib-1.2.7-1.
Reverted to libpng-1.5.15 to be able to read old PNG files with TOO FAR
errors. This will of course only work with the embedded libpng.
Version 1.7.56 (built with libpng-1.6.1 and zlib-1.2.7-1)
Only use pngcrush_debug_malloc() and pngcrush_debug_free() if the result
is going to be shown.
Added PNG_PASS_ROWS, PNG_UNUSED, and other macro definitions, when building
with libpng-1.4.x and older libpng versions.
Multiplied rowbytes by 8/bit_depth when using the system library because
we do not call png_read_transform_info(). This prevents a crash when
reading sub-8-bit input files.
Version 1.7.55 (built with libpng-1.6.1 and zlib-1.2.7-1)
Version 1.7.54 (built with libpng-1.6.1rc01 and zlib-1.2.7-1)
Version 1.7.53 (built with libpng-1.6.1rc01 and zlib-1.2.7)
Removed plte_len stuff from the "To do" list because it is done.
Shorten the indexed-PNG tRNS chunk length if it has more entries than the PLTE chunk.
Version 1.7.52 (built with libpng-1.6.1beta06 and zlib-1.2.7)
Added license info for cexcept.h, libpng, and zlib.
Added consideration of "zopfli" compression to the "To do" list.
Fixed a typo that caused a cHRM chunk to be "found" if an iCCP chunk
were present.
Reset best_byte_count before trial loop.
Revise global png_set_keep_unknown_chunks() calls to avoid a libpng16
warning.
Reset "intent" to "specified_intent" before trial loop.
Reset "plte_len" to "specified_plte_len" before trial loop.
Initialize length of each trial to 0x7fffffff so any untried method
is not the "best method".
Version 1.7.51 (built with libpng-1.6.0 and zlib-1.2.7)
Added "-noreduce" option, in preparation for "-reduce" becoming the
default behaviour in version 1.8.0. This turns off lossless bit depth,
color type, palette reduction, and opaque alpha channel removal.
Zero out the high byte of transparent color for color-type 0 and 2,
when reducing from 16 bits to 8.
Undefined a bunch of stuff in pngcrush.h that we do not use, saves about
100 kbytes of executable file size in addition to about 50k saved by
undefining the simplified API.
Fixed double-underscore typo in an #ifdef in png.c
If "-reduce" is on and the background index is larger than the reduced
palette_length+1, reduce it to the palette_length+1.
Increased required_window_size if necessary to account for slightly larger
size of interlaced files due to additional filter bytes and padding.
Version 1.7.50 (built with libpng-1.6.0 and zlib-1.2.7)
Removed completed items from the "To do" list.
Ignore the argument of the "plte_len" argument and just set the
"reduce_palette" flag.
Version 1.7.49 (built with libpng-1.5.14 and zlib-1.2.7)
Use png_set_benign_errors() to allow certain errors in the input file
to be handled as warnings.
Skip PNG_ABORT redefinition when using libpng-1.4.0 and later.
Implemented "-reduce" option to identify and reduce all-gray images,
all-opaque images, unused PLTE entries, and 16-bit images that can be
reduced losslessly to 8-bit.
Version 1.7.48 (built with libpng-1.5.14 and zlib-1.2.7)
Reserved method==0 for examining the pixels during trial 0, if necessary.
Changed blacken_fn() to separate pngcrush_examine_pixels_fn() and
pngcrush_transform_pixels_fn() callback functions. The "examine"
function is only done during trial 0; it sets a flag whether
any fully transparent pixels were found, and pngcrush only runs
pngcrush_transform_pixels_fn() if necessary.
This is in preparation for future versions, which will examine other
conditions such as if the image is opaque or gray or can be losslessly
reduced in bit depth, set flags in trial 0 and accomplish the
transformations in the remaining trials (see the To do list starting
about line 200 in the pngcrush.c source).
Removed "PNGCRUSH_COUNT_COLORS" blocks again.
Version 1.7.47 (built with libpng-1.5.13 and zlib-1.2.7)
Do not do the heuristic trials of the first 10 methods when -brute is
specified, because it did not save time as I hoped.
Fixed a mistake in 1.7.45 and 1.7.46 that caused the output file to
not be written.
Version 1.7.46 (built with libpng-1.5.13 and zlib-1.2.7)
Moved the new level 0 methods to the end of the trial list (methods 137-148)
Version 1.7.45 (built with libpng-1.5.13 and zlib-1.2.7)
Added method 0 (uncompressed). "-m 0" now simply turns on method 0.
Added "-try10" option that has the same effect that "-m 0" previously did,
namely to try only the first ten methods.
Inserted new methods 17 through 21 with zlib level 0.
Do the heuristic trials of the first 10 methods when -brute is specified,
to get quickly to a small solution, so we can bail out of most of the
remaining trials early. Previously these 10 methods were skipped during
a -brute run.
Removed the "-reduce" line from the help screen when PNGCRUSH_COUNT_COLORS
is disabled.
Version 1.7.44 (built with libpng-1.5.14 and zlib-1.2.7)
Version 1.7.43 (built with libpng-1.5.13 and zlib-1.2.7)
Added "remove(inname)" before "rename(outname, inname)" when using the "-ow"
option on CYGWIN/MinGW because "rename()" does not work if the target file
exists.
Use the bundled "zlib.h" when PNGCRUSH_H is defined, otherwise use the
system <zlib.h>.
Version 1.7.42 (built with libpng-1.5.13 and zlib-1.2.7)
Use malloc() and free() instead of png_malloc_default() and
png_free_default(). This will be required to run with libpng-1.7.x.
Revised the PNG_ABORT definition in pngcrush.h to work with libpng-1.7.x.
Revised zutil.h to avoid redefining ptrdiff_t on MinGW/CYGWIN platforms.
Version 1.7.41 (built with libpng-1.5.13 and zlib-1.2.7)
Reverted to version 1.7.38. Versions 1.7.39 and 1.7.40 failed to
open an output file.
Version 1.7.40 (built with libpng-1.5.13 and zlib-1.2.7)
Revised the "To do" list.
Version 1.7.39 (built with libpng-1.5.13 and zlib-1.2.7)
Removed "PNGCRUSH_COUNT_COLORS" blocks which I no longer intend to
implement because that feature is already available in ImageMagick. Kept
"reduce_to_gray" and "it_is_opaque" flags which I do hope to implement
soon.
Changed NULL to pngcrush_default_read_data in png_set_read_fn() calls, to fix
an insignificant error introduced in pngcrush-1.7.14, that caused most
reads to not go through the alternate read function. Also always set this
function, instead of depending on STDIO_SUPPORTED.
Version 1.7.38 (built with libpng-1.5.13 and zlib-1.2.7)
Bail out of a trial if byte count exceeds best byte count so far. This
avoids wasting CPU time on trial compressions of trials that exceed the
best compression found so far.
Added -bail and -nobail options. Use -nobail to get a complete report
of filesizes; otherwise the report just says ">N" for any trial
that exceeds size N where N is the best size achieved so far.
Added -blacken option, to enable changing the color samples of any
fully-transparent pixels to zero in PNG files with color-type 4 or 6,
potentially improving their compressibility. Note that this is an
irreversible lossy change: the underlying colors of all fully transparent
pixels are lost, if they were not already black.
Version 1.7.37 (built with libpng-1.5.12 and zlib-1.2.7)
Reverted pngcrush.c back to 1.7.35 and fixed the bug with PLTE handling.
Version 1.7.36 (built with libpng-1.5.12 and zlib-1.2.7)
Reverted pngcrush.c to version 1.7.34 because pngcrush is failing with
some paletted PNGs.
Separated CFLAGS and CPPFLAGS in the makefile (with "-I" and "-DZ_SOLO"
in CPPFLAGS)
Version 1.7.35 (built with libpng-1.5.12 and zlib-1.2.7)
Removed FOPEN of fpout except for the last trial. The open files caused
"pngcrush -brute -e _ext.png *.png" to fail on the 10th file (about the
1024th compression trial) due to being unable to open the output file.
Version 1.7.34 (built with libpng-1.5.12 and zlib-1.2.7)
Compute and report sum of critical chunk lengths IHDR, PLTE, IDAT, and IEND,
plus the 8-byte PNG signature instead of just the total IDAT data length.
Simplify finding the lengths from the trial compressions, by replacing
the write function with one that simply counts the bytes that would have
been written to a trial PNG, instead of actually writing a PNG, reading it
back, and counting the IDAT bytes.
Removed comments about the system library having to be libpng14 or earlier.
This restriction was fixed in version 1.7.20.
Version 1.7.33 (built with libpng-1.5.12 and zlib-1.2.7)
Ignore all ancillary chunks except during the final trial. This can be
significantly faster when large ancillary chunks such as iCCP and zTXt
are present.
Version 1.7.32 (built with libpng-1.5.12 and zlib-1.2.7)
Fixed bug introduced in 1.7.30: Do not call png_set_check_for_invalid_index()
when nosave != 0 (otherwise pngcrush crashes with the "-n" option).
Version 1.7.31 (built with libpng-1.5.11 and zlib-1.2.7)
Dropped *.tar.bz2 from distribution.
Added a comma that was missing from one of the "usage" strings (error
introduced in version 1.7.29).
Version 1.7.30 (built with libpng-1.5.11 and zlib-1.2.7)
Only run the new (in libpng-1.5.10) test of palette indexes during the
first trial.
Version 1.7.29 (built with libpng-1.5.10 and zlib-1.2.7)
Set "things_have_changed" flag when adding text chunks, so the "-force"
option is no longer necessary when adding text to an already-compressed
file.
Direct usage message and error messages to stderr instead of stdout. If
anyone is still using DOS they may have to change the "if 0" at line
990 to "if 1". If you need to have the messages on standard output
as in the past, use 2>&1 to redirect them.
Added "pngcrush -n -v files.png" to the usage message.
Version 1.7.28 (built with libpng-1.5.10 and zlib-1.2.7)
Write proper copyright year for zlib, depending upon ZLIB_VERNUM
Version 1.7.27 (built with libpng-1.5.10 and zlib-1.2.6)
Increased row_buf malloc to row_bytes+64 instead of row_bytes+16, to
match the size of big_row_buf in pngrutil.c (it is 48 in libpng14, 15, 16,
and 64 in libpng10, 12. Otherwise there is a double-free crash when the
row_buf is destroyed.
Version 1.7.26 (built with libpng-1.5.10 and zlib-1.2.6)
Increased the text_text buffer from 2048 to 10*2048 (Ralph Giles), and
changed an incorrect test for keyword length "< 180" to "< 80". The
text_text buffer was inadvertently reduced from 20480 to 2048 in
pngcrush-1.7.9.
Added -DZ_SOLO to CFLAGS, needed to compile zlib-1.2.6.
Changed user limits to width and height max 500000, malloc max 2MB,
cache max 500.
Added -nolimits option which sets the user limits to the default
unlimited values.
Version 1.7.25 (built with libpng-1.5.9 and zlib-1.2.5)
Version 1.7.24 (built with libpng-1.5.7 and zlib-1.2.5)
Do not append a slash to the directory name if it already has one.
Version 1.7.23 (built with libpng-1.5.7 and zlib-1.2.5)
Ignore any attempt to use "-ow" with the "-d" or "-e" options, with warning.
Include zlib.h if ZLIB_H is not defined (instead of checking the libpng
version; see entry below for pngcrush-1.7.14), and include string.h
if _STRING_H_ is not defined (because libpng-1.6 does not include string.h)
Define SLASH = backslash on Windows platforms so the "-d" option will work..
Version 1.7.22 (built with libpng-1.5.6 and zlib-1.2.5)
Added "-ow" (overwrite) option. The input file is overwritten and the
output file is just used temporarily and removed after it is copied
over the input file.. If you do not specify an output file, "pngout.png"
is used as the temporary file. Caution: the temporary file must be on
the same filesystem as the input file. Contributed by a group of students
of the University of Paris who were taking the "Understanding of Programs"
course and wished to gain familiarity with an open-source program.
Version 1.7.21 (built with libpng-1.5.6 and zlib-1.2.5)
Defined TOO_FAR=32767 in Makefile (instead of in pngcrush.h)
Version 1.7.20 (built with libpng-1.5.5 and zlib-1.2.5)
Removed the call to png_read_transform_info() when the system libpng
is being used, so it can be built with a system libpng.
Version 1.7.19 (built with libpng-1.5.5 and zlib-1.2.5)
pngcrush-1.7.18 failed to read interlaced PNGs. Reverted the change
from calling png_read_transform_info() to png_read_update_info().
Since png_read_transform_info() is not exported we again cannot build
with the system libpng15.
Version 1.7.18 (built with libpng-1.5.5 and zlib-1.2.5)
This version will work with either a "system" libpng14 or libpng15, or with
the embedded libpng15. The deprecated usage of libpng png_struct members
and unexported functions has been removed.
Fixing "too far back" errors does not work with libpng15.
Revised the format of the time report (all on one line so you can get
a nice compact report by piping the output to "grep coding").
Version 1.7.17 (built with libpng-1.5.5beta08 and zlib-1.2.5)
Changed "#if !defined(PNG_NO_STDIO)" to "#ifdef PNG_STDIO_SUPPORTED"
as recommended in the libpng documentation.
Added PNG_UINT_32_NAME macro and used it to simplify chunk_type integer
definitions.
Version 1.7.16 (built with libpng-1.5.4 and zlib-1.2.5)
Only report best method==0 if pngcrush cannot match the input filesize.
Otherwise, if there is no improvement, report the first matching method.
Version 1.7.15 (built with libpng-1.5.2rc02 and zlib-1.2.5)
Force bit_depth to 1, 2, or 4 when -plte_len is <=2, <=4, or <=16 and
the -bit_depth option is not present, to avoid writing invalid palette
indexes.
Version 1.7.14 (built with libpng-1.5.1beta08 and zlib-1.2.5)
Removed WIN32_WCE support (libpng has dropped it already)
Include zlib.h and define png_memcpy, etc., and revise the
png_get_iCCP() and png_set_iCCP() calls to be able to build
with bundled libpng-1.5.x. Pngcrush cannot be built yet with
a system libpng-1.5.x.
Dropped most of pngcrush.h, that eliminates various parts of libpng.
Version 1.7.13 (built with libpng-1.4.5 and zlib-1.2.5)
Version 1.7.12 (built with libpng-1.4.4beta05 and zlib-1.2.5)
Version 1.7.11 (built with libpng-1.4.2 and zlib-1.2.5)
Version 1.7.10 (built with libpng-1.4.1 and zlib-1.2.3.9)
Added missing "(...)" in png_get_uint_32().
Only compile png_get_uint_32(), etc., when PNG_LIBPNG_VER < 1.2.9
Revised help info for "-zitxt".
Version 1.7.9 (built with libpng-1.4.1 and zlib-1.2.3.9)
Defined TOO_FAR == 32767 in pngcrush.h (instead of in deflate.c)
Revised the "nolib" Makefiles to remove reference to gzio.c and
pnggccrd.c
Imposed user limits of chunk_malloc_max=4000000 and chunk_cache_max=500.
Version 1.7.8 (built with libpng-1.4.0 and zlib-1.2.3.5)
Removed gzio.c
Version 1.7.7 (built with libpng-1.4.0 and zlib-1.2.3.4)
Updated bundled libpng to version 1.4.0.
Check the "-plte_len n" option for out-of-range value of n.
Changed local variable "write" to "z_write" in inffast.c (zlib-1.2.3.4)
to avoid shadowed declaration warning.
Version 1.7.6 (built with libpng-1.4.0rc02 and zlib-1.2.3.2)
Change some "#if defined(X)" to "#ifdef X" according to libpng coding style.
Added some defines to suppress pedantic warnings from libpng-1.2.41beta15
and later. A warning about deprecated access to png_ptr->zstream is
otherwise unavoidable. When building the embedded libpng, a warning
about png_default_error() returning is also otherwise unavoidable.
Write premultiplied alpha if output extension is .ppng and
PNG_READ_PREMULTIPLIED_ALPHA_SUPPORTED is set (needs libpng-1.5.0).
Check the "-m method" option for out-of-range method value.
Version 1.7.5 (built with libpng-1.2.41beta14 and zlib-1.2.3.2)
Version 1.7.4 (built with libpng-1.2.40rc01 and zlib-1.2.3.2)
Use unmodified pngconf.h from libpng-1.2.41beta05 or later.
Version 1.7.3 (built with libpng-1.2.40 and zlib-1.2.3.2)
Print contents of text chunks after IDAT, even when the -n option
is used. This requires a slight modification of pngconf.h,
when libpng-1.2.x is used.
Version 1.7.2 (built with libpng-1.2.40 and zlib-1.2.3.2)
Added check for "verbose" on some printf statements.
Version 1.7.1 (built with libpng-1.2.39 and zlib-1.2.3.2)
Revised some prototypes to eliminate "Shadowed Declaration" warnings.
Moved warning about discarding APNG chunks to the end.
Replaced *.tar.lzma with *.tar.xz in the distribution.
Version 1.7.0 (built with libpng-1.2.38 and zlib-1.2.3.2)
Save (but do not recompress) APNG chunks if the output file has the
".apng" extension and the color_type and bit_depth are not changed.
Version 1.6.20 (built with libpng-1.2.38 and zlib-1.2.3.2)
Changed local variable "write" to "wwrite" in inffast.c (zlib) to avoid
shadowed declaration warning.
Version 1.6.19 (built with libpng-1.2.37 and zlib-1.2.3.2)
Added missing braces that cause an incorrect png_error() to be issued.
Version 1.6.18 (built with libpng-1.2.37 and zlib-1.2.3.2)
Removed extra FCLOSE(fpin) and FCLOSE(fpout) in the first Catch{} block,
since they get removed anyway right after that (Hanno Boeck).
Define PNG_NO_READ|WRITE_cHRM and PNG_NO_READ_|WRITEiCCP in pngcrush.h
and reordered pngcrush.h
Version 1.6.17 (built with libpng-1.2.36 and zlib-1.2.3.2)
Defined TOO_FAR == 32767 in deflate.c (again). The definition
has continually been inadvertently omitted during zlib updates
since pngcrush version 1.6.4.
Revised handling of xcode files so at least we can get printout
of IHDR values with "pngcrush -fix -n -v xcode.png".