Alien-FreeImage

 view release on metacpan or  search on metacpan

Build.PL  view on Meta::CPAN

use strict;
use warnings;

use lib 'inc';

my $package = $^O eq 'MSWin32' ? 'My::Builder::Windows' :
              $^O eq 'cygwin'  ? 'My::Builder::Cygwin'  :
              'My::Builder::Unix';

eval "require $package" or die "Require '$package' failed: $@\n";
warn "Gonna use '$package' class ...\n";

my $builder = $package->new(
  module_name        => 'Alien::FreeImage',
  dist_version_from  => 'lib/Alien/FreeImage.pm',
  dist_author        => 'KMX <kmx@cpan.org>',
  license            => 'perl',
  requires => {

MANIFEST  view on Meta::CPAN

Build.PL
Changes
inc/My/Builder.pm
inc/My/Builder/Cygwin.pm
inc/My/Builder/Unix.pm
inc/My/Builder/Windows.pm
lib/Alien/FreeImage.pm
LICENSE
MANIFEST			This list of files
META.json
META.yml
patches/FreeImage-3.17.0-ALL-IN-ONE.patch
README
sharedir/share
src/clean.sh

MANIFEST  view on Meta::CPAN

src/Source/LibTIFF4/tif_pixarlog.c
src/Source/LibTIFF4/tif_predict.c
src/Source/LibTIFF4/tif_predict.h
src/Source/LibTIFF4/tif_print.c
src/Source/LibTIFF4/tif_read.c
src/Source/LibTIFF4/tif_stream.cxx
src/Source/LibTIFF4/tif_strip.c
src/Source/LibTIFF4/tif_swab.c
src/Source/LibTIFF4/tif_thunder.c
src/Source/LibTIFF4/tif_tile.c
src/Source/LibTIFF4/tif_unix.c
src/Source/LibTIFF4/tif_version.c
src/Source/LibTIFF4/tif_vms.c
src/Source/LibTIFF4/tif_warning.c
src/Source/LibTIFF4/tif_win32.c
src/Source/LibTIFF4/tif_wince.c
src/Source/LibTIFF4/tif_write.c
src/Source/LibTIFF4/tif_zip.c
src/Source/LibTIFF4/tiff.h
src/Source/LibTIFF4/tiffconf.h
src/Source/LibTIFF4/tiffconf.h-vms

inc/My/Builder/Unix.pm  view on Meta::CPAN

package My::Builder::Unix;

use strict;
use warnings;
use base 'My::Builder';

use Config;
my $makefile = 'Makefile.gnu';
$makefile = 'Makefile.solaris'       if $^O eq 'solaris';
$makefile = $ENV{FREEIMAGE_MAKEFILE} if $ENV{FREEIMAGE_MAKEFILE};

patches/FreeImage-3.17.0-ALL-IN-ONE.patch  view on Meta::CPAN

-	mkdir -p Dist
-	cp *.a Dist/
-	cp *.dll Dist/
-	cp *.dll.a Dist/
-	cp $(HEADER) Dist/
+dist: $(STATICLIB) $(HEADER)
+	mkdir -p $(DISTDIR)
+	cp $(STATICLIB) $(DISTDIR)
+	cp $(HEADER) $(DISTDIR)
 
 dos2unix:
 	@$(DOS2UNIX) $(SRCS) $(INCLS)
diff -ru src.3170/Makefile.gnu src/Makefile.gnu
--- src.3170/Makefile.gnu	2015-03-08 17:04:00.000000000 +0100
+++ src/Makefile.gnu	2017-06-22 23:20:43.835208600 +0200
@@ -46,11 +46,11 @@
 
 all: dist
 
-dist: FreeImage
-	mkdir -p Dist
-	cp *.a Dist/
-	cp *.so Dist/
-	cp Source/FreeImage.h Dist/
+dist: $(STATICLIB) $(HEADER)
+	mkdir -p $(DISTDIR)
+	cp $(STATICLIB) $(DISTDIR)
+	cp $(HEADER) $(DISTDIR)
+ 
 
 dos2unix:
 	@$(DOS2UNIX) $(SRCS) $(INCLS)
diff -ru src.3170/Makefile.mingw src/Makefile.mingw
--- src.3170/Makefile.mingw	2015-03-08 17:04:12.000000000 +0100
+++ src/Makefile.mingw	2017-06-27 10:00:56.255544400 +0200
@@ -32,14 +32,16 @@
 #Define the resource compiler.
 RC = windres
 
+PERL=perl
+

patches/FreeImage-3.17.0-ALL-IN-ONE.patch  view on Meta::CPAN

-dist: FreeImage
-	mkdir -p Dist
-	cp *.a Dist/
-	cp *.so Dist/
-	cp Source/FreeImage.h Dist/
+dist: $(STATICLIB) Source/FreeImage.h
+	mkdir -p $(DISTDIR)
+	cp $(STATICLIB) $(DISTDIR)
+	cp Source/FreeImage.h $(DISTDIR)
 
 dos2unix:
 	@$(DOS2UNIX) $(SRCS) $(INCLS)
diff -ru src.3170/Source/LibJXR/image/sys/strcodec.c src/Source/LibJXR/image/sys/strcodec.c
--- src.3170/Source/LibJXR/image/sys/strcodec.c	2015-03-02 01:07:10.000000000 +0100
+++ src/Source/LibJXR/image/sys/strcodec.c	2017-06-22 22:59:12.715416800 +0200
@@ -671,6 +671,7 @@
 #ifdef _BIG__ENDIAN_
 #define _byteswap_ulong(x)  (x)
 #else // _BIG__ENDIAN_
+#ifndef __MINGW32__
 U32 _byteswap_ulong(U32 bits)

src/Makefile.cygwin  view on Meta::CPAN

include Makefile.srcs

# General configuration variables:
CC = gcc
CXX = g++
AR = ar

INSTALLDIR = /usr

# Converts cr/lf to just lf
DOS2UNIX = dos2unix

COMPILERFLAGS = -O3 -DNO_LCMS
LIBRARIES = -lstdc++

MODULES = $(SRCS:.c=.o)
MODULES := $(MODULES:.cpp=.o)
CFLAGS = $(COMPILERFLAGS) $(INCLUDE)
CXXFLAGS = $(COMPILERFLAGS)  -Wno-ctor-dtor-privacy $(INCLUDE)

TARGET  = freeimage

src/Makefile.cygwin  view on Meta::CPAN


default: all

all: dist

dist: $(STATICLIB) $(HEADER)
	mkdir -p $(DISTDIR)
	cp $(STATICLIB) $(DISTDIR)
	cp $(HEADER) $(DISTDIR)

dos2unix:
	@$(DOS2UNIX) $(SRCS) $(INCLS)

FreeImage: $(STATICLIB) $(SHAREDLIB)

.c.o:
	$(CC) $(CFLAGS) -c $< -o $@

.cpp.o:
	$(CXX) $(CXXFLAGS) -c $< -o $@

src/Makefile.fip  view on Meta::CPAN


# This file can be generated by ./genfipsrclist.sh
include fipMakefile.srcs

# General configuration variables:
DESTDIR ?= /
INCDIR ?= $(DESTDIR)/usr/include
INSTALLDIR ?= $(DESTDIR)/usr/lib

# Converts cr/lf to just lf
DOS2UNIX = dos2unix

LIBRARIES = -lstdc++

MODULES = $(SRCS:.c=.o)
MODULES := $(MODULES:.cpp=.o)
CFLAGS ?= -O3 -fPIC -fexceptions -fvisibility=hidden
# OpenJPEG
CFLAGS += -DOPJ_STATIC
# LibRaw
CFLAGS += -DNO_LCMS

src/Makefile.fip  view on Meta::CPAN


all: dist

dist: FreeImage
	mkdir -p Dist
	cp *.a Dist/
	cp *.so Dist/
	cp Source/FreeImage.h Dist/
	cp Wrapper/FreeImagePlus/FreeImagePlus.h Dist/

dos2unix:
	@$(DOS2UNIX) $(SRCS)

FreeImage: $(STATICLIB) $(SHAREDLIB)

.c.o:
	$(CC) $(CFLAGS) -c $< -o $@

.cpp.o:
	$(CXX) $(CXXFLAGS) -c $< -o $@

src/Makefile.gnu  view on Meta::CPAN


# This file can be generated by ./gensrclist.sh
include Makefile.srcs

# General configuration variables:
DESTDIR ?= /
INCDIR ?= $(DESTDIR)/usr/include
INSTALLDIR ?= $(DESTDIR)/usr/lib

# Converts cr/lf to just lf
DOS2UNIX = dos2unix

LIBRARIES = -lstdc++

MODULES = $(SRCS:.c=.o)
MODULES := $(MODULES:.cpp=.o)
CFLAGS ?= -O3 -fPIC -fexceptions -fvisibility=hidden
# OpenJPEG
CFLAGS += -DOPJ_STATIC
# LibRaw
CFLAGS += -DNO_LCMS

src/Makefile.gnu  view on Meta::CPAN

default: all

all: dist

dist: $(STATICLIB) $(HEADER)
	mkdir -p $(DISTDIR)
	cp $(STATICLIB) $(DISTDIR)
	cp $(HEADER) $(DISTDIR)
 

dos2unix:
	@$(DOS2UNIX) $(SRCS) $(INCLS)

FreeImage: $(STATICLIB) $(SHAREDLIB)

.c.o:
	$(CC) $(CFLAGS) -c $< -o $@

.cpp.o:
	$(CXX) $(CXXFLAGS) -c $< -o $@

src/Makefile.solaris  view on Meta::CPAN

include Makefile.srcs

# General configuration variables:
CC = gcc
CPP = g++
AR = ar

INSTALLDIR = /usr/local

# Converts cr/lf to just lf
DOS2UNIX = dos2unix

COMPILERFLAGS = -O3
LIBRARIES = -lstdc++

MODULES = $(SRCS:.c=.o)
MODULES := $(MODULES:.cpp=.o)
CFLAGS = $(COMPILERFLAGS) $(INCLUDE)
CPPFLAGS = $(COMPILERFLAGS)  -Wno-ctor-dtor-privacy $(INCLUDE)

TARGET  = freeimage

src/Makefile.solaris  view on Meta::CPAN


default: all

all: dist

dist: $(STATICLIB) Source/FreeImage.h
	mkdir -p $(DISTDIR)
	cp $(STATICLIB) $(DISTDIR)
	cp Source/FreeImage.h $(DISTDIR)

dos2unix:
	@$(DOS2UNIX) $(SRCS) $(INCLS)

FreeImage: $(STATICLIB) $(SHAREDLIB)

.c.o:
	$(CC) $(CFLAGS) -c $< -o $@

.cpp.o:
	$(CPP) $(CPPFLAGS) -c $< -o $@

src/README.linux  view on Meta::CPAN

installed on your /usr/lib directory in order to compile and use the library. 
FreeImage uses its own versions of these libraries. This way, you can be sure that FreeImage will 
always use the latest version of each third party library.

The FreeImage makefile makes use of the gcc "-fvisibility=hidden" in order to avoid incompatibilities between 
internal third party libraries and the OS libraries. You may have to remove this option if you're running an 
old version of gcc. See also http://gcc.gnu.org/wiki/Visibility

You should be able to link progams with the -lfreeimage option after the library is compiled and installed. 
You can also statically link with libfreeimage.a.
If you use a really old version of gcc and it chokes on the CRs in the file, you can type 'make dos2unix'
to run all of the files through dos2unix which converts CRLF to LF.  This no longer appears to be required
for RedHat 7.3 or 9.

Please let me know how this works for you under other Linux distributions or any other *nix.

Herve Drolon
FreeImage Project Manager

Installation
------------
Note: You will need to have root privileges in order to install the library in the /usr/lib directory.
The installation process is as simple as this : 
1) Enter the FreeImage directory
2) Build the distribution : 

src/Source/FreeImage/PluginTIFF.cpp  view on Meta::CPAN

// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER
// THIS DISCLAIMER.
//
// Use at your own risk!
// ==========================================================

#ifdef _MSC_VER 
#pragma warning (disable : 4786) // identifier was truncated to 'number' characters
#endif

#ifdef unix
#undef unix
#endif
#ifdef __unix
#undef __unix
#endif

#include "FreeImage.h"
#include "Utilities.h"
#include "../LibTIFF4/tiffiop.h"
#include "../Metadata/FreeImageTag.h"
#include "../OpenEXR/Half/half.h"

#include "FreeImageIO.h"
#include "PSDParser.h"

src/Source/LibJPEG/README  view on Meta::CPAN

ACKNOWLEDGMENTS     Special thanks.
FILE FORMAT WARS    Software *not* to get.
TO DO               Plans for future IJG releases.

Other documentation files in the distribution are:

User documentation:
  install.txt       How to configure and install the IJG software.
  usage.txt         Usage instructions for cjpeg, djpeg, jpegtran,
                    rdjpgcom, and wrjpgcom.
  *.1               Unix-style man pages for programs (same info as usage.txt).
  wizard.txt        Advanced usage instructions for JPEG wizards only.
  change.log        Version-to-version change highlights.
Programmer and internal documentation:
  libjpeg.txt       How to use the JPEG library in your own programs.
  example.c         Sample code for calling the JPEG library.
  structure.txt     Overview of the JPEG library's internal structure.
  filelist.txt      Road map of IJG files.
  coderules.txt     Coding style rules --- please read if you contribute code.

Please read at least the files install.txt and usage.txt.  Some information

src/Source/LibJPEG/README  view on Meta::CPAN

Permission is NOT granted for the use of any IJG author's name or company name
in advertising or publicity relating to this software or products derived from
it.  This software may be referred to only as "the Independent JPEG Group's
software".

We specifically permit and encourage the use of this software as the basis of
commercial products, provided that all warranty or liability claims are
assumed by the product vendor.


The Unix configuration script "configure" was produced with GNU Autoconf.
It is copyright by the Free Software Foundation but is freely distributable.
The same holds for its supporting scripts (config.guess, config.sub,
ltmain.sh).  Another support script, install-sh, is copyright by X Consortium
but is also freely distributable.

The IJG distribution formerly included code to read and write GIF files.
To avoid entanglement with the Unisys LZW patent (now expired), GIF reading
support has been removed altogether, and the GIF writer has been simplified
to produce "uncompressed GIFs".  This technique does not use the LZW
algorithm; the resulting GIF files are larger than usual, but are readable

src/Source/LibJPEG/cdjpeg.c  view on Meta::CPAN

  }
  /* reached end of argument; fail if it's too short for unique abbrev */
  if (nmatched < minchars)
    return FALSE;
  return TRUE;			/* A-OK */
}


/*
 * Routines to establish binary I/O mode for stdin and stdout.
 * Non-Unix systems often require some hacking to get out of text mode.
 */

GLOBAL(FILE *)
read_stdin (void)
{
  FILE * input_file = stdin;

#ifdef USE_SETMODE		/* need to hack file mode? */
  setmode(fileno(stdin), O_BINARY);
#endif

src/Source/LibJPEG/change.log  view on Meta::CPAN

Huffman tables being used.

Huffman tables are checked for validity much more carefully than before.

To avoid the Unisys LZW patent, djpeg's GIF output capability has been
changed to produce "uncompressed GIFs", and cjpeg's GIF input capability
has been removed altogether.  We're not happy about it either, but there
seems to be no good alternative.

The configure script now supports building libjpeg as a shared library
on many flavors of Unix (all the ones that GNU libtool knows how to
build shared libraries for).  Use "./configure --enable-shared" to
try this out.

New jconfig file and makefiles for Microsoft Visual C++ and Developer Studio.
Also, a jconfig file and a build script for Metrowerks CodeWarrior
on Apple Macintosh.  makefile.dj has been updated for DJGPP v2, and there
are miscellaneous other minor improvements in the makefiles.

jmemmac.c now knows how to create temporary files following Mac System 7
conventions.

src/Source/LibJPEG/change.log  view on Meta::CPAN


Repair oversight in jmemname.c NO_MKTEMP case: file could be there
but unreadable.


Version 5  24-Sep-94
--------------------

Version 5 represents a nearly complete redesign and rewrite of the IJG
software.  Major user-visible changes include:
  * Automatic configuration simplifies installation for most Unix systems.
  * A range of speed vs. image quality tradeoffs are supported.
    This includes resizing of an image during decompression: scaling down
    by a factor of 1/2, 1/4, or 1/8 is handled very efficiently.
  * New programs rdjpgcom and wrjpgcom allow insertion and extraction
    of text comments in a JPEG file.

The application programmer's interface to the library has changed completely.
Notable improvements include:
  * We have eliminated the use of callback routines for handling the
    uncompressed image data.  The application now sees the library as a

src/Source/LibJPEG/cjpeg.c  view on Meta::CPAN

/*
 * cjpeg.c
 *
 * Copyright (C) 1991-1998, Thomas G. Lane.
 * Modified 2003-2013 by Guido Vollbeding.
 * This file is part of the Independent JPEG Group's software.
 * For conditions of distribution and use, see the accompanying README file.
 *
 * This file contains a command-line user interface for the JPEG compressor.
 * It should work on any system with Unix- or MS-DOS-style command lines.
 *
 * Two different command line styles are permitted, depending on the
 * compile-time switch TWO_FILE_COMMANDLINE:
 *	cjpeg [options]  inputfile outputfile
 *	cjpeg [options]  [inputfile]
 * In the second style, output is always to standard output, which you'd
 * normally redirect to a file or pipe to some other program.  Input is
 * either from a named file or from standard input (typically redirected).
 * The second style is convenient on Unix but is unhelpful on systems that
 * don't support pipes.  Also, you MUST use the first style if your system
 * doesn't do binary I/O to stdin/stdout.
 * To simplify script writing, the "-outfile" switch is provided.  The syntax
 *	cjpeg [options]  -outfile outputfile  inputfile
 * works regardless of which command line style is used.
 */

#include "cdjpeg.h"		/* Common decls for cjpeg/djpeg applications */
#include "jversion.h"		/* for version message */

src/Source/LibJPEG/cjpeg.c  view on Meta::CPAN

 * we may look only at the first byte of the file, since C does not
 * guarantee that more than one character can be pushed back with ungetc.
 * Looking at additional bytes would require one of these approaches:
 *     1) assume we can fseek() the input file (fails for piped input);
 *     2) assume we can push back more than one character (works in
 *        some C implementations, but unportable);
 *     3) provide our own buffering (breaks input readers that want to use
 *        stdio directly, such as the RLE library);
 * or  4) don't put back the data, and modify the input_init methods to assume
 *        they start reading after the start of file (also breaks RLE library).
 * #1 is attractive for MS-DOS but is untenable on Unix.
 *
 * The most portable solution for file types that can't be identified by their
 * first byte is to make the user tell us what they are.  This is also the
 * only approach for "raw" file types that contain only arbitrary values.
 * We presently apply this method for Targa files.  Most of the time Targa
 * files start with 0x00, so we recognize that case.  Potentially, however,
 * a Targa file could start with any byte value (byte 0 is the length of the
 * seldom-used ID field), so we provide a switch to force Targa input mode.
 */

src/Source/LibJPEG/cjpeg.c  view on Meta::CPAN

    }
    outfilename = argv[file_index+1];
  } else {
    if (file_index != argc-1) {
      fprintf(stderr, "%s: must name one input and one output file\n",
	      progname);
      usage();
    }
  }
#else
  /* Unix style: expect zero or one file name */
  if (file_index < argc-1) {
    fprintf(stderr, "%s: only one input file\n", progname);
    usage();
  }
#endif /* TWO_FILE_COMMANDLINE */

  /* Open the input file. */
  if (file_index < argc) {
    if ((input_file = fopen(argv[file_index], READ_BINARY)) == NULL) {
      fprintf(stderr, "%s: can't open %s\n", progname, argv[file_index]);

src/Source/LibJPEG/ckconfig.c  view on Meta::CPAN

 */

#undef NEED_BSD_STRINGS

#ifdef NEED_BSD_STRINGS
#include <strings.h>
#else
#include <string.h>
#endif

/* On some systems (especially older Unix machines), type size_t is
 * defined only in the include file <sys/types.h>.  If you get a failure
 * on the size_t test below, try defining NEED_SYS_TYPES_H.
 */

#undef NEED_SYS_TYPES_H		/* start by assuming we don't need it */
#ifdef NEED_SYS_TYPES_H
#include <sys/types.h>
#endif


src/Source/LibJPEG/ckconfig.c  view on Meta::CPAN


#ifdef NEED_SPECIAL_INCLUDE
#include <someincludefile.h>
#endif

typedef size_t my_size_t;	/* The payoff: do we have size_t now? */


/* The next question is whether your compiler supports ANSI-style function
 * prototypes.  You need to know this in order to choose between using
 * makefile.ansi and using makefile.unix.
 * The #define line below is set to assume you have ANSI function prototypes.
 * If you get an error in this group of lines, undefine HAVE_PROTOTYPES.
 */

#define HAVE_PROTOTYPES

#ifdef HAVE_PROTOTYPES
int testfunction (int arg1, int * arg2); /* check prototypes */

struct methods_struct {		/* check method-pointer declarations */

src/Source/LibJPEG/ckconfig.c  view on Meta::CPAN

    fprintf(outfile, "#undef RIGHT_SHIFT_IS_UNSIGNED\n");
  else
    fprintf(outfile, "#define RIGHT_SHIFT_IS_UNSIGNED\n");
  fprintf(outfile, "\n#endif /* JPEG_INTERNALS */\n");
  fprintf(outfile, "\n#ifdef JPEG_CJPEG_DJPEG\n\n");
  fprintf(outfile, "#define BMP_SUPPORTED		/* BMP image file format */\n");
  fprintf(outfile, "#define GIF_SUPPORTED		/* GIF image file format */\n");
  fprintf(outfile, "#define PPM_SUPPORTED		/* PBMPLUS PPM/PGM image file format */\n");
  fprintf(outfile, "#undef RLE_SUPPORTED		/* Utah RLE image file format */\n");
  fprintf(outfile, "#define TARGA_SUPPORTED		/* Targa image file format */\n\n");
  fprintf(outfile, "#undef TWO_FILE_COMMANDLINE	/* You may need this on non-Unix systems */\n");
  fprintf(outfile, "#undef NEED_SIGNAL_CATCHER	/* Define this if you use jmemname.c */\n");
  fprintf(outfile, "#undef DONT_USE_B_MODE\n");
  fprintf(outfile, "/* #define PROGRESS_REPORT */	/* optional */\n");
  fprintf(outfile, "\n#endif /* JPEG_CJPEG_DJPEG */\n");

  /* Close the jconfig.h file */
  fclose(outfile);

  /* User report */
  printf("Configuration check for Independent JPEG Group's software done.\n");
  printf("\nI have written the jconfig.h file for you.\n\n");
#ifdef HAVE_PROTOTYPES
  printf("You should use makefile.ansi as the starting point for your Makefile.\n");
#else
  printf("You should use makefile.unix as the starting point for your Makefile.\n");
#endif

#ifdef NEED_SPECIAL_INCLUDE
  printf("\nYou'll need to change jconfig.h to include the system include file\n");
  printf("that you found type size_t in, or add a direct definition of type\n");
  printf("size_t if that's what you used.  Just add it to the end.\n");
#endif

  return 0;
}

src/Source/LibJPEG/djpeg.c  view on Meta::CPAN

/*
 * djpeg.c
 *
 * Copyright (C) 1991-1997, Thomas G. Lane.
 * Modified 2009-2013 by Guido Vollbeding.
 * This file is part of the Independent JPEG Group's software.
 * For conditions of distribution and use, see the accompanying README file.
 *
 * This file contains a command-line user interface for the JPEG decompressor.
 * It should work on any system with Unix- or MS-DOS-style command lines.
 *
 * Two different command line styles are permitted, depending on the
 * compile-time switch TWO_FILE_COMMANDLINE:
 *	djpeg [options]  inputfile outputfile
 *	djpeg [options]  [inputfile]
 * In the second style, output is always to standard output, which you'd
 * normally redirect to a file or pipe to some other program.  Input is
 * either from a named file or from standard input (typically redirected).
 * The second style is convenient on Unix but is unhelpful on systems that
 * don't support pipes.  Also, you MUST use the first style if your system
 * doesn't do binary I/O to stdin/stdout.
 * To simplify script writing, the "-outfile" switch is provided.  The syntax
 *	djpeg [options]  -outfile outputfile  inputfile
 * works regardless of which command line style is used.
 */

#include "cdjpeg.h"		/* Common decls for cjpeg/djpeg applications */
#include "jversion.h"		/* for version message */

src/Source/LibJPEG/djpeg.c  view on Meta::CPAN

    }
    outfilename = argv[file_index+1];
  } else {
    if (file_index != argc-1) {
      fprintf(stderr, "%s: must name one input and one output file\n",
	      progname);
      usage();
    }
  }
#else
  /* Unix style: expect zero or one file name */
  if (file_index < argc-1) {
    fprintf(stderr, "%s: only one input file\n", progname);
    usage();
  }
#endif /* TWO_FILE_COMMANDLINE */

  /* Open the input file. */
  if (file_index < argc) {
    if ((input_file = fopen(argv[file_index], READ_BINARY)) == NULL) {
      fprintf(stderr, "%s: can't open %s\n", progname, argv[file_index]);

src/Source/LibJPEG/filelist.txt  view on Meta::CPAN

jconfig.h and jinclude.h, only to improve portability.


ADDITIONAL FILES
================

Documentation (see README for a guide to the documentation files):

README		Master documentation file.
*.txt		Other documentation files.
*.1		Documentation in Unix man page format.
change.log	Version-to-version change highlights.
example.c	Sample code for calling JPEG library.

Configuration/installation files and programs (see install.txt for more info):

configure	Unix shell script to perform automatic configuration.
configure.ac	Source file for use with Autoconf to generate configure.
ltmain.sh	Support scripts for configure (from GNU libtool).
config.guess
config.sub
depcomp
missing
ar-lib
compile
install-sh	Install shell script for those Unix systems lacking one.
Makefile.in	Makefile input for configure.
Makefile.am	Source file for use with Automake to generate Makefile.in.
ckconfig.c	Program to generate jconfig.h on non-Unix systems.
jconfig.txt	Template for making jconfig.h by hand.
mak*.*		Sample makefiles for particular systems.
jconfig.*	Sample jconfig.h for particular systems.
libjpeg.map	Script to generate shared library with versioned symbols.
aclocal.m4	M4 macro definitions for use with Autoconf.

Test files (see install.txt for test procedure):

test*.*		Source and comparison files for confidence test.
		These are binary image files, NOT text files.

src/Source/LibJPEG/install.txt  view on Meta::CPAN

adapted to almost any environment.  The downside of this decision is that the
installation process is complicated.  We have provided shortcuts to simplify
the task on common systems.  But in any case, you will need at least a little
familiarity with C programming and program build procedures for your system.

If you are only using this software as part of a larger program, the larger
program's installation procedure may take care of configuring the IJG code.
For example, Ghostscript's installation script will configure the IJG code.
You don't need to read this file if you just want to compile Ghostscript.

If you are on a Unix machine, you may not need to read this file at all.
Try doing
	./configure
	make
	make test
If that doesn't complain, do
	make install
(better do "make -n install" first to see if the makefile will put the files
where you want them).  Read further if you run into snags or want to customize
the code for your system.

src/Source/LibJPEG/install.txt  view on Meta::CPAN

Please check the last section of this file to see if there are hints for the
specific machine or compiler you are using.


CONFIGURING THE SOFTWARE
========================

To configure the IJG code for your system, you need to create two files:
  * jconfig.h: contains values for system-dependent #define symbols.
  * Makefile: controls the compilation process.
(On a non-Unix machine, you may create "project files" or some other
substitute for a Makefile.  jconfig.h is needed in any environment.)

We provide three different ways to generate these files:
  * On a Unix system, you can just run the "configure" script.
  * We provide sample jconfig files and makefiles for popular machines;
    if your machine matches one of the samples, just copy the right sample
    files to jconfig.h and Makefile.
  * If all else fails, read the instructions below and make your own files.


Configuring the software using the automatic "configure" script
---------------------------------------------------------------

If you are on a Unix machine, you can just type
	./configure
and let the configure script construct appropriate configuration files.
If you're using "csh" on an old version of System V, you might need to type
	sh configure
instead to prevent csh from trying to execute configure itself.
Expect configure to run for a few minutes, particularly on slower machines;
it works by compiling a series of test programs.

Configure was created with GNU Autoconf and it follows the usual conventions
for GNU configure scripts.  It makes a few assumptions that you may want to

src/Source/LibJPEG/install.txt  view on Meta::CPAN

if you want to compile without debugging support.

* Configure will set up the makefile so that "make install" will install files
into /usr/local/bin, /usr/local/man, etc.  You can specify an installation
prefix other than "/usr/local" by giving configure the option "--prefix=PATH".

* If you don't have a lot of swap space, you may need to enable the IJG
software's internal virtual memory mechanism.  To do this, give the option
"--enable-maxmem=N" where N is the default maxmemory limit in megabytes.
This is discussed in more detail under "Selecting a memory manager", below.
You probably don't need to worry about this on reasonably-sized Unix machines,
unless you plan to process very large images.

Configure has some other features that are useful if you are cross-compiling
or working in a network of multiple machine types; but if you need those
features, you probably already know how to use them.


Configuring the software using one of the supplied jconfig and makefile files
-----------------------------------------------------------------------------

src/Source/LibJPEG/install.txt  view on Meta::CPAN

you get it to run, it will write a suitable jconfig.h file, and will also
print out some advice about which makefile to use.

You may also want to look at the canned jconfig files, if there is one for a
system similar to yours.

Second, select a makefile and copy it to Makefile (or whatever your system
uses as the standard makefile name).  The most generic makefiles we provide
are
	makefile.ansi:	if your C compiler supports function prototypes
	makefile.unix:	if not.
(You have function prototypes if ckconfig.c put "#define HAVE_PROTOTYPES"
in jconfig.h.)  You may want to start from one of the other makefiles if
there is one for a system similar to yours.

Look over the selected Makefile and adjust options as needed.  In particular
you may want to change the CC and CFLAGS definitions.  For instance, if you
are using GCC, set CC=gcc.  If you had to use any compiler switches to get
ckconfig.c to work, make sure the same switches are in CFLAGS.

If you are on a system that doesn't use makefiles, you'll need to set up

src/Source/LibJPEG/install.txt  view on Meta::CPAN

decompression, or both.  As a last resort, you can make a batch script that
just compiles everything and links it all together; makefile.vms is an example
of this (it's for VMS systems that have no make-like utility).

Here are comments about some specific configuration decisions you'll
need to make:

Command line style
------------------

These programs can use a Unix-like command line style which supports
redirection and piping, like this:
	cjpeg inputfile >outputfile
	cjpeg <inputfile >outputfile
	source program | cjpeg >outputfile
The simpler "two file" command line style is just
	cjpeg inputfile outputfile
You may prefer the two-file style, particularly if you don't have pipes.

You MUST use two-file style on any system that doesn't cope well with binary
data fed through stdin/stdout; this is true for some MS-DOS compilers, for
example.  If you're not on a Unix system, it's safest to assume you need
two-file style.  (But if your compiler provides either the Posix-standard
fdopen() library routine or a Microsoft-compatible setmode() routine, you
can safely use the Unix command line style, by defining USE_FDOPEN or
USE_SETMODE respectively.)

To use the two-file style, make jconfig.h say "#define TWO_FILE_COMMANDLINE".

Selecting a memory manager
--------------------------

The IJG code is capable of working on images that are too big to fit in main
memory; data is swapped out to temporary files as necessary.  However, the
code to do this is rather system-dependent.  We provide five different
memory managers:

* jmemansi.c	This version uses the ANSI-standard library routine tmpfile(),
		which not all non-ANSI systems have.  On some systems
		tmpfile() may put the temporary file in a non-optimal
		location; if you don't like what it does, use jmemname.c.

* jmemname.c	This version creates named temporary files.  For anything
		except a Unix machine, you'll need to configure the
		select_file_name() routine appropriately; see the comments
		near the head of jmemname.c.  If you use this version, define
		NEED_SIGNAL_CATCHER in jconfig.h to make sure the temp files
		are removed if the program is aborted.

* jmemnobs.c	(That stands for No Backing Store :-).)  This will compile on
		almost any system, but it assumes you have enough main memory
		or virtual memory to hold the biggest images you work with.

* jmemdos.c	This should be used with most 16-bit MS-DOS compilers.

src/Source/LibJPEG/install.txt  view on Meta::CPAN

You may also need to change unlink() to remove() in close_backing_store().

Except with jmemnobs.c or jmemmac.c, you need to adjust the DEFAULT_MAX_MEM
setting to a reasonable value for your system (either by adding a #define for
DEFAULT_MAX_MEM to jconfig.h, or by adding a -D switch to the Makefile).
This value limits the amount of data space the program will attempt to
allocate.  Code and static data space isn't counted, so the actual memory
needs for cjpeg or djpeg are typically 100 to 150Kb more than the max-memory
setting.  Larger max-memory settings reduce the amount of I/O needed to
process a large image, but too large a value can result in "insufficient
memory" failures.  On most Unix machines (and other systems with virtual
memory), just set DEFAULT_MAX_MEM to several million and forget it.  At the
other end of the spectrum, for MS-DOS machines you probably can't go much
above 300K to 400K.  (On MS-DOS the value refers to conventional memory only.
Extended/expanded memory is handled separately by jmemdos.c.)


BUILDING THE SOFTWARE
=====================

Now you should be able to compile the software.  Just say "make" (or

src/Source/LibJPEG/install.txt  view on Meta::CPAN

need to reduce MAX_ALLOC_CHUNK to a value that fits in type size_t.
Try adding "#define MAX_ALLOC_CHUNK 65520L" to jconfig.h.  A less likely
configuration error is "ALIGN_TYPE is wrong, please fix": defining ALIGN_TYPE
as long should take care of that one.

If the cjpeg test run fails with "Missing Huffman code table entry", it's a
good bet that you needed to define RIGHT_SHIFT_IS_UNSIGNED.  Go back to the
configuration step and run ckconfig.c.  (This is a good plan for any other
test failure, too.)

If you are using Unix (one-file) command line style on a non-Unix system,
it's a good idea to check that binary I/O through stdin/stdout actually
works.  You should get the same results from "djpeg <testorig.jpg >out.ppm"
as from "djpeg -outfile out.ppm testorig.jpg".  Note that the makefiles all
use the latter style and therefore do not exercise stdin/stdout!  If this
check fails, try recompiling with USE_SETMODE or USE_FDOPEN defined.
If it still doesn't work, better use two-file style.

If you chose a memory manager other than jmemnobs.c, you should test that
temporary-file usage works.  Try "djpeg -bmp -colors 256 -max 0 testorig.jpg"
and make sure its output matches testimg.bmp.  If you have any really large

src/Source/LibJPEG/install.txt  view on Meta::CPAN

such as 1-pass color quantization, are not exercised at all.  It's just a
quick test to give you some confidence that you haven't missed something
major.


INSTALLING THE SOFTWARE
=======================

Once you're done with the above steps, you can install the software by
copying the executable files (cjpeg, djpeg, jpegtran, rdjpgcom, and wrjpgcom)
to wherever you normally install programs.  On Unix systems, you'll also want
to put the man pages (cjpeg.1, djpeg.1, jpegtran.1, rdjpgcom.1, wrjpgcom.1)
in the man-page directory.  The pre-fab makefiles don't support this step
since there's such a wide variety of installation procedures on different
systems.

If you generated a Makefile with the "configure" script, you can just say
	make install
to install the programs and their man pages into the standard places.
(You'll probably need to be root to do this.)  We recommend first saying
	make -n install

src/Source/LibJPEG/install.txt  view on Meta::CPAN

HP-UX:

If you have HP-UX 7.05 or later with the "software development" C compiler,
you should run the compiler in ANSI mode.  If using the configure script,
say
	./configure CC='cc -Aa'
(or -Ae if you prefer).  If configuring by hand, use makefile.ansi and add
"-Aa" to the CFLAGS line in the makefile.

If you have a pre-7.05 system, or if you are using the non-ANSI C compiler
delivered with a minimum HP-UX system, then you must use makefile.unix
(and do NOT add -Aa); or just run configure without the CC option.

On HP 9000 series 800 machines, the HP C compiler is buggy in revisions prior
to A.08.07.  If you get complaints about "not a typedef name", you'll have to
use makefile.unix, or run configure without the CC option.


Macintosh, generic comments:

The supplied user-interface files (cjpeg.c, djpeg.c, etc) are set up to
provide a Unix-style command line interface.  You can use this interface on
the Mac by means of the ccommand() library routine provided by Metrowerks
CodeWarrior or Think C.  This is only appropriate for testing the library,
however; to make a user-friendly equivalent of cjpeg/djpeg you'd really want
to develop a Mac-style user interface.  There isn't a complete example
available at the moment, but there are some helpful starting points:
1. Sam Bushell's free "To JPEG" applet provides drag-and-drop conversion to
JPEG under System 7 and later.  This only illustrates how to use the
compression half of the library, but it does a very nice job of that part.
The CodeWarrior source code is available from http://www.pobox.com/~jsam.
2. Jim Brunner prepared a Mac-style user interface for both compression and

src/Source/LibJPEG/install.txt  view on Meta::CPAN

than available memory.  If you use any memory manager back end other than
jmemmac.c, we recommend replacing "malloc" and "free" by "NewPtr" and
"DisposePtr", because Mac C libraries often have peculiar implementations of
malloc/free.  (For instance, free() may not return the freed space to the
Mac Memory Manager.  This is undesirable for the IJG code because jmemmgr.c
already clumps space requests.)


Macintosh, Metrowerks CodeWarrior:

The Unix-command-line-style interface can be used by defining USE_CCOMMAND.
You'll also need to define TWO_FILE_COMMANDLINE to avoid stdin/stdout.
This means that when using the cjpeg/djpeg programs, you'll have to type the
input and output file names in the "Arguments" text-edit box, rather than
using the file radio buttons.  (Perhaps USE_FDOPEN or USE_SETMODE would
eliminate the problem, but I haven't heard from anyone who's tried it.)

On 680x0 Macs, Metrowerks defines type "double" as a 10-byte IEEE extended
float.  jmemmgr.c won't like this: it wants sizeof(ALIGN_TYPE) to be a power
of 2.  Add "#define ALIGN_TYPE long" to jconfig.h to eliminate the complaint.

src/Source/LibJPEG/install.txt  view on Meta::CPAN


Macintosh, Think C:

The documentation in Jim Brunner's "JPEG Convert" source code (see above)
includes detailed build instructions for Think C; it's probably somewhat
out of date for the current release, but may be helpful.

If you want to build the minimal command line version, proceed as follows.
You'll have to prepare project files for the programs; we don't include any
in the distribution since they are not text files.  Use the file lists in
any of the supplied makefiles as a guide.  Also add the ANSI and Unix C
libraries in a separate segment.  You may need to divide the JPEG files into
more than one segment; we recommend dividing compression and decompression
modules.  Define USE_CCOMMAND in jconfig.h so that the ccommand() routine is
called.  You must also define TWO_FILE_COMMANDLINE because stdin/stdout
don't handle binary data correctly.

On 680x0 Macs, Think C defines type "double" as a 12-byte IEEE extended float.
jmemmgr.c won't like this: it wants sizeof(ALIGN_TYPE) to be a power of 2.
Add "#define ALIGN_TYPE long" to jconfig.h to eliminate the complaint.

src/Source/LibJPEG/install.txt  view on Meta::CPAN

environment supplies adequate virtual memory, otherwise use jmemansi.c or
jmemname.c.

You'll still need to be careful about binary I/O through stdin/stdout.
See the last paragraph of the previous section.


MS-DOS, Borland C:

Be sure to convert all the source files to DOS text format (CR/LF newlines).
Although Borland C will often work OK with unmodified Unix (LF newlines)
source files, sometimes it will give bogus compile errors.
"Illegal character '#'" is the most common such error.  (This is true with
Borland C 3.1, but perhaps is fixed in newer releases.)

If you want one-file command line style, just undefine TWO_FILE_COMMANDLINE.
jconfig.bcc already includes #define USE_SETMODE to make this work.
(fdopen does not work correctly.)


MS-DOS, Microsoft C:

src/Source/LibJPEG/jerror.c  view on Meta::CPAN

/*
 * jerror.c
 *
 * Copyright (C) 1991-1998, Thomas G. Lane.
 * Modified 2012 by Guido Vollbeding.
 * This file is part of the Independent JPEG Group's software.
 * For conditions of distribution and use, see the accompanying README file.
 *
 * This file contains simple error-reporting and trace-message routines.
 * These are suitable for Unix-like systems and others where writing to
 * stderr is the right thing to do.  Many applications will want to replace
 * some or all of these routines.
 *
 * If you define USE_WINDOWS_MESSAGEBOX in jconfig.h or in the makefile,
 * you get a Windows-specific hack to display error messages in a dialog box.
 * It ain't much, but it beats dropping error messages into the bit bucket,
 * which is what happens to output to stderr under most Windows C compilers.
 *
 * These routines are used by both the compression and decompression code.
 */

src/Source/LibJPEG/jmemname.c  view on Meta::CPAN

#define READ_BINARY	"rb"
#define RW_BINARY	"w+b"
#endif
#endif


/*
 * Selection of a file name for a temporary file.
 * This is system-dependent!
 *
 * The code as given is suitable for most Unix systems, and it is easily
 * modified for most non-Unix systems.  Some notes:
 *  1.  The temp file is created in the directory named by TEMP_DIRECTORY.
 *      The default value is /usr/tmp, which is the conventional place for
 *      creating large temp files on Unix.  On other systems you'll probably
 *      want to change the file location.  You can do this by editing the
 *      #define, or (preferred) by defining TEMP_DIRECTORY in jconfig.h.
 *
 *  2.  If you need to change the file name as well as its location,
 *      you can override the TEMP_FILE_NAME macro.  (Note that this is
 *      actually a printf format string; it must contain %s and %d.)
 *      Few people should need to do this.
 *
 *  3.  mktemp() is used to ensure that multiple processes running
 *      simultaneously won't select the same file names.  If your system
 *      doesn't have mktemp(), define NO_MKTEMP to do it the hard way.
 *      (If you don't have <errno.h>, also define NO_ERRNO_H.)
 *
 *  4.  You probably want to define NEED_SIGNAL_CATCHER so that cjpeg.c/djpeg.c
 *      will cause the temp files to be removed if you stop the program early.
 */

#ifndef TEMP_DIRECTORY		/* can override from jconfig.h or Makefile */
#define TEMP_DIRECTORY  "/usr/tmp/" /* recommended setting for Unix */
#endif

static int next_file_num;	/* to distinguish among several temp files */

#ifdef NO_MKTEMP

#ifndef TEMP_FILE_NAME		/* can override from jconfig.h or Makefile */
#define TEMP_FILE_NAME  "%sJPG%03d.TMP"
#endif

src/Source/LibJPEG/jpegtran.c  view on Meta::CPAN

    }
    outfilename = argv[file_index+1];
  } else {
    if (file_index != argc-1) {
      fprintf(stderr, "%s: must name one input and one output file\n",
	      progname);
      usage();
    }
  }
#else
  /* Unix style: expect zero or one file name */
  if (file_index < argc-1) {
    fprintf(stderr, "%s: only one input file\n", progname);
    usage();
  }
#endif /* TWO_FILE_COMMANDLINE */

  /* Open the input file. */
  if (file_index < argc) {
    if ((fp = fopen(argv[file_index], READ_BINARY)) == NULL) {
      fprintf(stderr, "%s: can't open %s for reading\n", progname, argv[file_index]);

src/Source/LibJPEG/libjpeg.txt  view on Meta::CPAN

	...
	if ((outfile = fopen(filename, "wb")) == NULL) {
	    fprintf(stderr, "can't open %s\n", filename);
	    exit(1);
	}
	jpeg_stdio_dest(&cinfo, outfile);

where the last line invokes the standard destination module.

WARNING: it is critical that the binary compressed data be delivered to the
output file unchanged.  On non-Unix systems the stdio library may perform
newline translation or otherwise corrupt binary data.  To suppress this
behavior, you may need to use a "b" option to fopen (as shown above), or use
setmode() or another routine to put the stdio stream in binary mode.  See
cjpeg.c and djpeg.c for code that has been found to work on many systems.

You can select the data destination after setting other parameters (step 3),
if that's more convenient.  You may not change the destination between
calling jpeg_start_compress() and jpeg_finish_compress().


src/Source/LibJPEG/libjpeg.txt  view on Meta::CPAN

	...
	if ((infile = fopen(filename, "rb")) == NULL) {
	    fprintf(stderr, "can't open %s\n", filename);
	    exit(1);
	}
	jpeg_stdio_src(&cinfo, infile);

where the last line invokes the standard source module.

WARNING: it is critical that the binary compressed data be read unchanged.
On non-Unix systems the stdio library may perform newline translation or
otherwise corrupt binary data.  To suppress this behavior, you may need to use
a "b" option to fopen (as shown above), or use setmode() or another routine to
put the stdio stream in binary mode.  See cjpeg.c and djpeg.c for code that
has been found to work on many systems.

You may not change the data source between calling jpeg_read_header() and
jpeg_finish_decompress().  If you wish to read a series of JPEG images from
a single source file, you should repeat the jpeg_read_header() to
jpeg_finish_decompress() sequence without reinitializing either the JPEG
object or the data source module; this prevents buffered input data from

src/Source/LibJPEG/libjpeg.txt  view on Meta::CPAN

The previous discussion of aborting compression cycles applies here too.


Mechanics of usage: include files, linking, etc
-----------------------------------------------

Applications using the JPEG library should include the header file jpeglib.h
to obtain declarations of data types and routines.  Before including
jpeglib.h, include system headers that define at least the typedefs FILE and
size_t.  On ANSI-conforming systems, including <stdio.h> is sufficient; on
older Unix systems, you may need <sys/types.h> to define size_t.

If the application needs to refer to individual JPEG library error codes, also
include jerror.h to define those symbols.

jpeglib.h indirectly includes the files jconfig.h and jmorecfg.h.  If you are
installing the JPEG header files in a system directory, you will want to
install all four files: jpeglib.h, jerror.h, jconfig.h, jmorecfg.h.

The most convenient way to include the JPEG code into your executable program
is to prepare a library file ("libjpeg.a", or a corresponding name on non-Unix
machines) and reference it at your link step.  If you use only half of the
library (only compression or only decompression), only that much code will be
included from the library, unless your linker is hopelessly brain-damaged.
The supplied makefiles build libjpeg.a automatically (see install.txt).

While you can build the JPEG library as a shared library if the whim strikes
you, we don't really recommend it.  The trouble with shared libraries is that
at some point you'll probably try to substitute a new version of the library
without recompiling the calling applications.  That generally doesn't work
because the parameter struct declarations usually change with each new

src/Source/LibJPEG/libjpeg.txt  view on Meta::CPAN

"APP0" through "APP15" (application) to hold application-specific data.
Unfortunately, the use of these markers is not specified by the standard.
COM markers are fairly widely used to hold user-supplied text.  The JFIF file
format spec uses APP0 markers with specified initial strings to hold certain
data.  Adobe applications use APP14 markers beginning with the string "Adobe"
for miscellaneous data.  Other APPn markers are rarely seen, but might
contain almost anything.

If you wish to store user-supplied text, we recommend you use COM markers
and place readable 7-bit ASCII text in them.  Newline conventions are not
standardized --- expect to find LF (Unix style), CR/LF (DOS style), or CR
(Mac style).  A robust COM reader should be able to cope with random binary
garbage, including nulls, since some applications generate COM markers
containing non-ASCII junk.  (But yours should not be one of them.)

For program-supplied data, use an APPn marker, and be sure to begin it with an
identifying string so that you can tell whether the marker is actually yours.
It's probably best to avoid using APP0 or APP14 for any private markers.
(NOTE: the upcoming SPIFF standard will use APP8 markers; we recommend you
not use APP8 markers for any private purposes, either.)

src/Source/LibJPEG/libjpeg.txt  view on Meta::CPAN

with "strip" buffers that are as wide as the image but just a few rows high.
Some operating modes (eg, two-pass color quantization) require full-image
buffers.  Such buffers are treated as "virtual arrays": only the current strip
need be in memory, and the rest can be swapped out to a temporary file.

If you use the simplest memory manager back end (jmemnobs.c), then no
temporary files are used; virtual arrays are simply malloc()'d.  Images bigger
than memory can be processed only if your system supports virtual memory.
The other memory manager back ends support temporary files of various flavors
and thus work in machines without virtual memory.  They may also be useful on
Unix machines if you need to process images that exceed available swap space.

When using temporary files, the library will make the in-memory buffers for
its virtual arrays just big enough to stay within a "maximum memory" setting.
Your application can set this limit by setting cinfo->mem->max_memory_to_use
after creating the JPEG object.  (Of course, there is still a minimum size for
the buffers, so the max-memory setting is effective only if it is bigger than
the minimum space needed.)  If you allocate any large structures yourself, you
must allocate them before jpeg_start_compress() or jpeg_start_decompress() in
order to have them counted against the max memory limit.  Also keep in mind
that space allocated with alloc_small() is ignored, on the assumption that

src/Source/LibJPEG/rdbmp.c  view on Meta::CPAN

 * Modified 2009-2010 by Guido Vollbeding.
 * This file is part of the Independent JPEG Group's software.
 * For conditions of distribution and use, see the accompanying README file.
 *
 * This file contains routines to read input images in Microsoft "BMP"
 * format (MS Windows 3.x, OS/2 1.x, and OS/2 2.x flavors).
 * Currently, only 8-bit and 24-bit images are supported, not 1-bit or
 * 4-bit (feeding such low-depth images into JPEG would be silly anyway).
 * Also, we don't support RLE-compressed files.
 *
 * These routines may need modification for non-Unix environments or
 * specialized applications.  As they stand, they assume input from
 * an ordinary stdio stream.  They further assume that reading begins
 * at the start of the file; start_input may need work if the
 * user interface has already read some data (e.g., to determine that
 * the file is indeed BMP format).
 *
 * This code contributed by James Arthur Boucher.
 */

#include "cdjpeg.h"		/* Common decls for cjpeg/djpeg applications */

src/Source/LibJPEG/rdjpgcom.c  view on Meta::CPAN

    arg++;			/* advance over '-' */
    if (keymatch(arg, "verbose", 1)) {
      verbose++;
    } else if (keymatch(arg, "raw", 1)) {
      raw = 1;
    } else
      usage();
  }

  /* Open the input file. */
  /* Unix style: expect zero or one file name */
  if (argn < argc-1) {
    fprintf(stderr, "%s: only one input file\n", progname);
    usage();
  }
  if (argn < argc) {
    if ((infile = fopen(argv[argn], READ_BINARY)) == NULL) {
      fprintf(stderr, "%s: can't open %s\n", progname, argv[argn]);
      exit(EXIT_FAILURE);
    }
  } else {

src/Source/LibJPEG/rdppm.c  view on Meta::CPAN

 * Copyright (C) 1991-1997, Thomas G. Lane.
 * Modified 2009 by Bill Allombert, Guido Vollbeding.
 * This file is part of the Independent JPEG Group's software.
 * For conditions of distribution and use, see the accompanying README file.
 *
 * This file contains routines to read input images in PPM/PGM format.
 * The extended 2-byte-per-sample raw PPM/PGM formats are supported.
 * The PBMPLUS library is NOT required to compile this software
 * (but it is highly useful as a set of PPM image manipulation programs).
 *
 * These routines may need modification for non-Unix environments or
 * specialized applications.  As they stand, they assume input from
 * an ordinary stdio stream.  They further assume that reading begins
 * at the start of the file; start_input may need work if the
 * user interface has already read some data (e.g., to determine that
 * the file is indeed PPM format).
 */

#include "cdjpeg.h"		/* Common decls for cjpeg/djpeg applications */

#ifdef PPM_SUPPORTED

src/Source/LibJPEG/rdrle.c  view on Meta::CPAN

/*
 * rdrle.c
 *
 * Copyright (C) 1991-1996, Thomas G. Lane.
 * This file is part of the Independent JPEG Group's software.
 * For conditions of distribution and use, see the accompanying README file.
 *
 * This file contains routines to read input images in Utah RLE format.
 * The Utah Raster Toolkit library is required (version 3.1 or later).
 *
 * These routines may need modification for non-Unix environments or
 * specialized applications.  As they stand, they assume input from
 * an ordinary stdio stream.  They further assume that reading begins
 * at the start of the file; start_input may need work if the
 * user interface has already read some data (e.g., to determine that
 * the file is indeed RLE format).
 *
 * Based on code contributed by Mike Lijewski,
 * with updates from Robert Hutchinson.
 */

src/Source/LibJPEG/rdtarga.c  view on Meta::CPAN

/*
 * rdtarga.c
 *
 * Copyright (C) 1991-1996, Thomas G. Lane.
 * This file is part of the Independent JPEG Group's software.
 * For conditions of distribution and use, see the accompanying README file.
 *
 * This file contains routines to read input images in Targa format.
 *
 * These routines may need modification for non-Unix environments or
 * specialized applications.  As they stand, they assume input from
 * an ordinary stdio stream.  They further assume that reading begins
 * at the start of the file; start_input may need work if the
 * user interface has already read some data (e.g., to determine that
 * the file is indeed Targa format).
 *
 * Based on code contributed by Lee Daniel Crocker.
 */

#include "cdjpeg.h"		/* Common decls for cjpeg/djpeg applications */

src/Source/LibJPEG/usage.txt  view on Meta::CPAN

USAGE instructions for the Independent JPEG Group's JPEG software
=================================================================

This file describes usage of the JPEG conversion programs cjpeg and djpeg,
as well as the utility programs jpegtran, rdjpgcom and wrjpgcom.  (See
the other documentation files if you wish to use the JPEG library within
your own programs.)

If you are on a Unix machine you may prefer to read the Unix-style manual
pages in files cjpeg.1, djpeg.1, jpegtran.1, rdjpgcom.1, wrjpgcom.1.


INTRODUCTION

These programs implement JPEG image encoding, decoding, and transcoding.
JPEG (pronounced "jay-peg") is a standardized compression method for
full-color and gray-scale images.


GENERAL USAGE

We provide two programs, cjpeg to compress an image file into JPEG format,
and djpeg to decompress a JPEG file back into a conventional image format.

On Unix-like systems, you say:
	cjpeg [switches] [imagefile] >jpegfile
or
	djpeg [switches] [jpegfile]  >imagefile
The programs read the specified input file, or standard input if none is
named.  They always write to standard output (with trace/error messages to
standard error).  These conventions are handy for piping images between
programs.

On most non-Unix systems, you say:
	cjpeg [switches] imagefile jpegfile
or
	djpeg [switches] jpegfile  imagefile
i.e., both the input and output files are named on the command line.  This
style is a little more foolproof, and it loses no functionality if you don't
have pipes.  (You can get this style on Unix too, if you prefer, by defining
TWO_FILE_COMMANDLINE when you compile the programs; see install.txt.)

You can also say:
	cjpeg [switches] -outfile jpegfile  imagefile
or
	djpeg [switches] -outfile imagefile  jpegfile
This syntax works on all systems, so it is useful for scripts.

The currently supported image file formats are: PPM (PBMPLUS color format),
PGM (PBMPLUS gray-scale format), BMP, Targa, and RLE (Utah Raster Toolkit

src/Source/LibJPEG/usage.txt  view on Meta::CPAN

from landscape to portrait format by rotation.

jpegtran works by rearranging the compressed data (DCT coefficients), without
ever fully decoding the image.  Therefore, its transformations are lossless:
there is no image degradation at all, which would not be true if you used
djpeg followed by cjpeg to accomplish the same conversion.  But by the same
token, jpegtran cannot perform lossy operations such as changing the image
quality.

jpegtran uses a command line syntax similar to cjpeg or djpeg.
On Unix-like systems, you say:
	jpegtran [switches] [inputfile] >outputfile
On most non-Unix systems, you say:
	jpegtran [switches] inputfile outputfile
where both the input and output files are JPEG files.

To specify the coded JPEG representation used in the output file,
jpegtran accepts a subset of the switches recognized by cjpeg:
	-optimize	Perform optimization of entropy encoding parameters.
	-progressive	Create progressive JPEG file.
	-arithmetic	Use arithmetic coding.
	-restart N	Emit a JPEG restart marker every N MCU rows, or every
			N MCU blocks if "B" is attached to the number.

src/Source/LibJPEG/usage.txt  view on Meta::CPAN

the JPEG file is read from standard input.  (This may not work on some
operating systems, if binary data can't be read from stdin.)

wrjpgcom adds a COM block, containing text you provide, to a JPEG file.
Ordinarily, the COM block is added after any existing COM blocks, but you
can delete the old COM blocks if you wish.  wrjpgcom produces a new JPEG
file; it does not modify the input file.  DO NOT try to overwrite the input
file by directing wrjpgcom's output back into it; on most systems this will
just destroy your file.

The command line syntax for wrjpgcom is similar to cjpeg's.  On Unix-like
systems, it is
	wrjpgcom [switches] [inputfilename]
The output file is written to standard output.  The input file comes from
the named file, or from standard input if no input file is named.

On most non-Unix systems, the syntax is
	wrjpgcom [switches] inputfilename outputfilename
where both input and output file names must be given explicitly.

wrjpgcom understands three switches:
	-replace		 Delete any existing COM blocks from the file.
	-comment "Comment text"	 Supply new COM text on command line.
	-cfile name		 Read text for new COM block from named file.
(Switch names can be abbreviated.)  If you have only one line of comment text
to add, you can provide it on the command line with -comment.  The comment
text must be surrounded with quotes so that it is treated as a single

src/Source/LibJPEG/wrbmp.c  view on Meta::CPAN

 *
 * Copyright (C) 1994-1996, Thomas G. Lane.
 * This file is part of the Independent JPEG Group's software.
 * For conditions of distribution and use, see the accompanying README file.
 *
 * This file contains routines to write output images in Microsoft "BMP"
 * format (MS Windows 3.x and OS/2 1.x flavors).
 * Either 8-bit colormapped or 24-bit full-color format can be written.
 * No compression is supported.
 *
 * These routines may need modification for non-Unix environments or
 * specialized applications.  As they stand, they assume output to
 * an ordinary stdio stream.
 *
 * This code contributed by James Arthur Boucher.
 */

#include "cdjpeg.h"		/* Common decls for cjpeg/djpeg applications */

#ifdef BMP_SUPPORTED

src/Source/LibJPEG/wrgif.c  view on Meta::CPAN

 * For conditions of distribution and use, see the accompanying README file.
 *
 * This file contains routines to write output images in GIF format.
 *
 **************************************************************************
 * NOTE: to avoid entanglements with Unisys' patent on LZW compression,   *
 * this code has been modified to output "uncompressed GIF" files.        *
 * There is no trace of the LZW algorithm in this file.                   *
 **************************************************************************
 *
 * These routines may need modification for non-Unix environments or
 * specialized applications.  As they stand, they assume output to
 * an ordinary stdio stream.
 */

/*
 * This code is loosely based on ppmtogif from the PBMPLUS distribution
 * of Feb. 1991.  That file contains the following copyright notice:
 *    Based on GIFENCODE by David Rowley <mgardi@watdscu.waterloo.edu>.
 *    Lempel-Ziv compression based on "compress" by Spencer W. Thomas et al.
 *    Copyright (C) 1989 by Jef Poskanzer.



( run in 2.119 seconds using v1.01-cache-2.11-cpan-64ef6c95b5d )