2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6 % IIIII N N FFFFF OOO %
13 % Write Info About the Image. %
20 % Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization %
21 % dedicated to making software imaging solutions freely available. %
23 % You may not use this file except in compliance with the License. You may %
24 % obtain a copy of the License at %
26 % http://www.imagemagick.org/script/license.php %
28 % Unless required by applicable law or agreed to in writing, software %
29 % distributed under the License is distributed on an "AS IS" BASIS, %
30 % WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. %
31 % See the License for the specific language governing permissions and %
32 % limitations under the License. %
34 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
42 #include "MagickCore/studio.h"
43 #include "MagickCore/artifact.h"
44 #include "MagickCore/blob.h"
45 #include "MagickCore/blob-private.h"
46 #include "MagickCore/colorspace.h"
47 #include "MagickCore/exception.h"
48 #include "MagickCore/exception-private.h"
49 #include "MagickCore/identify.h"
50 #include "MagickCore/image.h"
51 #include "MagickCore/image-private.h"
52 #include "MagickCore/list.h"
53 #include "MagickCore/magick.h"
54 #include "MagickCore/memory_.h"
55 #include "MagickCore/monitor.h"
56 #include "MagickCore/monitor-private.h"
57 #include "MagickCore/option.h"
58 #include "MagickCore/property.h"
59 #include "MagickCore/quantum-private.h"
60 #include "MagickCore/static.h"
61 #include "MagickCore/string_.h"
62 #include "MagickCore/module.h"
63 #include "MagickCore/utility.h"
68 static MagickBooleanType
69 WriteINFOImage(const ImageInfo *,Image *,ExceptionInfo *);
72 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
76 % R e g i s t e r I N F O I m a g e %
80 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
82 % RegisterINFOImage() adds attributes for the INFO image format to
83 % the list of supported formats. The attributes include the image format
84 % tag, a method to read and/or write the format, whether the format
85 % supports the saving of more than one frame to the same file or blob,
86 % whether the format supports native in-memory I/O, and a brief
87 % description of the format.
89 % The format of the RegisterINFOImage method is:
91 % size_t RegisterINFOImage(void)
94 ModuleExport size_t RegisterINFOImage(void)
99 entry=SetMagickInfo("INFO");
100 entry->encoder=(EncodeImageHandler *) WriteINFOImage;
101 entry->blob_support=MagickFalse;
102 entry->description=ConstantString("The image format and characteristics");
103 entry->module=ConstantString("INFO");
104 (void) RegisterMagickInfo(entry);
105 return(MagickImageCoderSignature);
109 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
113 % U n r e g i s t e r I N F O I m a g e %
117 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
119 % UnregisterINFOImage() removes format registrations made by the
120 % INFO module from the list of supported formats.
122 % The format of the UnregisterINFOImage method is:
124 % UnregisterINFOImage(void)
127 ModuleExport void UnregisterINFOImage(void)
129 (void) UnregisterMagickInfo("INFO");
133 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
137 % W r i t e I N F O I m a g e %
141 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
143 % WriteINFOImage writes the pixel values as text numbers.
145 % The format of the WriteINFOImage method is:
147 % MagickBooleanType WriteINFOImage(const ImageInfo *image_info,
148 % Image *image,ExceptionInfo *exception)
150 % A description of each parameter follows.
152 % o image_info: the image info.
154 % o image: The image.
156 % o exception: return any errors or warnings in this structure.
159 static MagickBooleanType WriteINFOImage(const ImageInfo *image_info,
160 Image *image,ExceptionInfo *exception)
172 Open output image file.
174 assert(image_info != (const ImageInfo *) NULL);
175 assert(image_info->signature == MagickSignature);
176 assert(image != (Image *) NULL);
177 assert(image->signature == MagickSignature);
178 if (image->debug != MagickFalse)
179 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
180 status=OpenBlob(image_info,image,WriteBlobMode,exception);
181 if (status == MagickFalse)
186 format=GetImageOption(image_info,"format");
187 if (format == (char *) NULL)
189 (void) CopyMagickString(image->filename,image->magick_filename,
191 image->magick_columns=image->columns;
192 image->magick_rows=image->rows;
193 (void) IdentifyImage(image,GetBlobFileHandle(image),
194 image_info->verbose,exception);
201 text=InterpretImageProperties((ImageInfo *) image_info,image,format,
203 if (text != (char *) NULL)
205 (void) WriteBlobString(image,text);
206 (void) WriteBlobString(image,"\n");
207 text=DestroyString(text);
210 if (GetNextImageInList(image) == (Image *) NULL)
212 image=SyncNextImageInList(image);
213 status=SetImageProgress(image,SaveImagesTag,scene++,
214 GetImageListLength(image));
215 if (status == MagickFalse)
217 } while (image_info->adjoin != MagickFalse);
218 (void) CloseBlob(image);