mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
Imported from pngcrush-1.3.2.tar
This commit is contained in:
@@ -1,16 +1,16 @@
|
||||
|
||||
There's a sample makefile.gcc for pngcrush, which you can use
|
||||
There's a sample Makefile.gcc for pngcrush, which you can use
|
||||
by typing
|
||||
|
||||
make -f makefile.gcc
|
||||
make -f Makefile.gcc
|
||||
|
||||
However, all you should need to do is enter the pngcrush-1.3.0
|
||||
However, all you should need to do is enter the pngcrush-n.n.n
|
||||
directory and type
|
||||
|
||||
cc -O -o pngcrush *.c -lm
|
||||
cp pngcrush /usr/local/bin # or wherever you want
|
||||
|
||||
You might want to create a makefile if you are planning to do
|
||||
You might want to create your own Makefile if you are planning to do
|
||||
something more complicated, like loading with your system's shared
|
||||
libraries for libpng and zlib.
|
||||
|
||||
34
README.txt
34
README.txt
@@ -1,5 +1,35 @@
|
||||
Pngcrush documentation
|
||||
|
||||
| pngcrush 1.3.1, Copyright (C) 1998, 1999, Glenn Randers-Pehrson
|
||||
This is the copyright notice, disclaimer, and license:
|
||||
|
||||
/*
|
||||
* COPYRIGHT NOTICE, DISCLAIMER, AND LICENSE:
|
||||
*
|
||||
* Copyright (c) 1998, 1999, Glenn Randers-Pehrson
|
||||
*
|
||||
* The pngcrush 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 pngcrush program, even if advised of the possibility of such damage.
|
||||
*
|
||||
* Permission is hereby granted to use, copy, modify, and distribute this
|
||||
* source code, or portions hereof, for any purpose, without 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, disclaimer, and license may not be removed
|
||||
* or altered from any source or altered source distribution.
|
||||
*/
|
||||
|
||||
This is the output of "pngcrush" and "pngcrush -help":
|
||||
|
||||
| pngcrush 1.3.2, Copyright (C) 1998, 1999, Glenn Randers-Pehrson
|
||||
| This is a free, open-source program. Permission is
|
||||
| granted to everyone to use pngcrush without fee.
|
||||
| This program was built with libpng version 1.0.5k,
|
||||
@@ -13,6 +43,7 @@
|
||||
usage: pngcrush [options] infile.png outfile.png
|
||||
pngcrush -e ext [other options] files.png ...
|
||||
pngcrush -d dir [other options] files.png ...
|
||||
|
||||
options:
|
||||
-brute (Use brute-force, try 114 different methods)
|
||||
-c color_type of output file [0, 2, 4, or 6]
|
||||
@@ -40,6 +71,7 @@ options:
|
||||
-h (help)
|
||||
-p (pause)
|
||||
|
||||
|
||||
options:
|
||||
-brute (Use brute-force, try 114 different methods)
|
||||
|
||||
|
||||
32
pngcrush.c
32
pngcrush.c
@@ -15,7 +15,7 @@
|
||||
* occasionally creating Linux executables.
|
||||
*/
|
||||
|
||||
#define PNGCRUSH_VERSION "1.3.1"
|
||||
#define PNGCRUSH_VERSION "1.3.2"
|
||||
|
||||
/*
|
||||
* COPYRIGHT NOTICE, DISCLAIMER, AND LICENSE:
|
||||
@@ -54,6 +54,15 @@
|
||||
*
|
||||
* Change log:
|
||||
*
|
||||
* Version 1.3.2 (built with libpng-1.0.5k)
|
||||
*
|
||||
* Renamed "dirname" to "directory_name" to avoid conflict with "dirname"
|
||||
* that appears in string.h on some platforms.
|
||||
*
|
||||
* Fixed "PNG_NO_FLOAING_POINT" typo in pngcrush.h
|
||||
*
|
||||
* #ifdef'ed out parts of the help screen for options that are unsupported.
|
||||
*
|
||||
* Version 1.3.1 (built with libpng-1.0.5k): Eliminated some spurious warnings
|
||||
* that were being issued by libpng-1.0.5j. Added -itxt, -ztxt, and
|
||||
* -zitxt descriptions to the help screen.
|
||||
@@ -161,7 +170,7 @@
|
||||
static PNG_CONST char *progname = "pngtest.png";
|
||||
static PNG_CONST char *inname = "pngtest.png";
|
||||
static PNG_CONST char *outname = "pngout.png";
|
||||
static PNG_CONST char *dirname = "pngcrush.bak";
|
||||
static PNG_CONST char *directory_name = "pngcrush.bak";
|
||||
static PNG_CONST char *extension = "_C.png";
|
||||
|
||||
static int all_chunks_are_safe=0;
|
||||
@@ -641,7 +650,7 @@ main(int argc, char *argv[])
|
||||
{
|
||||
i++;
|
||||
pngcrush_mode=DIRECTORY_MODE;
|
||||
dirname= argv[names++];
|
||||
directory_name= argv[names++];
|
||||
}
|
||||
else if(!strncmp(argv[i],"-e",2))
|
||||
{
|
||||
@@ -784,11 +793,13 @@ main(int argc, char *argv[])
|
||||
things_have_changed=1;
|
||||
}
|
||||
#endif
|
||||
#ifdef PNG_pHYs_SUPPORTED
|
||||
else if(!strncmp(argv[i],"-res",4))
|
||||
{
|
||||
names++;
|
||||
resolution=atoi(argv[++i]);
|
||||
}
|
||||
#endif
|
||||
else if(!strncmp(argv[i],"-r",2))
|
||||
{
|
||||
remove_chunks=i;
|
||||
@@ -797,6 +808,7 @@ main(int argc, char *argv[])
|
||||
}
|
||||
else if( !strncmp(argv[i],"-save",5))
|
||||
all_chunks_are_safe++;
|
||||
#ifdef PNG_sRGB_SUPPORTED
|
||||
else if( !strncmp(argv[i],"-srgb",5) ||
|
||||
!strncmp(argv[i],"-sRGB",5))
|
||||
{
|
||||
@@ -816,6 +828,7 @@ main(int argc, char *argv[])
|
||||
else
|
||||
i--;
|
||||
}
|
||||
#endif
|
||||
else if(!strncmp(argv[i],"-s",2))
|
||||
verbose=0;
|
||||
else if( !strncmp(argv[i],"-text",5) || !strncmp(argv[i],"-tEXt",5) ||
|
||||
@@ -993,6 +1006,7 @@ main(int argc, char *argv[])
|
||||
else if(default_compression_window == 2) default_compression_window=11;
|
||||
else if(default_compression_window == 1) default_compression_window=10;
|
||||
else if(default_compression_window == 512) default_compression_window= 9;
|
||||
/* Use of compression window size 256 is not recommended. */
|
||||
else if(default_compression_window == 256) default_compression_window= 8;
|
||||
else if(default_compression_window != 15)
|
||||
{
|
||||
@@ -1396,20 +1410,20 @@ main(int argc, char *argv[])
|
||||
if(pngcrush_mode == DIRECTORY_MODE)
|
||||
{
|
||||
struct stat stat_buf;
|
||||
if(stat(dirname, &stat_buf) != 0)
|
||||
if(stat(directory_name, &stat_buf) != 0)
|
||||
{
|
||||
#ifdef _MBCS
|
||||
if(_mkdir(dirname) != 0)
|
||||
#if defined(_MBCS) || defined(__WIN32__)
|
||||
if(_mkdir(directory_name) != 0)
|
||||
#else
|
||||
if(mkdir(dirname, 0x1ed) != 0)
|
||||
if(mkdir(directory_name, 0x1ed) != 0)
|
||||
#endif
|
||||
{
|
||||
fprintf(STDERR,"could not create directory %s\n",dirname);
|
||||
fprintf(STDERR,"could not create directory %s\n",directory_name);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
out_string[0] = '\0';
|
||||
str_return = strcat(out_string,dirname);
|
||||
str_return = strcat(out_string,directory_name);
|
||||
str_return = strcat(out_string,SLASH);
|
||||
|
||||
in_string[0] = '\0';
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/* Special defines for pngcrush, mostly just to reduce the size of the
|
||||
static executable. */
|
||||
|
||||
#define PNG_NO_FLOAING_POINT_SUPPORTED /* undef this if you want to be able
|
||||
#define PNG_NO_FLOATING_POINT_SUPPORTED /* undef this if you want to be able
|
||||
to reduce color to gray */
|
||||
#define PNG_NO_READ_cHRM
|
||||
#define PNG_NO_WRITE_cHRM
|
||||
|
||||
Reference in New Issue
Block a user