Re: MagickSetImageType and gm convert: inconsistent behaviour
Graham Leggett <[email protected]> Thu, 7 Oct 2010 18:42:52 +0200
| Newsgroups | gmane.comp.video.graphicsmagick.bugs |
|---|---|
| Message-ID | <[email protected]> |
On 07 Oct 2010, at 1:44 AM, Bob Friesenhahn wrote: >> Let me get a potential patch together. > > Your contribution to the effort will certainly be appreciated. You > have the advantage of needing to use the functionality so it is sure > to be well tested. This is the kind of thing I have in mind, are there any further changes that I would need to make to ensure the C++/etc bindings pick this up, or is this enough? Just want to make sure we aren't heading off in a direction that goes against GM. Regards, Graham -- ------------------------------------------------------------------------------ Beautiful is writing same markup. Internet Explorer 9 supports standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3. Spend less time writing and rewriting code and more time creating great experiences on the web. Be a part of the beta today. http://p.sf.net/sfu/beautyoftheweb _______________________________________________ Graphicsmagick-bugs mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/graphicsmagick-bugs
graphicsmagick-setimagesavedtype.patch
(application/octet-stream, 4.8 KB)
Index: wand/magick_wand.h
===================================================================
RCS file: /GraphicsMagick/GraphicsMagick/wand/magick_wand.h,v
retrieving revision 1.22
diff -u -r1.22 magick_wand.h
--- wand/magick_wand.h 2 Mar 2010 23:25:01 -0000 1.22
+++ wand/magick_wand.h 7 Oct 2010 16:40:59 -0000
@@ -92,6 +92,9 @@
extern WandExport ImageType
MagickGetImageType(MagickWand *);
+extern WandExport ImageType
+ MagickGetImageSavedType(MagickWand *);
+
extern WandExport InterlaceType
MagickGetImageInterlaceScheme(MagickWand *);
@@ -281,6 +284,7 @@
MagickSetImageResolution(MagickWand *,const double,const double),
MagickSetImageScene(MagickWand *,const unsigned long),
MagickSetImageType(MagickWand *,const ImageType),
+ MagickSetImageSavedType(MagickWand *,const ImageType),
MagickSetImageUnits(MagickWand *,const ResolutionType),
MagickSetImageVirtualPixelMethod(MagickWand *,const VirtualPixelMethod),
MagickSetPassphrase(MagickWand *,const char *),
Index: wand/magick_wand.c
===================================================================
RCS file: /GraphicsMagick/GraphicsMagick/wand/magick_wand.c,v
retrieving revision 1.42
diff -u -r1.42 magick_wand.c
--- wand/magick_wand.c 18 Dec 2009 20:44:40 -0000 1.42
+++ wand/magick_wand.c 7 Oct 2010 16:41:00 -0000
@@ -4225,6 +4225,37 @@
}
return(GetImageType(wand->image,&wand->exception));
}
+
+/*
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% %
+% %
+% %
+% M a g i c k G e t I m a g e S a v e d T y p e %
+% %
+% %
+% %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% MagickGetImageSavedType() gets the image type that will be used when the
+% image is saved. This may be different to the current image type, returned
+% by MagickGetImageType().
+%
+% The format of the MagickGetImageSavedType method is:
+%
+% ImageType MagickGetImageSavedType(MagickWand *wand)
+%
+% A description of each parameter follows:
+%
+% o wand: The magick wand.
+%
+*/
+WandExport ImageType MagickGetImageSavedType(MagickWand *wand)
+{
+ assert(wand != (MagickWand *) NULL);
+ assert(wand->signature == MagickSignature);
+ return(wand->image_info->type);
+}
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -8478,6 +8509,44 @@
% %
% %
% %
+% M a g i c k S e t I m a g e S a v e d T y p e %
+% %
+% %
+% %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% MagickSetImageSavedType() sets the image type that will be used when the
+% image is saved.
+%
+% The format of the MagickSetImageSavedType method is:
+%
+% unsigned int MagickSetImageSavedType(MagickWand *wand,
+% const ImageType image_type)
+%
+% A description of each parameter follows:
+%
+% o wand: The magick wand.
+%
+% o image_type: The image type: UndefinedType, BilevelType, GrayscaleType,
+% GrayscaleMatteType, PaletteType, PaletteMatteType, TrueColorType,
+% TrueColorMatteType, ColorSeparationType, ColorSeparationMatteType,
+% or OptimizeType.
+%
+*/
+WandExport unsigned int MagickSetImageSavedType(MagickWand *wand,
+ const ImageType image_type)
+{
+ assert(wand != (MagickWand *) NULL);
+ assert(wand->signature == MagickSignature);
+ wand->image_info->type = image_type;
+ return(True);
+}
+
+/*
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% %
+% %
+% %
% M a g i c k S e t I m a g e U n i t s %
% %
% %