%
% The format of the PingImage method is:
%
-% Image *PingImages(const ImageInfo *image_info,ExceptionInfo *exception)
+% Image *PingImages(ImageInfo *image_info,const char *filename,
+% ExceptionInfo *exception)
%
% A description of each parameter follows:
%
% o image_info: the image info.
%
+% o filename: the image filename.
+%
% o exception: return any errors or warnings in this structure.
%
*/
-MagickExport Image *PingImages(const ImageInfo *image_info,
+MagickExport Image *PingImages(ImageInfo *image_info,const char *filename,
ExceptionInfo *exception)
{
char
- filename[MaxTextExtent];
+ ping_filename[MaxTextExtent];
Image
*image,
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
image_info->filename);
assert(exception != (ExceptionInfo *) NULL);
+ (void) SetImageOption(image_info,"filename",filename);
+ (void) CopyMagickString(image_info->filename,filename,MaxTextExtent);
(void) InterpretImageFilename(image_info,(Image *) NULL,image_info->filename,
- (int) image_info->scene,filename,exception);
- if (LocaleCompare(filename,image_info->filename) != 0)
+ (int) image_info->scene,ping_filename,exception);
+ if (LocaleCompare(ping_filename,image_info->filename) != 0)
{
ExceptionInfo
*sans;
sans=AcquireExceptionInfo();
(void) SetImageInfo(read_info,0,sans);
sans=DestroyExceptionInfo(sans);
- (void) CopyMagickString(filename,read_info->filename,MaxTextExtent);
+ (void) CopyMagickString(ping_filename,read_info->filename,MaxTextExtent);
images=NewImageList();
extent=(ssize_t) (read_info->scene+read_info->number_scenes);
for (scene=(ssize_t) read_info->scene; scene < (ssize_t) extent; scene++)
{
- (void) InterpretImageFilename(image_info,(Image *) NULL,filename,(int)
- scene,read_info->filename,exception);
+ (void) InterpretImageFilename(image_info,(Image *) NULL,ping_filename,
+ (int) scene,read_info->filename,exception);
image=PingImage(read_info,exception);
if (image == (Image *) NULL)
continue;
%
% The format of the ReadImage method is:
%
-% Image *ReadImages(const ImageInfo *image_info,ExceptionInfo *exception)
+% Image *ReadImages(ImageInfo *image_info,const char *filename,
+% ExceptionInfo *exception)
%
% A description of each parameter follows:
%
% o image_info: the image info.
%
+% o filename: the image filename.
+%
% o exception: return any errors or warnings in this structure.
%
*/
-MagickExport Image *ReadImages(const ImageInfo *image_info,
+MagickExport Image *ReadImages(ImageInfo *image_info,const char *filename,
ExceptionInfo *exception)
{
char
- filename[MaxTextExtent];
+ read_filename[MaxTextExtent];
Image
*image,
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
image_info->filename);
assert(exception != (ExceptionInfo *) NULL);
- (void) InterpretImageFilename(image_info,(Image *) NULL,image_info->filename,
- (int) image_info->scene,filename,exception);
- if (LocaleCompare(filename,image_info->filename) != 0)
+ (void) SetImageOption(image_info,"filename",filename);
+ (void) CopyMagickString(image_info->filename,filename,MaxTextExtent);
+ (void) InterpretImageFilename(image_info,(Image *) NULL,filename,
+ (int) image_info->scene,read_filename,exception);
+ if (LocaleCompare(read_filename,image_info->filename) != 0)
{
ExceptionInfo
*sans;
read_info=DestroyImageInfo(read_info);
return(ReadImage(image_info,exception));
}
- (void) CopyMagickString(filename,read_info->filename,MaxTextExtent);
+ (void) CopyMagickString(read_filename,read_info->filename,MaxTextExtent);
images=NewImageList();
extent=(ssize_t) (read_info->scene+read_info->number_scenes);
for (scene=(ssize_t) read_info->scene; scene < (ssize_t) extent; scene++)
{
- (void) InterpretImageFilename(image_info,(Image *) NULL,filename,(int)
- scene,read_info->filename,exception);
+ (void) InterpretImageFilename(image_info,(Image *) NULL,read_filename,
+ (int) scene,read_info->filename,exception);
image=ReadImage(read_info,exception);
if (image == (Image *) NULL)
continue;
*ConstituteImage(const size_t,const size_t,const char *,const StorageType,
const void *,ExceptionInfo *),
*PingImage(const ImageInfo *,ExceptionInfo *),
- *PingImages(const ImageInfo *,ExceptionInfo *),
+ *PingImages(ImageInfo *,const char *,ExceptionInfo *),
*ReadImage(const ImageInfo *,ExceptionInfo *),
- *ReadImages(const ImageInfo *,ExceptionInfo *),
+ *ReadImages(ImageInfo *,const char *,ExceptionInfo *),
*ReadInlineImage(const ImageInfo *,const char *,ExceptionInfo *);
extern MagickExport MagickBooleanType
#define MagickSignature 0xabacadabUL
#if !defined(MaxTextExtent)
-# define MaxTextExtent 8192
+# define MaxTextExtent 4096
#endif
#if defined(MAGICKCORE_HAVE___ATTRIBUTE__)
*/
#define MagickPackageName "ImageMagick"
#define MagickCopyright "Copyright (C) 1999-2012 ImageMagick Studio LLC"
-#define MagickSVNRevision "6986"
+#define MagickSVNRevision "6997"
#define MagickLibVersion 0x700
#define MagickLibVersionText "7.0.0"
#define MagickLibVersionNumber 7,0,0
#define MagickLibAddendum "-0"
#define MagickLibInterface 7
#define MagickLibMinInterface 7
-#define MagickReleaseDate "2012-02-28"
+#define MagickReleaseDate "2012-02-29"
#define MagickChangeDate "20110801"
#define MagickAuthoritativeURL "http://www.imagemagick.org"
#if defined(MAGICKCORE_OPENMP_SUPPORT)
*CanonicalXMLContent(const char *,const MagickBooleanType);
extern MagickPrivate const char
- *GetXMLTreeAttribute(XMLTreeInfo *,const char *),
**GetXMLTreeProcessingInstructions(XMLTreeInfo *,const char *);
extern MagickPrivate MagickBooleanType
extern MagickPrivate XMLTreeInfo
*AddPathToXMLTree(XMLTreeInfo *,const char *,const size_t),
- *GetNextXMLTreeTag(XMLTreeInfo *),
*GetXMLTreeOrdered(XMLTreeInfo *),
*GetXMLTreePath(XMLTreeInfo *,const char *),
*InsertTagIntoXMLTree(XMLTreeInfo *,XMLTreeInfo *,const size_t),
% o xml_info: the xml info.
%
*/
-MagickPrivate XMLTreeInfo *GetNextXMLTreeTag(XMLTreeInfo *xml_info)
+MagickExport XMLTreeInfo *GetNextXMLTreeTag(XMLTreeInfo *xml_info)
{
assert(xml_info != (XMLTreeInfo *) NULL);
assert((xml_info->signature == MagickSignature) ||
% o tag: the attribute tag.
%
*/
-MagickPrivate const char *GetXMLTreeAttribute(XMLTreeInfo *xml_info,
+MagickExport const char *GetXMLTreeAttribute(XMLTreeInfo *xml_info,
const char *tag)
{
register ssize_t
*XMLTreeInfoToXML(XMLTreeInfo *);
extern MagickExport const char
+ *GetXMLTreeAttribute(XMLTreeInfo *,const char *),
*GetXMLTreeContent(XMLTreeInfo *),
*GetXMLTreeTag(XMLTreeInfo *);
extern MagickExport XMLTreeInfo
*AddChildToXMLTree(XMLTreeInfo *,const char *,const size_t),
*DestroyXMLTree(XMLTreeInfo *),
+ *GetNextXMLTreeTag(XMLTreeInfo *),
*GetXMLTreeChild(XMLTreeInfo *,const char *),
*GetXMLTreeSibling(XMLTreeInfo *),
*NewXMLTree(const char *,ExceptionInfo *),
option=argv[++i];
filename=option;
}
- (void) CopyMagickString(image_info->filename,filename,MaxTextExtent);
if (image_info->ping != MagickFalse)
- images=PingImages(image_info,exception);
+ images=PingImages(image_info,filename,exception);
else
- images=ReadImages(image_info,exception);
+ images=ReadImages(image_info,filename,exception);
status&=(images != (Image *) NULL) &&
(exception->severity < ErrorException);
if (images == (Image *) NULL)
filename=argv[i];
if ((LocaleCompare(filename,"--") == 0) && (i < (ssize_t) (argc-1)))
filename=argv[++i];
- (void) CopyMagickString(image_info->filename,filename,MaxTextExtent);
- images=ReadImages(image_info,exception);
+ images=ReadImages(image_info,filename,exception);
status&=(images != (Image *) NULL) &&
(exception->severity < ErrorException);
if (images == (Image *) NULL)
filename=argv[i];
if ((LocaleCompare(filename,"--") == 0) && (i < (ssize_t) (argc-1)))
filename=argv[++i];
- (void) CopyMagickString(image_info->filename,filename,MaxTextExtent);
- images=ReadImages(image_info,exception);
+ images=ReadImages(image_info,filename,exception);
status&=(images != (Image *) NULL) &&
(exception->severity < ErrorException);
if (images == (Image *) NULL)
}
char
+ filename[MaxTextExtent],
*option;
Image
status=SetImageOption(image_info,"filename",argv[i]);
if (status == MagickFalse)
ThrowConjureException(ImageError,"UnableToPersistKey",argv[i]);
- (void) FormatLocaleString(image_info->filename,MaxTextExtent,"msl:%s",
- argv[i]);
- image=ReadImages(image_info,exception);
+ (void) FormatLocaleString(filename,MaxTextExtent,"msl:%s",argv[i]);
+ image=ReadImages(image_info,filename,exception);
CatchException(exception);
if (image != (Image *) NULL)
image=DestroyImageList(image);
filename=argv[i];
if ((LocaleCompare(filename,"--") == 0) && (i < (ssize_t) (argc-1)))
filename=argv[++i];
- (void) CopyMagickString(image_info->filename,filename,MaxTextExtent);
if (image_info->ping != MagickFalse)
- images=PingImages(image_info,exception);
+ images=PingImages(image_info,filename,exception);
else
- images=ReadImages(image_info,exception);
+ images=ReadImages(image_info,filename,exception);
status&=(images != (Image *) NULL) &&
(exception->severity < ErrorException);
if (images == (Image *) NULL)
filename=argv[i];
if ((LocaleCompare(filename,"--") == 0) && (i < (ssize_t) (argc-1)))
filename=argv[++i];
- (void) CopyMagickString(identify_info->filename,filename,MaxTextExtent);
if (identify_info->ping != MagickFalse)
- images=PingImages(identify_info,exception);
+ images=PingImages(identify_info,filename,exception);
else
- images=ReadImages(identify_info,exception);
+ images=ReadImages(identify_info,filename,exception);
identify_info=DestroyImageInfo(identify_info);
status&=(images != (Image *) NULL) &&
(exception->severity < ErrorException);
#define WandSignature 0xabacadabUL
#if !defined(MaxTextExtent)
-# define MaxTextExtent 8192
+# define MaxTextExtent 4096
#endif
#if defined(MAGICKCORE_HAVE___ATTRIBUTE__)
filename=argv[i];
if ((LocaleCompare(filename,"--") == 0) && (i < (ssize_t) (argc-1)))
filename=argv[++i];
- (void) CopyMagickString(image_info->filename,filename,MaxTextExtent);
- images=ReadImages(image_info,exception);
+ images=ReadImages(image_info,filename,exception);
status&=(images != (Image *) NULL) &&
(exception->severity < ErrorException);
if (images == (Image *) NULL)
filename=argv[i];
if ((LocaleCompare(filename,"--") == 0) && (i < (ssize_t) (argc-1)))
filename=argv[++i];
- (void) CopyMagickString(image_info->filename,filename,MaxTextExtent);
- if (first_scene != last_scene)
+ (void) CloneString(&image_info->font,montage_info->font);
+ if (first_scene == last_scene)
+ images=ReadImages(image_info,filename,exception);
+ else
{
char
filename[MaxTextExtent];
if (LocaleCompare(filename,image_info->filename) == 0)
(void) FormatLocaleString(filename,MaxTextExtent,"%s.%.20g",
image_info->filename,(double) scene);
- (void) CopyMagickString(image_info->filename,filename,
- MaxTextExtent);
+ images=ReadImages(image_info,filename,exception);
}
- (void) CloneString(&image_info->font,montage_info->font);
- images=ReadImages(image_info,exception);
status&=(images != (Image *) NULL) &&
(exception->severity < ErrorException);
if (images == (Image *) NULL)
config/magic.xml \
config/mime.xml \
config/policy.xml \
+ config/quantization-table.xml \
config/sRGB.icc \
config/thresholds.xml \
config/type.xml \
config/magic.xml \
config/mime.xml \
config/policy.xml \
+ config/quantization-table.xml \
config/sRGB.icc \
config/thresholds.xml \
config/type-dejavu.xml.in \
/*
Associate a profile with the image.
*/
- profile_info=
- CloneImageInfo(info ? info->image_info : (ImageInfo *) NULL);
- (void) CopyMagickString(profile_info->filename,name,MaxTextExtent);
- profile_image=ReadImages(profile_info,exception);
+ profile_info=CloneImageInfo(info ? info->image_info :
+ (ImageInfo *) NULL);
+ profile_image=ReadImages(profile_info,name,exception);
if (profile_image == (Image *) NULL)
break;
ResetImageProfileIterator(profile_image);
number_images=0;
for (i=0; i < n; i++)
{
- if ((package_info->image_info->file != (FILE *) NULL) ||
- (package_info->image_info->blob != (void *) NULL))
+ if ((package_info->image_info->file == (FILE *) NULL) &&
+ (package_info->image_info->blob == (void *) NULL))
+ image=ReadImages(package_info->image_info,list[i],exception);
+ else
{
- image=ReadImages(package_info->image_info,exception);
+ image=ReadImages(package_info->image_info,
+ package_info->image_info->filename,exception);
if (image != (Image *) NULL)
DisassociateImageStream(image);
}
- else
- {
- (void) CopyMagickString(package_info->image_info->filename,list[i],
- MaxTextExtent);
- image=ReadImages(package_info->image_info,exception);
- }
if (image == (Image *) NULL)
break;
for ( ; image; image=image->next)
pango_font_description_set_size(description,PANGO_SCALE*draw_info->pointsize);
pango_layout_set_font_description(layout,description);
pango_font_description_free(description);
- property=InterpretImageProperties(image_info,image,image_info->filename,
- exception);
+ option=GetImageOption(image_info,"filename");
+ if (option != (const char *) NULL)
+ property=InterpretImageProperties(image_info,image,option,exception);
+ else
+ property=InterpretImageProperties(image_info,image,image_info->filename,
+ exception);
(void) SetImageProperty(image,"caption",property,exception);
property=DestroyString(property);
caption=ConstantString(GetImageProperty(image,"caption",exception));
#include "MagickCore/string_.h"
#include "MagickCore/string-private.h"
#include "MagickCore/utility.h"
+#include "MagickCore/xml-tree.h"
+#include "MagickCore/xml-tree-private.h"
#include <setjmp.h>
#if defined(MAGICKCORE_JPEG_DELEGATE)
#define JPEG_INTERNAL_OPTIONS
start_of_blob;
} SourceManager;
#endif
+
+typedef struct _QuantizationTable
+{
+ char
+ *slot,
+ *description;
+
+ size_t
+ width,
+ height;
+
+ unsigned int
+ divisor,
+ *levels;
+} QuantizationTable;
\f
/*
Forward declarations.
previous_profile=GetImageProfile(image,name);
if (previous_profile != (const StringInfo *) NULL)
{
- ssize_t
+ size_t
length;
length=GetStringInfoLength(profile);
if (jpeg_info.out_color_space == JCS_GRAYSCALE)
for (i=0; i < (ssize_t) image->colors; i++)
{
- image->colormap[i].red=ScaleCharToQuantum(jpeg_info.colormap[0][i]);
+ image->colormap[i].red=(double) ScaleCharToQuantum(
+ jpeg_info.colormap[0][i]);
image->colormap[i].green=image->colormap[i].red;
image->colormap[i].blue=image->colormap[i].red;
image->colormap[i].alpha=OpaqueAlpha;
else
for (i=0; i < (ssize_t) image->colors; i++)
{
- image->colormap[i].red=ScaleCharToQuantum(jpeg_info.colormap[0][i]);
- image->colormap[i].green=ScaleCharToQuantum(jpeg_info.colormap[1][i]);
- image->colormap[i].blue=ScaleCharToQuantum(jpeg_info.colormap[2][i]);
+ image->colormap[i].red=(double) ScaleCharToQuantum(
+ jpeg_info.colormap[0][i]);
+ image->colormap[i].green=(double) ScaleCharToQuantum(
+ jpeg_info.colormap[1][i]);
+ image->colormap[i].blue=(double) ScaleCharToQuantum(
+ jpeg_info.colormap[2][i]);
image->colormap[i].alpha=OpaqueAlpha;
}
}
%
*/
+static QuantizationTable *DestroyQuantizationTable(QuantizationTable *table)
+{
+ assert(table != (QuantizationTable *) NULL);
+ if (table->slot != (char *) NULL)
+ table->slot=DestroyString(table->slot);
+ if (table->description != (char *) NULL)
+ table->description=DestroyString(table->description);
+ if (table->levels != (unsigned int *) NULL)
+ table->levels=(unsigned int *) RelinquishMagickMemory(table->levels);
+ table=(QuantizationTable *) RelinquishMagickMemory(table);
+ return(table);
+}
+
static boolean EmptyOutputBuffer(j_compress_ptr cinfo)
{
DestinationManager
return(TRUE);
}
+static QuantizationTable *GetQuantizationTable(const char *filename,
+ const char *slot,ExceptionInfo *exception)
+{
+ char
+ *p,
+ *xml;
+
+ const char
+ *attribute,
+ *content;
+
+ double
+ value;
+
+ register ssize_t
+ i;
+
+ ssize_t
+ j;
+
+ QuantizationTable
+ *table;
+
+ XMLTreeInfo
+ *description,
+ *levels,
+ *quantization_tables,
+ *table_iterator;
+
+ (void) LogMagickEvent(ConfigureEvent,GetMagickModule(),
+ "Loading quantization tables \"%s\" ...",filename);
+ table=(QuantizationTable *) NULL;
+ xml=FileToString(filename,~0,exception);
+ if (xml == (char *) NULL)
+ return(table);
+ quantization_tables=NewXMLTree(xml,exception);
+ if (quantization_tables == (XMLTreeInfo *) NULL)
+ {
+ xml=DestroyString(xml);
+ return(table);
+ }
+ for (table_iterator=GetXMLTreeChild(quantization_tables,"table");
+ table_iterator != (XMLTreeInfo *) NULL;
+ table_iterator=GetNextXMLTreeTag(table_iterator))
+ {
+ attribute=GetXMLTreeAttribute(table_iterator,"slot");
+ if ((attribute != (char *) NULL) && (LocaleCompare(slot,attribute) == 0))
+ break;
+ attribute=GetXMLTreeAttribute(table_iterator,"alias");
+ if ((attribute != (char *) NULL) && (LocaleCompare(slot,attribute) == 0))
+ break;
+ }
+ if (table_iterator == (XMLTreeInfo *) NULL)
+ {
+ xml=DestroyString(xml);
+ return(table);
+ }
+ description=GetXMLTreeChild(table_iterator,"description");
+ if (description == (XMLTreeInfo *) NULL)
+ {
+ (void) ThrowMagickException(exception,GetMagickModule(),OptionError,
+ "XmlMissingElement", "<description>, slot \"%s\"",slot);
+ quantization_tables=DestroyXMLTree(quantization_tables);
+ xml=DestroyString(xml);
+ return(table);
+ }
+ levels=GetXMLTreeChild(table_iterator,"levels");
+ if (levels == (XMLTreeInfo *) NULL)
+ {
+ (void) ThrowMagickException(exception,GetMagickModule(),OptionError,
+ "XmlMissingElement", "<levels>, slot \"%s\"", slot);
+ quantization_tables=DestroyXMLTree(quantization_tables);
+ xml=DestroyString(xml);
+ return(table);
+ }
+ table=(QuantizationTable *) AcquireMagickMemory(sizeof(*table));
+ if (table == (QuantizationTable *) NULL)
+ ThrowFatalException(ResourceLimitFatalError,
+ "UnableToAcquireQuantizationTable");
+ table->slot=(char *) NULL;
+ table->description=(char *) NULL;
+ table->levels=(unsigned int *) NULL;
+ attribute=GetXMLTreeAttribute(table_iterator,"slot");
+ if (attribute != (char *) NULL)
+ table->slot=ConstantString(attribute);
+ content=GetXMLTreeContent(description);
+ if (content != (char *) NULL)
+ table->description=ConstantString(content);
+ attribute=GetXMLTreeAttribute(levels,"width");
+ if (attribute == (char *) NULL)
+ {
+ (void) ThrowMagickException(exception,GetMagickModule(),OptionError,
+ "XmlMissingAttribute", "<levels width>, slot \"%s\"",slot);
+ quantization_tables=DestroyXMLTree(quantization_tables);
+ table=DestroyQuantizationTable(table);
+ xml=DestroyString(xml);
+ return(table);
+ }
+ table->width=StringToUnsignedLong(attribute);
+ if (table->width == 0)
+ {
+ (void) ThrowMagickException(exception,GetMagickModule(),OptionError,
+ "XmlInvalidAttribute", "<levels width>, table \"%s\"",slot);
+ quantization_tables=DestroyXMLTree(quantization_tables);
+ table=DestroyQuantizationTable(table);
+ xml=DestroyString(xml);
+ return(table);
+ }
+ attribute=GetXMLTreeAttribute(levels,"height");
+ if (attribute == (char *) NULL)
+ {
+ (void) ThrowMagickException(exception,GetMagickModule(),OptionError,
+ "XmlMissingAttribute", "<levels height>, table \"%s\"",slot);
+ quantization_tables=DestroyXMLTree(quantization_tables);
+ table=DestroyQuantizationTable(table);
+ xml=DestroyString(xml);
+ return(table);
+ }
+ table->height=StringToUnsignedLong(attribute);
+ if (table->height == 0)
+ {
+ (void) ThrowMagickException(exception,GetMagickModule(),OptionError,
+ "XmlInvalidAttribute", "<levels height>, table \"%s\"",slot);
+ quantization_tables=DestroyXMLTree(quantization_tables);
+ table=DestroyQuantizationTable(table);
+ xml=DestroyString(xml);
+ return(table);
+ }
+ attribute=GetXMLTreeAttribute(levels,"divisor");
+ if (attribute == (char *) NULL)
+ {
+ (void) ThrowMagickException(exception,GetMagickModule(),OptionError,
+ "XmlMissingAttribute", "<levels divisor>, table \"%s\"",slot);
+ quantization_tables=DestroyXMLTree(quantization_tables);
+ table=DestroyQuantizationTable(table);
+ xml=DestroyString(xml);
+ return(table);
+ }
+ table->divisor=(unsigned int) StringToLong(attribute);
+ if (table->divisor < 1)
+ {
+ (void) ThrowMagickException(exception,GetMagickModule(),OptionError,
+ "XmlInvalidAttribute", "<levels divisor>, table \"%s\"",slot);
+ quantization_tables=DestroyXMLTree(quantization_tables);
+ table=DestroyQuantizationTable(table);
+ xml=DestroyString(xml);
+ return(table);
+ }
+ content=GetXMLTreeContent(levels);
+ if (content == (char *) NULL)
+ {
+ (void) ThrowMagickException(exception,GetMagickModule(),OptionError,
+ "XmlMissingContent", "<levels>, table \"%s\"",slot);
+ quantization_tables=DestroyXMLTree(quantization_tables);
+ table=DestroyQuantizationTable(table);
+ xml=DestroyString(xml);
+ return(table);
+ }
+ table->levels=(unsigned int *) AcquireQuantumMemory((size_t) table->width,
+ table->height*sizeof(*table->levels));
+ if (table->levels == (unsigned int *) NULL)
+ ThrowFatalException(ResourceLimitFatalError,
+ "UnableToAcquireQuantizationTable");
+ for (i=0; i < (ssize_t) (table->width*table->height); i++)
+ {
+ table->levels[i]=(unsigned int) strtol(content,&p,10);
+ if (table->divisor != 1)
+ table->levels[i]/=table->divisor;
+ while (isspace((int) ((unsigned char) *p)) != 0)
+ p++;
+ if (*p == ',')
+ p++;
+ content=p;
+ }
+ for (j=i; i < 64; i++)
+ table->levels[j]=table->levels[j-1];
+ value=(double) strtol(content,&p,10);
+ (void) value;
+ if (p != content)
+ {
+ (void) ThrowMagickException(exception,GetMagickModule(),OptionError,
+ "XmlInvalidContent", "<level> too many values, table \"%s\"",slot);
+ quantization_tables=DestroyXMLTree(quantization_tables);
+ table=DestroyQuantizationTable(table);
+ xml=DestroyString(xml);
+ return(table);
+ }
+ quantization_tables=DestroyXMLTree(quantization_tables);
+ xml=DestroyString(xml);
+ return(table);
+}
+
static void InitializeDestination(j_compress_ptr cinfo)
{
DestinationManager
jpeg_info.comp_info[i].h_samp_factor=1;
jpeg_info.comp_info[i].v_samp_factor=1;
}
- if ((jpeg_info.comp_info[0].h_samp_factor >= 2) &&
- (jpeg_info.comp_info[0].v_samp_factor >= 2))
+ option=GetImageOption(image_info,"jpeg:q-table");
+ if (option != (const char *) NULL)
{
- static const unsigned int
- ChrominanceQTable[DCTSIZE2] =
- {
- 17, 18, 22, 31, 50, 92, 193, 465,
- 18, 19, 24, 33, 54, 98, 207, 498,
- 22, 24, 29, 41, 66, 120, 253, 609,
- 31, 33, 41, 57, 92, 169, 355, 854,
- 50, 54, 66, 92, 148, 271, 570, 1370,
- 92, 98, 120, 169, 271, 498, 1046, 2516,
- 193, 207, 253, 355, 570, 1046, 2198, 5289,
- 465, 498, 609, 854, 1370,2516, 5289, 12725
- },
- LuminanceQTable[DCTSIZE2] =
- {
- 16, 12, 14, 17, 22, 30, 45, 72,
- 12, 13, 14, 17, 22, 31, 46, 74,
- 14, 14, 16, 19, 25, 35, 52, 83,
- 17, 17, 19, 23, 30, 41, 62, 100,
- 22, 22, 25, 30, 39, 54, 80, 129,
- 30, 31, 35, 41, 54, 74, 111, 178,
- 45, 46, 52, 62, 80, 111, 166, 267,
- 72, 74, 83, 100, 129, 178, 267, 428
- };
+ QuantizationTable
+ *table;
/*
- Nicolas Robidoux's remix of ISO-IEC 10918-1 : 1993(E) Annex K.
+ Custom quantization tables.
*/
- jpeg_add_quant_table(&jpeg_info,0,LuminanceQTable,jpeg_quality_scaling(
- quality),0);
- jpeg_add_quant_table(&jpeg_info,1,ChrominanceQTable,jpeg_quality_scaling(
- quality),0);
+ table=GetQuantizationTable(option,"0",exception);
+ if (table != (QuantizationTable *) NULL)
+ {
+ jpeg_add_quant_table(&jpeg_info,0,table->levels,jpeg_quality_scaling(
+ quality),0);
+ table=DestroyQuantizationTable(table);
+ }
+ table=GetQuantizationTable(option,"1",exception);
+ if (table != (QuantizationTable *) NULL)
+ {
+ jpeg_add_quant_table(&jpeg_info,1,table->levels,jpeg_quality_scaling(
+ quality),0);
+ table=DestroyQuantizationTable(table);
+ }
+ table=GetQuantizationTable(option,"2",exception);
+ if (table != (QuantizationTable *) NULL)
+ {
+ jpeg_add_quant_table(&jpeg_info,2,table->levels,jpeg_quality_scaling(
+ quality),0);
+ table=DestroyQuantizationTable(table);
+ }
+ table=GetQuantizationTable(option,"3",exception);
+ if (table != (QuantizationTable *) NULL)
+ {
+ jpeg_add_quant_table(&jpeg_info,3,table->levels,jpeg_quality_scaling(
+ quality),0);
+ table=DestroyQuantizationTable(table);
+ }
}
- else
- if ((jpeg_info.comp_info[0].h_samp_factor >= 1) &&
- (jpeg_info.comp_info[0].v_samp_factor >= 1))
- {
- static const unsigned int
- ChrominanceQTable[DCTSIZE2] =
- {
- 12, 15, 18, 26, 39, 69, 139, 279,
- 15, 18, 26, 39, 69, 139, 279, 559,
- 18, 26, 39, 69, 139, 279, 559, 1119,
- 26, 39, 69, 139, 279, 559, 1119, 2239,
- 39, 69, 139, 279, 559, 1119, 2239, 4479,
- 69, 139, 279, 559, 1119, 2239, 4479, 8959,
- 139, 279, 559, 1119, 2239, 4479, 8959, 17919,
- 279, 559, 1119, 2239, 4479, 8959, 17919, 35839
- },
- LuminanceQTable[DCTSIZE2] =
- {
- 11, 11, 12, 15, 20, 27, 36, 47,
- 11, 12, 15, 20, 27, 36, 47, 93,
- 12, 15, 20, 27, 36, 47, 93, 185,
- 15, 20, 27, 36, 47, 93, 185, 369,
- 20, 27, 36, 47, 93, 185, 369, 737,
- 27, 36, 47, 93, 185, 369, 737, 1473,
- 36, 47, 93, 185, 369, 737, 1473, 2945,
- 47, 93, 185, 369, 737, 1473, 2945, 5889
- };
-
- /*
- Nicolas Robidoux's remix of ISO-IEC 10918-1 : 1993(E) Annex K.
- */
- jpeg_add_quant_table(&jpeg_info,0,LuminanceQTable,jpeg_quality_scaling(
- quality),0);
- jpeg_add_quant_table(&jpeg_info,1,ChrominanceQTable,
- jpeg_quality_scaling(quality),0);
- }
jpeg_start_compress(&jpeg_info,MagickTrue);
if (image->debug != MagickFalse)
{
(void) sscanf(clone_info->filename,"%lx,%lx",¶m1,¶m2);
image_ptr=(Image **) param2;
if (*image_ptr != (Image *)NULL)
- image=CloneImage(*image_ptr,0,0,MagickFalse,exception);
+ image=CloneImage(*image_ptr,0,0,MagickFalse,&(*image_ptr)->exception);
#ifdef ALL_IMAGEINFO
image_info_ptr=(ImageInfo **) param1;
if (*image_info_ptr != (ImageInfo *)NULL)
return(tlen);
}
-static MagickBooleanType WriteXTRNImage(const ImageInfo *image_info,
- Image *image,ExceptionInfo *exception)
+static MagickBooleanType WriteXTRNImage(const ImageInfo *image_info,Image *image,ExceptionInfo *exception)
{
Image *
p;
SetImageInfo(clone_info,1,exception);
(void) CopyMagickString(image->magick,clone_info->magick,
MaxTextExtent);
- status=WriteStream(clone_info,image,fifo,exception);
+ status=WriteStream(clone_info,image,fifo);
if (status == MagickFalse)
CatchImageException(image);
}
SetImageInfo(clone_info,1,exception);
(void) CopyMagickString(image->magick,clone_info->magick,
MaxTextExtent);
- status=WriteStream(clone_info,image,SafeArrayFifo,exception);
+ status=WriteStream(clone_info,image,SafeArrayFifo);
if (status == MagickFalse)
CatchImageException(image);
}
<name>ImageMagick</name>
<shortdesc xml:lang="en">ImageMagick: convert, edit, and compose images.</shortdesc>
<homepage rdf:resource="http://www.imagemagick.org/"/>
- <created>2012-02-28</created>
+ <created>2012-02-29</created>
<description xml:lang="en">
ImageMagick® is a software suite to create, edit, compose, or convert bitmap images. It can read and write images in a variety of formats (over 100) including DPX, EXR, GIF, JPEG, JPEG-2000, PDF, PhotoCD, PNG, Postscript, SVG, and TIFF. Use ImageMagick to resize, flip, mirror, rotate, distort, shear and transform images, adjust image colors, apply various special effects, or draw text, lines, polygons, ellipses and Bézier curves.
<release>
<Version>
<name>stable</name>
- <created>2012-02-28</created>
+ <created>2012-02-29</created>
<revision>7.0.0</revision>
</Version>
</release>
config/magic.xml \
config/mime.xml \
config/policy.xml \
+ config/quantization-table.xml \
config/sRGB.icc \
config/thresholds.xml \
config/type.xml \
config/magic.xml \
config/mime.xml \
config/policy.xml \
+ config/quantization-table.xml \
config/sRGB.icc \
config/thresholds.xml \
config/type-dejavu.xml.in \
<configure name="VERSION" value="7.0.0"/>
<configure name="LIB_VERSION" value="0x700"/>
<configure name="LIB_VERSION_NUMBER" value="7,0,0,0"/>
- <configure name="SVN_REVISION" value="6986" />
- <configure name="RELEASE_DATE" value="2012-02-28"/>
+ <configure name="SVN_REVISION" value="6997" />
+ <configure name="RELEASE_DATE" value="2012-02-29"/>
<configure name="CONFIGURE" value="./configure "/>
<configure name="PREFIX" value="/usr/local"/>
<configure name="EXEC-PREFIX" value="/usr/local"/>
MAGICK_LIBRARY_VERSION_INFO=$MAGICK_LIBRARY_CURRENT:$MAGICK_LIBRARY_REVISION:$MAGICK_LIBRARY_AGE
-MAGICK_SVN_REVISION=6986
+MAGICK_SVN_REVISION=6997