@WITH_MODULES_TRUE@am_coders_pdb_la_rpath = -rpath $(codersdir)
coders_pdf_la_DEPENDENCIES = $(MAGICKCORE_LIBS) $(am__DEPENDENCIES_1) \
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
- $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
- $(am__DEPENDENCIES_1)
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
am_coders_pdf_la_OBJECTS = coders/coders_pdf_la-pdf.lo
coders_pdf_la_OBJECTS = $(am_coders_pdf_la_OBJECTS)
coders_pdf_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
@WITH_MODULES_TRUE@am_coders_ps_la_rpath = -rpath $(codersdir)
coders_ps2_la_DEPENDENCIES = $(MAGICKCORE_LIBS) $(am__DEPENDENCIES_1) \
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
- $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+ $(am__DEPENDENCIES_1)
am_coders_ps2_la_OBJECTS = coders/coders_ps2_la-ps2.lo
coders_ps2_la_OBJECTS = $(am_coders_ps2_la_OBJECTS)
coders_ps2_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
@WITH_MODULES_TRUE@am_coders_ps2_la_rpath = -rpath $(codersdir)
coders_ps3_la_DEPENDENCIES = $(MAGICKCORE_LIBS) $(am__DEPENDENCIES_1) \
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
- $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+ $(am__DEPENDENCIES_1)
am_coders_ps3_la_OBJECTS = coders/coders_ps3_la-ps3.lo
coders_ps3_la_OBJECTS = $(am_coders_ps3_la_OBJECTS)
coders_ps3_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
coders_pdf_la_SOURCES = coders/pdf.c
coders_pdf_la_CPPFLAGS = $(MODULE_EXTRA_CPPFLAGS)
coders_pdf_la_LDFLAGS = $(MODULECOMMONFLAGS)
-coders_pdf_la_LIBADD = $(MAGICKCORE_LIBS) $(TIFF_LIBS) $(JBIG_LIBS) $(JPEG_LIBS) $(ZLIB_LIBS) $(GS_LIBS) $(MATH_LIBS)
+coders_pdf_la_LIBADD = $(MAGICKCORE_LIBS) $(JBIG_LIBS) $(JPEG_LIBS) $(ZLIB_LIBS) $(GS_LIBS) $(MATH_LIBS)
# PICT coder module
coders_pict_la_SOURCES = coders/pict.c
coders_ps2_la_SOURCES = coders/ps2.c
coders_ps2_la_CPPFLAGS = $(MODULE_EXTRA_CPPFLAGS)
coders_ps2_la_LDFLAGS = $(MODULECOMMONFLAGS)
-coders_ps2_la_LIBADD = $(MAGICKCORE_LIBS) $(TIFF_LIBS) $(JBIG_LIBS) $(JPEG_LIBS) $(ZLIB_LIBS) $(MATH_LIBS)
+coders_ps2_la_LIBADD = $(MAGICKCORE_LIBS) $(JBIG_LIBS) $(JPEG_LIBS) $(ZLIB_LIBS) $(MATH_LIBS)
# PS3 coder module
coders_ps3_la_SOURCES = coders/ps3.c
coders_ps3_la_CPPFLAGS = $(MODULE_EXTRA_CPPFLAGS)
coders_ps3_la_LDFLAGS = $(MODULECOMMONFLAGS)
-coders_ps3_la_LIBADD = $(MAGICKCORE_LIBS) $(TIFF_LIBS) $(JBIG_LIBS) $(JPEG_LIBS) $(ZLIB_LIBS) $(MATH_LIBS)
+coders_ps3_la_LIBADD = $(MAGICKCORE_LIBS) $(JBIG_LIBS) $(JPEG_LIBS) $(ZLIB_LIBS) $(MATH_LIBS)
# PSD coder module
coders_psd_la_SOURCES = coders/psd.c
coders_pdf_la_SOURCES = coders/pdf.c
coders_pdf_la_CPPFLAGS = $(MODULE_EXTRA_CPPFLAGS)
coders_pdf_la_LDFLAGS = $(MODULECOMMONFLAGS)
-coders_pdf_la_LIBADD = $(MAGICKCORE_LIBS) $(TIFF_LIBS) $(JBIG_LIBS) $(JPEG_LIBS) $(ZLIB_LIBS) $(GS_LIBS) $(MATH_LIBS)
+coders_pdf_la_LIBADD = $(MAGICKCORE_LIBS) $(JBIG_LIBS) $(JPEG_LIBS) $(ZLIB_LIBS) $(GS_LIBS) $(MATH_LIBS)
# PICT coder module
coders_pict_la_SOURCES = coders/pict.c
coders_ps2_la_SOURCES = coders/ps2.c
coders_ps2_la_CPPFLAGS = $(MODULE_EXTRA_CPPFLAGS)
coders_ps2_la_LDFLAGS = $(MODULECOMMONFLAGS)
-coders_ps2_la_LIBADD = $(MAGICKCORE_LIBS) $(TIFF_LIBS) $(JBIG_LIBS) $(JPEG_LIBS) $(ZLIB_LIBS) $(MATH_LIBS)
+coders_ps2_la_LIBADD = $(MAGICKCORE_LIBS) $(JBIG_LIBS) $(JPEG_LIBS) $(ZLIB_LIBS) $(MATH_LIBS)
# PS3 coder module
coders_ps3_la_SOURCES = coders/ps3.c
coders_ps3_la_CPPFLAGS = $(MODULE_EXTRA_CPPFLAGS)
coders_ps3_la_LDFLAGS = $(MODULECOMMONFLAGS)
-coders_ps3_la_LIBADD = $(MAGICKCORE_LIBS) $(TIFF_LIBS) $(JBIG_LIBS) $(JPEG_LIBS) $(ZLIB_LIBS) $(MATH_LIBS)
+coders_ps3_la_LIBADD = $(MAGICKCORE_LIBS) $(JBIG_LIBS) $(JPEG_LIBS) $(ZLIB_LIBS) $(MATH_LIBS)
# PSD coder module
coders_psd_la_SOURCES = coders/psd.c
#include "magick/transform.h"
#include "magick/utility.h"
#include "magick/module.h"
+\f
+/*
+ Define declarations.
+*/
#if defined(MAGICKCORE_TIFF_DELEGATE)
-#if defined(MAGICKCORE_HAVE_TIFFCONF_H)
-#include "tiffconf.h"
-#endif
-#include "tiffio.h"
#define CCITTParam "-1"
#else
#define CCITTParam "0"
return(buffer);
}
-#if defined(MAGICKCORE_TIFF_DELEGATE)
static MagickBooleanType Huffman2DEncodeImage(const ImageInfo *image_info,
Image *image,Image *inject_image)
{
- char
- filename[MaxTextExtent];
-
- FILE
- *file;
-
Image
- *huffman_image;
+ *group4_image;
ImageInfo
*write_info;
- int
- unique_file;
-
MagickBooleanType
status;
- register long
- i;
-
- ssize_t
- count;
-
- TIFF
- *tiff;
-
- uint16
- fillorder;
-
- uint32
- *byte_count,
- strip_size;
+ size_t
+ length;
unsigned char
- *buffer;
+ *group4;
- /*
- Write image as CCITTFax4 TIFF image to a temporary file.
- */
- assert(image_info != (const ImageInfo *) NULL);
- assert(image_info->signature == MagickSignature);
- assert(image != (Image *) NULL);
- assert(image->signature == MagickSignature);
- if (image->debug != MagickFalse)
- (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
- assert(inject_image != (Image *) NULL);
- assert(inject_image->signature == MagickSignature);
- huffman_image=CloneImage(inject_image,0,0,MagickTrue,&image->exception);
- if (huffman_image == (Image *) NULL)
- return(MagickFalse);
- file=(FILE *) NULL;
- unique_file=AcquireUniqueFileResource(filename);
- if (unique_file != -1)
- file=fdopen(unique_file,"wb");
- if ((unique_file == -1) || (file == (FILE *) NULL))
- {
- ThrowFileException(&image->exception,FileOpenError,
- "UnableToCreateTemporaryFile",filename);
- return(MagickFalse);
- }
- (void) FormatMagickString(huffman_image->filename,MaxTextExtent,"tiff:%s",
- filename);
write_info=CloneImageInfo(image_info);
- SetImageInfoFile(write_info,file);
- write_info->compression=Group4Compression;
- write_info->type=BilevelType;
- (void) SetImageOption(write_info,"quantum:polarity","min-is-white");
- status=WriteImage(write_info,huffman_image);
- (void) fflush(file);
+ (void) CopyMagickString(write_info->filename,"GROUP4:",MaxTextExtent);
+ (void) CopyMagickString(write_info->magick,"GROUP4",MaxTextExtent);
+ group4_image=CloneImage(inject_image,0,0,MagickTrue,&image->exception);
+ if (group4_image == (Image *) NULL)
+ return(MagickFalse);
+ group4=(unsigned char *) ImageToBlob(write_info,group4_image,&length,
+ &image->exception);
+ group4_image=DestroyImage(group4_image);
+ if (group4 == (unsigned char *) NULL)
+ return(MagickFalse);
write_info=DestroyImageInfo(write_info);
- if (status == MagickFalse)
- {
- (void) RelinquishUniqueFileResource(filename);
- return(MagickFalse);
- }
- tiff=TIFFOpen(filename,"rb");
- if (tiff == (TIFF *) NULL)
- {
- huffman_image=DestroyImage(huffman_image);
- (void) fclose(file);
- (void) RelinquishUniqueFileResource(filename);
- ThrowFileException(&image->exception,FileOpenError,"UnableToOpenFile",
- image_info->filename);
- return(MagickFalse);
- }
- /*
- Allocate raw strip buffer.
- */
- byte_count=0;
- (void) TIFFGetField(tiff,TIFFTAG_STRIPBYTECOUNTS,&byte_count);
- strip_size=byte_count[0];
- for (i=1; i < (long) TIFFNumberOfStrips(tiff); i++)
- if (byte_count[i] > strip_size)
- strip_size=byte_count[i];
- buffer=(unsigned char *) AcquireQuantumMemory((size_t) strip_size,
- sizeof(*buffer));
- if (buffer == (unsigned char *) NULL)
- {
- TIFFClose(tiff);
- huffman_image=DestroyImage(huffman_image);
- (void) fclose(file);
- (void) RelinquishUniqueFileResource(filename);
- ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed",
- image_info->filename);
- }
- /*
- Compress runlength encoded to 2D Huffman pixels.
- */
- fillorder=FILLORDER_LSB2MSB;
- (void) TIFFGetFieldDefaulted(tiff,TIFFTAG_FILLORDER,&fillorder);
- for (i=0; i < (long) TIFFNumberOfStrips(tiff); i++)
- {
- count=(ssize_t) TIFFReadRawStrip(tiff,(uint32) i,buffer,(long)
- byte_count[i]);
- if (fillorder == FILLORDER_LSB2MSB)
- TIFFReverseBits(buffer,(unsigned long) count);
- (void) WriteBlob(image,(size_t) count,buffer);
- }
- buffer=(unsigned char *) RelinquishMagickMemory(buffer);
- TIFFClose(tiff);
- huffman_image=DestroyImage(huffman_image);
- (void) fclose(file);
- (void) RelinquishUniqueFileResource(filename);
- return(MagickTrue);
-}
-#else
-static MagickBooleanType Huffman2DEncodeImage(const ImageInfo *image_info,
- Image *image,Image *inject_image)
-{
- assert(image_info != (const ImageInfo *) NULL);
- assert(image_info->signature == MagickSignature);
- assert(image != (Image *) NULL);
- assert(image->signature == MagickSignature);
- if (image->debug != MagickFalse)
- (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
- assert(inject_image != (Image *) NULL);
- assert(inject_image->signature == MagickSignature);
- (void) ThrowMagickException(&image->exception,GetMagickModule(),
- MissingDelegateError,"DelegateLibrarySupportNotBuiltIn","`%s' (TIFF)",
- image->filename);
- return(MagickFalse);
+ if (WriteBlob(image,length,group4) != (ssize_t) length)
+ status=MagickFalse;
+ group4=(unsigned char *) RelinquishMagickMemory(group4);
+ return(status);
}
-#endif
static MagickBooleanType WritePDFImage(const ImageInfo *image_info,Image *image)
{
MaxTextExtent);
(void) WriteBlobString(image,buffer);
(void) FormatMagickString(buffer,MaxTextExtent,"/DecodeParms [ << "
- "/K %s /BlackIs1 true /Columns %ld /Rows %ld >> ]\n",CCITTParam,
+ "/K %s /BlackIs1 false /Columns %ld /Rows %ld >> ]\n",CCITTParam,
image->columns,image->rows);
break;
}
MaxTextExtent);
(void) WriteBlobString(image,buffer);
(void) FormatMagickString(buffer,MaxTextExtent,"/DecodeParms [ << "
- "/K %s /BlackIs1 true /Columns %lu /Rows %lu >> ]\n",CCITTParam,
+ "/K %s /BlackIs1 false /Columns %lu /Rows %lu >> ]\n",CCITTParam,
tile_image->columns,tile_image->rows);
break;
}
#include "magick/string_.h"
#include "magick/module.h"
#include "magick/utility.h"
+\f
+/*
+ Define declarations.
+*/
#if defined(MAGICKCORE_TIFF_DELEGATE)
-#if defined(MAGICKCORE_HAVE_TIFFCONF_H)
-#include "tiffconf.h"
-#endif
-#include "tiffio.h"
#define CCITTParam "-1"
#else
#define CCITTParam "0"
%
*/
-#if defined(MAGICKCORE_TIFF_DELEGATE)
static MagickBooleanType Huffman2DEncodeImage(const ImageInfo *image_info,
Image *image,Image *inject_image)
{
- char
- filename[MaxTextExtent];
-
- FILE
- *file;
-
Image
- *huffman_image;
+ *group4_image;
ImageInfo
*write_info;
- int
- unique_file;
-
MagickBooleanType
status;
- register long
- i;
-
- ssize_t
- count;
-
- TIFF
- *tiff;
-
- uint16
- fillorder;
-
- uint32
- *byte_count,
- strip_size;
+ size_t
+ length;
unsigned char
- *buffer;
+ *group4;
- /*
- Write image as CCITTFax4 TIFF image to a temporary file.
- */
- assert(image_info != (const ImageInfo *) NULL);
- assert(image_info->signature == MagickSignature);
- assert(image != (Image *) NULL);
- assert(image->signature == MagickSignature);
- if (image->debug != MagickFalse)
- (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
- assert(inject_image != (Image *) NULL);
- assert(inject_image->signature == MagickSignature);
- huffman_image=CloneImage(inject_image,0,0,MagickTrue,&image->exception);
- if (huffman_image == (Image *) NULL)
- return(MagickFalse);
- file=(FILE *) NULL;
- unique_file=AcquireUniqueFileResource(filename);
- if (unique_file != -1)
- file=fdopen(unique_file,"wb");
- if ((unique_file == -1) || (file == (FILE *) NULL))
- {
- ThrowFileException(&image->exception,FileOpenError,
- "UnableToCreateTemporaryFile",filename);
- return(MagickFalse);
- }
- (void) FormatMagickString(huffman_image->filename,MaxTextExtent,"tiff:%s",
- filename);
write_info=CloneImageInfo(image_info);
- SetImageInfoFile(write_info,file);
- write_info->compression=Group4Compression;
- write_info->type=BilevelType;
- (void) SetImageOption(write_info,"quantum:polarity","min-is-white");
- status=WriteImage(write_info,huffman_image);
- (void) fflush(file);
+ (void) CopyMagickString(write_info->filename,"GROUP4:",MaxTextExtent);
+ (void) CopyMagickString(write_info->magick,"GROUP4",MaxTextExtent);
+ group4_image=CloneImage(inject_image,0,0,MagickTrue,&image->exception);
+ if (group4_image == (Image *) NULL)
+ return(MagickFalse);
+ group4=(unsigned char *) ImageToBlob(write_info,group4_image,&length,
+ &image->exception);
+ group4_image=DestroyImage(group4_image);
+ if (group4 == (unsigned char *) NULL)
+ return(MagickFalse);
write_info=DestroyImageInfo(write_info);
- if (status == MagickFalse)
- {
- (void) RelinquishUniqueFileResource(filename);
- return(MagickFalse);
- }
- tiff=TIFFOpen(filename,"rb");
- if (tiff == (TIFF *) NULL)
- {
- huffman_image=DestroyImage(huffman_image);
- (void) fclose(file);
- (void) RelinquishUniqueFileResource(filename);
- ThrowFileException(&image->exception,FileOpenError,"UnableToOpenFile",
- image_info->filename);
- return(MagickFalse);
- }
- /*
- Allocate raw strip buffer.
- */
- byte_count=0;
- (void) TIFFGetField(tiff,TIFFTAG_STRIPBYTECOUNTS,&byte_count);
- strip_size=byte_count[0];
- for (i=1; i < (long) TIFFNumberOfStrips(tiff); i++)
- if (byte_count[i] > strip_size)
- strip_size=byte_count[i];
- buffer=(unsigned char *) AcquireQuantumMemory((size_t) strip_size,
- sizeof(*buffer));
- if (buffer == (unsigned char *) NULL)
- {
- TIFFClose(tiff);
- huffman_image=DestroyImage(huffman_image);
- (void) fclose(file);
- (void) RelinquishUniqueFileResource(filename);
- ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed",
- image_info->filename);
- }
- /*
- Compress runlength encoded to 2D Huffman pixels.
- */
- fillorder=FILLORDER_LSB2MSB;
- (void) TIFFGetFieldDefaulted(tiff,TIFFTAG_FILLORDER,&fillorder);
- for (i=0; i < (long) TIFFNumberOfStrips(tiff); i++)
- {
- count=(ssize_t) TIFFReadRawStrip(tiff,(uint32) i,buffer,(long)
- byte_count[i]);
- if (fillorder == FILLORDER_LSB2MSB)
- TIFFReverseBits(buffer,(unsigned long) count);
- (void) WriteBlob(image,(size_t) count,buffer);
- }
- buffer=(unsigned char *) RelinquishMagickMemory(buffer);
- TIFFClose(tiff);
- huffman_image=DestroyImage(huffman_image);
- (void) fclose(file);
- (void) RelinquishUniqueFileResource(filename);
- return(MagickTrue);
+ if (WriteBlob(image,length,group4) != (ssize_t) length)
+ status=MagickFalse;
+ group4=(unsigned char *) RelinquishMagickMemory(group4);
+ return(status);
}
-#else
-static MagickBooleanType Huffman2DEncodeImage(const ImageInfo *image_info,
- Image *image,Image *inject_image)
-{
- assert(image_info != (const ImageInfo *) NULL);
- assert(image_info->signature == MagickSignature);
- assert(image != (Image *) NULL);
- assert(image->signature == MagickSignature);
- if (image->debug != MagickFalse)
- (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
- assert(inject_image != (Image *) NULL);
- assert(inject_image->signature == MagickSignature);
- (void) ThrowMagickException(&image->exception,GetMagickModule(),
- MissingDelegateError,"DelegateLibrarySupportNotBuiltIn","`%s' (TIFF)",
- image->filename);
- return(MagickFalse);
-}
-#endif
static MagickBooleanType WritePS2Image(const ImageInfo *image_info,Image *image)
{
" /Decode [0 1 0 1 0 1]",
" /ImageMatrix [columns 0 0 rows neg 0 rows]",
" compression 0 gt",
- " { /DataSource pixel_stream /%s filter }",
- " { /DataSource pixel_stream /%s filter } ifelse",
+ " { /DataSource pixel_stream %s }",
+ " { /DataSource pixel_stream %s } ifelse",
" >> image",
" }",
" {",
" /Decode [1 0 1 0 1 0 1 0]",
" /ImageMatrix [columns 0 0 rows neg 0 rows]",
" compression 0 gt",
- " { /DataSource pixel_stream /%s filter }",
- " { /DataSource pixel_stream /%s filter } ifelse",
+ " { /DataSource pixel_stream %s }",
+ " { /DataSource pixel_stream %s } ifelse",
" >> image",
" } ifelse",
"} bind def",
" /Decode [0 1]",
" /ImageMatrix [columns 0 0 rows neg 0 rows]",
" compression 0 gt",
- " { /DataSource pixel_stream /%s filter }",
+ " { /DataSource pixel_stream %s }",
" {",
- " /DataSource pixel_stream /%s filter",
+ " /DataSource pixel_stream %s",
" <<",
" /K "CCITTParam,
" /Columns columns",
" /Decode [0 255]",
" /ImageMatrix [columns 0 0 rows neg 0 rows]",
" compression 0 gt",
- " { /DataSource pixel_stream /%s filter }",
- " { /DataSource pixel_stream /%s filter } ifelse",
+ " { /DataSource pixel_stream %s }",
+ " { /DataSource pixel_stream %s } ifelse",
" >> image",
" } ifelse",
"} bind def",
case NoCompression:
{
(void) FormatMagickString(buffer,MaxTextExtent,*q,
- "ASCII85Decode");
+ "/ASCII85Decode filter");
break;
}
case JPEGCompression:
{
- (void) FormatMagickString(buffer,MaxTextExtent,*q,"DCTDecode");
+ (void) FormatMagickString(buffer,MaxTextExtent,*q,
+ "/DCTDecode filter");
break;
}
case LZWCompression:
{
- (void) FormatMagickString(buffer,MaxTextExtent,*q,"LZWDecode");
+ (void) FormatMagickString(buffer,MaxTextExtent,*q,
+ "/LZWDecode filter");
break;
}
case FaxCompression:
case Group4Compression:
{
- (void) FormatMagickString(buffer,MaxTextExtent,*q,
- "ASCII85Decode");
+ (void) FormatMagickString(buffer,MaxTextExtent,*q," ");
break;
}
default:
{
(void) FormatMagickString(buffer,MaxTextExtent,*q,
- "RunLengthDecode");
+ "/RunLengthDecode filter");
break;
}
}
#include "magick/token.h"
#include "magick/utility.h"
#include "magick/module.h"
-#if defined(MAGICKCORE_TIFF_DELEGATE)
-#if defined(MAGICKCORE_HAVE_TIFFCONF_H)
-#include "tiffconf.h"
-#endif
-#include "tiffio.h"
-#define CCITTParam "-1"
-#else
-#define CCITTParam "0"
-#endif
\f
/*
Define declarations.
#define PS3_DirectClass "0"
#define PS3_PseudoClass "1"
+
+#if defined(MAGICKCORE_TIFF_DELEGATE)
+#include "tiffio.h"
+#define CCITTParam "-1"
+#else
+#define CCITTParam "0"
+#endif
\f
/*
Forward declarations.
%
*/
-#if defined(MAGICKCORE_TIFF_DELEGATE)
static MagickBooleanType Huffman2DEncodeImage(const ImageInfo *image_info,
Image *image,Image *inject_image)
{
- char
- filename[MaxTextExtent];
-
- FILE
- *file;
-
Image
- *huffman_image;
+ *group4_image;
ImageInfo
*write_info;
- int
- unique_file;
-
MagickBooleanType
status;
- register long
- i;
-
- ssize_t
- count;
-
- TIFF
- *tiff;
-
- uint16
- fillorder;
-
- uint32
- *byte_count,
- strip_size;
+ size_t
+ length;
unsigned char
- *buffer;
+ *group4;
- /*
- Write image as CCITTFax4 TIFF image to a temporary file.
- */
- assert(image_info != (const ImageInfo *) NULL);
- assert(image_info->signature == MagickSignature);
- assert(image != (Image *) NULL);
- assert(image->signature == MagickSignature);
- if (image->debug != MagickFalse)
- (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
- assert(inject_image != (Image *) NULL);
- assert(inject_image->signature == MagickSignature);
- huffman_image=CloneImage(inject_image,0,0,MagickTrue,&image->exception);
- if (huffman_image == (Image *) NULL)
- return(MagickFalse);
- file=(FILE *) NULL;
- unique_file=AcquireUniqueFileResource(filename);
- if (unique_file != -1)
- file=fdopen(unique_file,"wb");
- if ((unique_file == -1) || (file == (FILE *) NULL))
- {
- ThrowFileException(&image->exception,FileOpenError,
- "UnableToCreateTemporaryFile",filename);
- return(MagickFalse);
- }
- (void) FormatMagickString(huffman_image->filename,MaxTextExtent,"tiff:%s",
- filename);
write_info=CloneImageInfo(image_info);
- SetImageInfoFile(write_info,file);
- write_info->compression=Group4Compression;
- write_info->type=BilevelType;
- (void) SetImageOption(write_info,"quantum:polarity","min-is-white");
- status=WriteImage(write_info,huffman_image);
- (void) fflush(file);
+ (void) CopyMagickString(write_info->filename,"GROUP4:",MaxTextExtent);
+ (void) CopyMagickString(write_info->magick,"GROUP4",MaxTextExtent);
+ group4_image=CloneImage(inject_image,0,0,MagickTrue,&image->exception);
+ if (group4_image == (Image *) NULL)
+ return(MagickFalse);
+ group4=(unsigned char *) ImageToBlob(write_info,group4_image,&length,
+ &image->exception);
+ group4_image=DestroyImage(group4_image);
+ if (group4 == (unsigned char *) NULL)
+ return(MagickFalse);
write_info=DestroyImageInfo(write_info);
- if (status == MagickFalse)
- {
- (void) RelinquishUniqueFileResource(filename);
- return(MagickFalse);
- }
- tiff=TIFFOpen(filename,"rb");
- if (tiff == (TIFF *) NULL)
- {
- huffman_image=DestroyImage(huffman_image);
- (void) fclose(file);
- (void) RelinquishUniqueFileResource(filename);
- ThrowFileException(&image->exception,FileOpenError,"UnableToOpenFile",
- image_info->filename);
- return(MagickFalse);
- }
- /*
- Allocate raw strip buffer.
- */
- byte_count=0;
- (void) TIFFGetField(tiff,TIFFTAG_STRIPBYTECOUNTS,&byte_count);
- strip_size=byte_count[0];
- for (i=1; i < (long) TIFFNumberOfStrips(tiff); i++)
- if (byte_count[i] > strip_size)
- strip_size=byte_count[i];
- buffer=(unsigned char *) AcquireQuantumMemory((size_t) strip_size,
- sizeof(*buffer));
- if (buffer == (unsigned char *) NULL)
- {
- TIFFClose(tiff);
- huffman_image=DestroyImage(huffman_image);
- (void) fclose(file);
- (void) RelinquishUniqueFileResource(filename);
- ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed",
- image_info->filename);
- }
- /*
- Compress runlength encoded to 2D Huffman pixels.
- */
- fillorder=FILLORDER_LSB2MSB;
- (void) TIFFGetFieldDefaulted(tiff,TIFFTAG_FILLORDER,&fillorder);
- for (i=0; i < (long) TIFFNumberOfStrips(tiff); i++)
- {
- count=(ssize_t) TIFFReadRawStrip(tiff,(uint32) i,buffer,(long)
- byte_count[i]);
- if (fillorder == FILLORDER_LSB2MSB)
- TIFFReverseBits(buffer,(unsigned long) count);
- (void) WriteBlob(image,(size_t) count,buffer);
- }
- buffer=(unsigned char *) RelinquishMagickMemory(buffer);
- TIFFClose(tiff);
- huffman_image=DestroyImage(huffman_image);
- (void) fclose(file);
- (void) RelinquishUniqueFileResource(filename);
- return(MagickTrue);
-}
-#else
-static MagickBooleanType Huffman2DEncodeImage(const ImageInfo *image_info,
- Image *image,Image *inject_image)
-{
- assert(image_info != (const ImageInfo *) NULL);
- assert(image_info->signature == MagickSignature);
- assert(image != (Image *) NULL);
- assert(image->signature == MagickSignature);
- if (image->debug != MagickFalse)
- (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
- assert(inject_image != (Image *) NULL);
- assert(inject_image->signature == MagickSignature);
- (void) ThrowMagickException(&image->exception,GetMagickModule(),
- MissingDelegateError,"DelegateLibrarySupportNotBuiltIn","`%s' (TIFF)",
- image->filename);
- return(MagickFalse);
+ if (WriteBlob(image,length,group4) != (ssize_t) length)
+ status=MagickFalse;
+ group4=(unsigned char *) RelinquishMagickMemory(group4);
+ return(status);
}
-#endif
+
static MagickBooleanType SerializeImage(const ImageInfo *image_info,
Image *image,unsigned char **pixels,size_t *length)
#define MagickLibVersionNumber 2,0,0
#define MagickLibSubversion "-5"
#define MagickReleaseDate "2009-09-25"
-#define MagickChangeDate "20090922"
+#define MagickChangeDate "20090925"
#define MagickAuthoritativeURL "http://www.imagemagick.org"
#define MagickHomeURL "file:///usr/local/share/doc/ImageMagick-6.5.6/index.html"
#if (MAGICKCORE_QUANTUM_DEPTH == 8)