MagickCore  7.0.2
constitute.c
Go to the documentation of this file.
1 /*
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 % %
4 % %
5 % %
6 % CCCC OOO N N SSSSS TTTTT IIIII TTTTT U U TTTTT EEEEE %
7 % C O O NN N SS T I T U U T E %
8 % C O O N N N ESSS T I T U U T EEE %
9 % C O O N NN SS T I T U U T E %
10 % CCCC OOO N N SSSSS T IIIII T UUU T EEEEE %
11 % %
12 % %
13 % MagickCore Methods to Consitute an Image %
14 % %
15 % Software Design %
16 % Cristy %
17 % October 1998 %
18 % %
19 % %
20 % Copyright 1999-2016 ImageMagick Studio LLC, a non-profit organization %
21 % dedicated to making software imaging solutions freely available. %
22 % %
23 % You may not use this file except in compliance with the License. You may %
24 % obtain a copy of the License at %
25 % %
26 % http://www.imagemagick.org/script/license.php %
27 % %
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. %
33 % %
34 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
35 %
36 %
37 */
38 
39 /*
40  Include declarations.
41 */
42 #include "MagickCore/studio.h"
43 #include "MagickCore/attribute.h"
44 #include "MagickCore/blob.h"
46 #include "MagickCore/exception.h"
48 #include "MagickCore/cache.h"
49 #include "MagickCore/client.h"
51 #include "MagickCore/constitute.h"
53 #include "MagickCore/delegate.h"
54 #include "MagickCore/geometry.h"
55 #include "MagickCore/identify.h"
57 #include "MagickCore/list.h"
58 #include "MagickCore/magick.h"
59 #include "MagickCore/memory_.h"
60 #include "MagickCore/monitor.h"
62 #include "MagickCore/option.h"
63 #include "MagickCore/pixel.h"
65 #include "MagickCore/policy.h"
66 #include "MagickCore/profile.h"
68 #include "MagickCore/property.h"
69 #include "MagickCore/quantum.h"
70 #include "MagickCore/resize.h"
71 #include "MagickCore/resource_.h"
72 #include "MagickCore/semaphore.h"
73 #include "MagickCore/statistic.h"
74 #include "MagickCore/stream.h"
75 #include "MagickCore/string_.h"
77 #include "MagickCore/timer.h"
78 #include "MagickCore/token.h"
79 #include "MagickCore/transform.h"
80 #include "MagickCore/utility.h"
82 
83 /*
84 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
85 % %
86 % %
87 % %
88 % C o n s t i t u t e I m a g e %
89 % %
90 % %
91 % %
92 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
93 %
94 % ConstituteImage() returns an image from the pixel data you supply.
95 % The pixel data must be in scanline order top-to-bottom. The data can be
96 % char, short int, int, float, or double. Float and double require the
97 % pixels to be normalized [0..1], otherwise [0..QuantumRange]. For example, to
98 % create a 640x480 image from unsigned red-green-blue character data, use:
99 %
100 % image = ConstituteImage(640,480,"RGB",CharPixel,pixels,&exception);
101 %
102 % The format of the ConstituteImage method is:
103 %
104 % Image *ConstituteImage(const size_t columns,const size_t rows,
105 % const char *map,const StorageType storage,const void *pixels,
106 % ExceptionInfo *exception)
107 %
108 % A description of each parameter follows:
109 %
110 % o columns: width in pixels of the image.
111 %
112 % o rows: height in pixels of the image.
113 %
114 % o map: This string reflects the expected ordering of the pixel array.
115 % It can be any combination or order of R = red, G = green, B = blue,
116 % A = alpha (0 is transparent), O = opacity (0 is opaque), C = cyan,
117 % Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
118 % P = pad.
119 %
120 % o storage: Define the data type of the pixels. Float and double types are
121 % expected to be normalized [0..1] otherwise [0..QuantumRange]. Choose
122 % from these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
123 % LongPixel, QuantumPixel, or ShortPixel.
124 %
125 % o pixels: This array of values contain the pixel components as defined by
126 % map and type. You must preallocate this array where the expected
127 % length varies depending on the values of width, height, map, and type.
128 %
129 % o exception: return any errors or warnings in this structure.
130 %
131 */
132 MagickExport Image *ConstituteImage(const size_t columns,const size_t rows,
133  const char *map,const StorageType storage,const void *pixels,
134  ExceptionInfo *exception)
135 {
136  Image
137  *image;
138 
140  status;
141 
142  /*
143  Allocate image structure.
144  */
145  assert(map != (const char *) NULL);
146  (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",map);
147  assert(pixels != (void *) NULL);
148  assert(exception != (ExceptionInfo *) NULL);
149  assert(exception->signature == MagickCoreSignature);
150  image=AcquireImage((ImageInfo *) NULL,exception);
151  if (image == (Image *) NULL)
152  return((Image *) NULL);
153  if ((columns == 0) || (rows == 0))
154  ThrowImageException(OptionError,"NonZeroWidthAndHeightRequired");
155  image->columns=columns;
156  image->rows=rows;
157  (void) SetImageBackgroundColor(image,exception);
158  status=ImportImagePixels(image,0,0,columns,rows,map,storage,pixels,exception);
159  if (status == MagickFalse)
160  image=DestroyImage(image);
161  return(image);
162 }
163 
164 /*
165 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
166 % %
167 % %
168 % %
169 % P i n g I m a g e %
170 % %
171 % %
172 % %
173 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
174 %
175 % PingImage() returns all the properties of an image or image sequence
176 % except for the pixels. It is much faster and consumes far less memory
177 % than ReadImage(). On failure, a NULL image is returned and exception
178 % describes the reason for the failure.
179 %
180 % The format of the PingImage method is:
181 %
182 % Image *PingImage(const ImageInfo *image_info,ExceptionInfo *exception)
183 %
184 % A description of each parameter follows:
185 %
186 % o image_info: Ping the image defined by the file or filename members of
187 % this structure.
188 %
189 % o exception: return any errors or warnings in this structure.
190 %
191 */
192 
193 #if defined(__cplusplus) || defined(c_plusplus)
194 extern "C" {
195 #endif
196 
197 static size_t PingStream(const Image *magick_unused(image),
198  const void *magick_unused(pixels),const size_t columns)
199 {
200  magick_unreferenced(image);
201  magick_unreferenced(pixels);
202  return(columns);
203 }
204 
205 #if defined(__cplusplus) || defined(c_plusplus)
206 }
207 #endif
208 
210  ExceptionInfo *exception)
211 {
212  Image
213  *image;
214 
215  ImageInfo
216  *ping_info;
217 
218  assert(image_info != (ImageInfo *) NULL);
219  assert(image_info->signature == MagickCoreSignature);
220  if (image_info->debug != MagickFalse)
222  image_info->filename);
223  assert(exception != (ExceptionInfo *) NULL);
224  ping_info=CloneImageInfo(image_info);
225  ping_info->ping=MagickTrue;
226  image=ReadStream(ping_info,&PingStream,exception);
227  if (image != (Image *) NULL)
228  {
229  ResetTimer(&image->timer);
230  if (ping_info->verbose != MagickFalse)
231  (void) IdentifyImage(image,stdout,MagickFalse,exception);
232  }
233  ping_info=DestroyImageInfo(ping_info);
234  return(image);
235 }
236 
237 /*
238 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
239 % %
240 % %
241 % %
242 % P i n g I m a g e s %
243 % %
244 % %
245 % %
246 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
247 %
248 % PingImages() pings one or more images and returns them as an image list.
249 %
250 % The format of the PingImage method is:
251 %
252 % Image *PingImages(ImageInfo *image_info,const char *filename,
253 % ExceptionInfo *exception)
254 %
255 % A description of each parameter follows:
256 %
257 % o image_info: the image info.
258 %
259 % o filename: the image filename.
260 %
261 % o exception: return any errors or warnings in this structure.
262 %
263 */
264 MagickExport Image *PingImages(ImageInfo *image_info,const char *filename,
265  ExceptionInfo *exception)
266 {
267  char
268  ping_filename[MagickPathExtent];
269 
270  Image
271  *image,
272  *images;
273 
274  ImageInfo
275  *read_info;
276 
277  /*
278  Ping image list from a file.
279  */
280  assert(image_info != (ImageInfo *) NULL);
281  assert(image_info->signature == MagickCoreSignature);
282  if (image_info->debug != MagickFalse)
284  image_info->filename);
285  assert(exception != (ExceptionInfo *) NULL);
286  (void) SetImageOption(image_info,"filename",filename);
287  (void) CopyMagickString(image_info->filename,filename,MagickPathExtent);
288  (void) InterpretImageFilename(image_info,(Image *) NULL,image_info->filename,
289  (int) image_info->scene,ping_filename,exception);
290  if (LocaleCompare(ping_filename,image_info->filename) != 0)
291  {
293  *sans;
294 
295  ssize_t
296  extent,
297  scene;
298 
299  /*
300  Images of the form image-%d.png[1-5].
301  */
302  read_info=CloneImageInfo(image_info);
303  sans=AcquireExceptionInfo();
304  (void) SetImageInfo(read_info,0,sans);
305  sans=DestroyExceptionInfo(sans);
306  if (read_info->number_scenes == 0)
307  {
308  read_info=DestroyImageInfo(read_info);
309  return(PingImage(image_info,exception));
310  }
311  (void) CopyMagickString(ping_filename,read_info->filename,MagickPathExtent);
312  images=NewImageList();
313  extent=(ssize_t) (read_info->scene+read_info->number_scenes);
314  for (scene=(ssize_t) read_info->scene; scene < (ssize_t) extent; scene++)
315  {
316  (void) InterpretImageFilename(image_info,(Image *) NULL,ping_filename,
317  (int) scene,read_info->filename,exception);
318  image=PingImage(read_info,exception);
319  if (image == (Image *) NULL)
320  continue;
321  AppendImageToList(&images,image);
322  }
323  read_info=DestroyImageInfo(read_info);
324  return(images);
325  }
326  return(PingImage(image_info,exception));
327 }
328 
329 /*
330 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
331 % %
332 % %
333 % %
334 % R e a d I m a g e %
335 % %
336 % %
337 % %
338 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
339 %
340 % ReadImage() reads an image or image sequence from a file or file handle.
341 % The method returns a NULL if there is a memory shortage or if the image
342 % cannot be read. On failure, a NULL image is returned and exception
343 % describes the reason for the failure.
344 %
345 % The format of the ReadImage method is:
346 %
347 % Image *ReadImage(const ImageInfo *image_info,ExceptionInfo *exception)
348 %
349 % A description of each parameter follows:
350 %
351 % o image_info: Read the image defined by the file or filename members of
352 % this structure.
353 %
354 % o exception: return any errors or warnings in this structure.
355 %
356 */
358  ExceptionInfo *exception)
359 {
360  char
361  filename[MagickPathExtent],
362  magick[MagickPathExtent],
363  magick_filename[MagickPathExtent];
364 
365  const char
366  *value;
367 
368  const DelegateInfo
369  *delegate_info;
370 
371  const MagickInfo
372  *magick_info;
373 
375  *sans_exception;
376 
378  geometry_info;
379 
380  Image
381  *image,
382  *next;
383 
384  ImageInfo
385  *read_info;
386 
388  flags;
389 
391  domain;
392 
394  rights;
395 
396  /*
397  Determine image type from filename prefix or suffix (e.g. image.jpg).
398  */
399  assert(image_info != (ImageInfo *) NULL);
400  assert(image_info->signature == MagickCoreSignature);
401  assert(image_info->filename != (char *) NULL);
402  if (image_info->debug != MagickFalse)
404  image_info->filename);
405  assert(exception != (ExceptionInfo *) NULL);
406  read_info=CloneImageInfo(image_info);
407  (void) CopyMagickString(magick_filename,read_info->filename,MagickPathExtent);
408  (void) SetImageInfo(read_info,0,exception);
409  (void) CopyMagickString(filename,read_info->filename,MagickPathExtent);
410  (void) CopyMagickString(magick,read_info->magick,MagickPathExtent);
411  domain=CoderPolicyDomain;
412  rights=ReadPolicyRights;
413  if (IsRightsAuthorized(domain,rights,read_info->magick) == MagickFalse)
414  {
415  errno=EPERM;
417  "NotAuthorized","`%s'",read_info->filename);
418  read_info=DestroyImageInfo(read_info);
419  return((Image *) NULL);
420  }
421  /*
422  Call appropriate image reader based on image type.
423  */
424  sans_exception=AcquireExceptionInfo();
425  magick_info=GetMagickInfo(read_info->magick,sans_exception);
426  sans_exception=DestroyExceptionInfo(sans_exception);
427  if (magick_info != (const MagickInfo *) NULL)
428  {
429  if (GetMagickEndianSupport(magick_info) == MagickFalse)
430  read_info->endian=UndefinedEndian;
431  else
432  if ((image_info->endian == UndefinedEndian) &&
433  (GetMagickRawSupport(magick_info) != MagickFalse))
434  {
435  unsigned long
436  lsb_first;
437 
438  lsb_first=1;
439  read_info->endian=(*(char *) &lsb_first) == 1 ? LSBEndian :
440  MSBEndian;
441  }
442  }
443  if ((magick_info != (const MagickInfo *) NULL) &&
444  (GetMagickSeekableStream(magick_info) != MagickFalse))
445  {
447  status;
448 
449  image=AcquireImage(read_info,exception);
450  (void) CopyMagickString(image->filename,read_info->filename,
452  status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
453  if (status == MagickFalse)
454  {
455  read_info=DestroyImageInfo(read_info);
456  image=DestroyImage(image);
457  return((Image *) NULL);
458  }
459  if (IsBlobSeekable(image) == MagickFalse)
460  {
461  /*
462  Coder requires a seekable stream.
463  */
464  *read_info->filename='\0';
465  status=ImageToFile(image,read_info->filename,exception);
466  if (status == MagickFalse)
467  {
468  (void) CloseBlob(image);
469  read_info=DestroyImageInfo(read_info);
470  image=DestroyImage(image);
471  return((Image *) NULL);
472  }
473  read_info->temporary=MagickTrue;
474  }
475  (void) CloseBlob(image);
476  image=DestroyImage(image);
477  }
478  image=NewImageList();
479  if ((magick_info == (const MagickInfo *) NULL) ||
480  (GetImageDecoder(magick_info) == (DecodeImageHandler *) NULL))
481  {
482  delegate_info=GetDelegateInfo(read_info->magick,(char *) NULL,exception);
483  if (delegate_info == (const DelegateInfo *) NULL)
484  {
485  (void) SetImageInfo(read_info,0,exception);
486  (void) CopyMagickString(read_info->filename,filename,
488  magick_info=GetMagickInfo(read_info->magick,exception);
489  }
490  }
491  if ((magick_info != (const MagickInfo *) NULL) &&
492  (GetImageDecoder(magick_info) != (DecodeImageHandler *) NULL))
493  {
494  if (GetMagickDecoderThreadSupport(magick_info) == MagickFalse)
495  LockSemaphoreInfo(magick_info->semaphore);
496  image=GetImageDecoder(magick_info)(read_info,exception);
497  if (GetMagickDecoderThreadSupport(magick_info) == MagickFalse)
498  UnlockSemaphoreInfo(magick_info->semaphore);
499  }
500  else
501  {
503  status;
504 
505  delegate_info=GetDelegateInfo(read_info->magick,(char *) NULL,exception);
506  if (delegate_info == (const DelegateInfo *) NULL)
507  {
508  (void) ThrowMagickException(exception,GetMagickModule(),
509  MissingDelegateError,"NoDecodeDelegateForThisImageFormat","`%s'",
510  read_info->magick);
511  if (read_info->temporary != MagickFalse)
512  (void) RelinquishUniqueFileResource(read_info->filename);
513  read_info=DestroyImageInfo(read_info);
514  return((Image *) NULL);
515  }
516  /*
517  Let our decoding delegate process the image.
518  */
519  image=AcquireImage(read_info,exception);
520  if (image == (Image *) NULL)
521  {
522  read_info=DestroyImageInfo(read_info);
523  return((Image *) NULL);
524  }
525  (void) CopyMagickString(image->filename,read_info->filename,
527  *read_info->filename='\0';
528  if (GetDelegateThreadSupport(delegate_info) == MagickFalse)
529  LockSemaphoreInfo(delegate_info->semaphore);
530  status=InvokeDelegate(read_info,image,read_info->magick,(char *) NULL,
531  exception);
532  if (GetDelegateThreadSupport(delegate_info) == MagickFalse)
533  UnlockSemaphoreInfo(delegate_info->semaphore);
534  image=DestroyImageList(image);
535  read_info->temporary=MagickTrue;
536  if (status != MagickFalse)
537  (void) SetImageInfo(read_info,0,exception);
538  magick_info=GetMagickInfo(read_info->magick,exception);
539  if ((magick_info == (const MagickInfo *) NULL) ||
540  (GetImageDecoder(magick_info) == (DecodeImageHandler *) NULL))
541  {
542  if (IsPathAccessible(read_info->filename) != MagickFalse)
543  (void) ThrowMagickException(exception,GetMagickModule(),
544  MissingDelegateError,"NoDecodeDelegateForThisImageFormat","`%s'",
545  read_info->magick);
546  else
547  ThrowFileException(exception,FileOpenError,"UnableToOpenFile",
548  read_info->filename);
549  read_info=DestroyImageInfo(read_info);
550  return((Image *) NULL);
551  }
552  if (GetMagickDecoderThreadSupport(magick_info) == MagickFalse)
553  LockSemaphoreInfo(magick_info->semaphore);
554  image=(Image *) (GetImageDecoder(magick_info))(read_info,exception);
555  if (GetMagickDecoderThreadSupport(magick_info) == MagickFalse)
556  UnlockSemaphoreInfo(magick_info->semaphore);
557  }
558  if (read_info->temporary != MagickFalse)
559  {
560  (void) RelinquishUniqueFileResource(read_info->filename);
561  read_info->temporary=MagickFalse;
562  if (image != (Image *) NULL)
563  (void) CopyMagickString(image->filename,filename,MagickPathExtent);
564  }
565  if (image == (Image *) NULL)
566  {
567  read_info=DestroyImageInfo(read_info);
568  return(image);
569  }
570  if (exception->severity >= ErrorException)
572  "Coder (%s) generated an image despite an error (%d), "
573  "notify the developers",image->magick,exception->severity);
574  if (IsBlobTemporary(image) != MagickFalse)
575  (void) RelinquishUniqueFileResource(read_info->filename);
576  if ((GetNextImageInList(image) != (Image *) NULL) &&
578  {
579  Image
580  *clones;
581 
582  clones=CloneImages(image,read_info->scenes,exception);
583  if (clones == (Image *) NULL)
585  "SubimageSpecificationReturnsNoImages","`%s'",read_info->filename);
586  else
587  {
588  image=DestroyImageList(image);
589  image=GetFirstImageInList(clones);
590  }
591  }
592  for (next=image; next != (Image *) NULL; next=GetNextImageInList(next))
593  {
594  char
595  magick_path[MagickPathExtent],
596  *property,
597  timestamp[MagickPathExtent];
598 
599  const char
600  *option;
601 
602  const StringInfo
603  *profile;
604 
605  next->taint=MagickFalse;
606  GetPathComponent(magick_filename,MagickPath,magick_path);
607  if (*magick_path == '\0' && *next->magick == '\0')
608  (void) CopyMagickString(next->magick,magick,MagickPathExtent);
609  (void) CopyMagickString(next->magick_filename,magick_filename,
611  if (IsBlobTemporary(image) != MagickFalse)
612  (void) CopyMagickString(next->filename,filename,MagickPathExtent);
613  if (next->magick_columns == 0)
614  next->magick_columns=next->columns;
615  if (next->magick_rows == 0)
616  next->magick_rows=next->rows;
617  value=GetImageProperty(next,"tiff:Orientation",exception);
618  if (value == (char *) NULL)
619  value=GetImageProperty(next,"exif:Orientation",exception);
620  if (value != (char *) NULL)
621  {
623  (void) DeleteImageProperty(next,"tiff:Orientation");
624  (void) DeleteImageProperty(next,"exif:Orientation");
625  }
626  value=GetImageProperty(next,"exif:XResolution",exception);
627  if (value != (char *) NULL)
628  {
629  geometry_info.rho=next->resolution.x;
630  geometry_info.sigma=1.0;
631  flags=ParseGeometry(value,&geometry_info);
632  if (geometry_info.sigma != 0)
633  next->resolution.x=geometry_info.rho/geometry_info.sigma;
634  (void) DeleteImageProperty(next,"exif:XResolution");
635  }
636  value=GetImageProperty(next,"exif:YResolution",exception);
637  if (value != (char *) NULL)
638  {
639  geometry_info.rho=next->resolution.y;
640  geometry_info.sigma=1.0;
641  flags=ParseGeometry(value,&geometry_info);
642  if (geometry_info.sigma != 0)
643  next->resolution.y=geometry_info.rho/geometry_info.sigma;
644  (void) DeleteImageProperty(next,"exif:YResolution");
645  }
646  value=GetImageProperty(next,"tiff:ResolutionUnit",exception);
647  if (value == (char *) NULL)
648  value=GetImageProperty(next,"exif:ResolutionUnit",exception);
649  if (value != (char *) NULL)
650  {
651  next->units=(ResolutionType) (StringToLong(value)-1);
652  (void) DeleteImageProperty(next,"exif:ResolutionUnit");
653  (void) DeleteImageProperty(next,"tiff:ResolutionUnit");
654  }
655  if (next->page.width == 0)
656  next->page.width=next->columns;
657  if (next->page.height == 0)
658  next->page.height=next->rows;
659  option=GetImageOption(read_info,"caption");
660  if (option != (const char *) NULL)
661  {
662  property=InterpretImageProperties(read_info,next,option,exception);
663  (void) SetImageProperty(next,"caption",property,exception);
664  property=DestroyString(property);
665  }
666  option=GetImageOption(read_info,"comment");
667  if (option != (const char *) NULL)
668  {
669  property=InterpretImageProperties(read_info,next,option,exception);
670  (void) SetImageProperty(next,"comment",property,exception);
671  property=DestroyString(property);
672  }
673  option=GetImageOption(read_info,"label");
674  if (option != (const char *) NULL)
675  {
676  property=InterpretImageProperties(read_info,next,option,exception);
677  (void) SetImageProperty(next,"label",property,exception);
678  property=DestroyString(property);
679  }
680  if (LocaleCompare(next->magick,"TEXT") == 0)
681  (void) ParseAbsoluteGeometry("0x0+0+0",&next->page);
682  if ((read_info->extract != (char *) NULL) &&
683  (read_info->stream == (StreamHandler) NULL))
684  {
686  geometry;
687 
688  flags=ParseAbsoluteGeometry(read_info->extract,&geometry);
689  if ((next->columns != geometry.width) ||
690  (next->rows != geometry.height))
691  {
692  if (((flags & XValue) != 0) || ((flags & YValue) != 0))
693  {
694  Image
695  *crop_image;
696 
697  crop_image=CropImage(next,&geometry,exception);
698  if (crop_image != (Image *) NULL)
699  ReplaceImageInList(&next,crop_image);
700  }
701  else
702  if (((flags & WidthValue) != 0) || ((flags & HeightValue) != 0))
703  {
704  Image
705  *size_image;
706 
707  flags=ParseRegionGeometry(next,read_info->extract,&geometry,
708  exception);
709  size_image=ResizeImage(next,geometry.width,geometry.height,
710  next->filter,exception);
711  if (size_image != (Image *) NULL)
712  ReplaceImageInList(&next,size_image);
713  }
714  }
715  }
716  profile=GetImageProfile(next,"icc");
717  if (profile == (const StringInfo *) NULL)
718  profile=GetImageProfile(next,"icm");
719  profile=GetImageProfile(next,"iptc");
720  if (profile == (const StringInfo *) NULL)
721  profile=GetImageProfile(next,"8bim");
722  (void) FormatMagickTime(GetBlobProperties(next)->st_mtime,MagickPathExtent,
723  timestamp);
724  (void) SetImageProperty(next,"date:modify",timestamp,exception);
725  (void) FormatMagickTime(GetBlobProperties(next)->st_ctime,MagickPathExtent,
726  timestamp);
727  (void) SetImageProperty(next,"date:create",timestamp,exception);
728  option=GetImageOption(image_info,"delay");
729  if (option != (const char *) NULL)
730  {
731  flags=ParseGeometry(option,&geometry_info);
732  if ((flags & GreaterValue) != 0)
733  {
734  if (next->delay > (size_t) floor(geometry_info.rho+0.5))
735  next->delay=(size_t) floor(geometry_info.rho+0.5);
736  }
737  else
738  if ((flags & LessValue) != 0)
739  {
740  if (next->delay < (size_t) floor(geometry_info.rho+0.5))
741  next->ticks_per_second=(ssize_t) floor(geometry_info.sigma+0.5);
742  }
743  else
744  next->delay=(size_t) floor(geometry_info.rho+0.5);
745  if ((flags & SigmaValue) != 0)
746  next->ticks_per_second=(ssize_t) floor(geometry_info.sigma+0.5);
747  }
748  option=GetImageOption(image_info,"dispose");
749  if (option != (const char *) NULL)
751  MagickFalse,option);
752  if (read_info->verbose != MagickFalse)
753  (void) IdentifyImage(next,stderr,MagickFalse,exception);
754  image=next;
755  }
756  read_info=DestroyImageInfo(read_info);
757  return(GetFirstImageInList(image));
758 }
759 
760 /*
761 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
762 % %
763 % %
764 % %
765 % R e a d I m a g e s %
766 % %
767 % %
768 % %
769 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
770 %
771 % ReadImages() reads one or more images and returns them as an image list.
772 %
773 % The format of the ReadImage method is:
774 %
775 % Image *ReadImages(ImageInfo *image_info,const char *filename,
776 % ExceptionInfo *exception)
777 %
778 % A description of each parameter follows:
779 %
780 % o image_info: the image info.
781 %
782 % o filename: the image filename.
783 %
784 % o exception: return any errors or warnings in this structure.
785 %
786 */
787 MagickExport Image *ReadImages(ImageInfo *image_info,const char *filename,
788  ExceptionInfo *exception)
789 {
790  char
791  read_filename[MagickPathExtent];
792 
793  Image
794  *image,
795  *images;
796 
797  ImageInfo
798  *read_info;
799 
800  /*
801  Read image list from a file.
802  */
803  assert(image_info != (ImageInfo *) NULL);
804  assert(image_info->signature == MagickCoreSignature);
805  if (image_info->debug != MagickFalse)
807  image_info->filename);
808  assert(exception != (ExceptionInfo *) NULL);
809  read_info=CloneImageInfo(image_info);
810  *read_info->magick='\0';
811  (void) SetImageOption(read_info,"filename",filename);
812  (void) CopyMagickString(read_info->filename,filename,MagickPathExtent);
813  (void) InterpretImageFilename(read_info,(Image *) NULL,filename,
814  (int) read_info->scene,read_filename,exception);
815  if (LocaleCompare(read_filename,read_info->filename) != 0)
816  {
818  *sans;
819 
820  ssize_t
821  extent,
822  scene;
823 
824  /*
825  Images of the form image-%d.png[1-5].
826  */
827  sans=AcquireExceptionInfo();
828  (void) SetImageInfo(read_info,0,sans);
829  sans=DestroyExceptionInfo(sans);
830  if (read_info->number_scenes == 0)
831  {
832  read_info=DestroyImageInfo(read_info);
833  return(ReadImage(image_info,exception));
834  }
835  (void) CopyMagickString(read_filename,read_info->filename,
837  images=NewImageList();
838  extent=(ssize_t) (read_info->scene+read_info->number_scenes);
839  for (scene=(ssize_t) read_info->scene; scene < (ssize_t) extent; scene++)
840  {
841  (void) InterpretImageFilename(image_info,(Image *) NULL,read_filename,
842  (int) scene,read_info->filename,exception);
843  image=ReadImage(read_info,exception);
844  if (image == (Image *) NULL)
845  continue;
846  AppendImageToList(&images,image);
847  }
848  read_info=DestroyImageInfo(read_info);
849  return(images);
850  }
851  image=ReadImage(read_info,exception);
852  read_info=DestroyImageInfo(read_info);
853  return(image);
854 }
855 
856 /*
857 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
858 % %
859 % %
860 % %
861 + R e a d I n l i n e I m a g e %
862 % %
863 % %
864 % %
865 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
866 %
867 % ReadInlineImage() reads a Base64-encoded inline image or image sequence.
868 % The method returns a NULL if there is a memory shortage or if the image
869 % cannot be read. On failure, a NULL image is returned and exception
870 % describes the reason for the failure.
871 %
872 % The format of the ReadInlineImage method is:
873 %
874 % Image *ReadInlineImage(const ImageInfo *image_info,const char *content,
875 % ExceptionInfo *exception)
876 %
877 % A description of each parameter follows:
878 %
879 % o image_info: the image info.
880 %
881 % o content: the image encoded in Base64.
882 %
883 % o exception: return any errors or warnings in this structure.
884 %
885 */
887  const char *content,ExceptionInfo *exception)
888 {
889  Image
890  *image;
891 
892  ImageInfo
893  *read_info;
894 
895  unsigned char
896  *blob;
897 
898  size_t
899  length;
900 
901  register const char
902  *p;
903 
904  /*
905  Skip over header (e.g. data:image/gif;base64,).
906  */
907  image=NewImageList();
908  for (p=content; (*p != ',') && (*p != '\0'); p++) ;
909  if (*p == '\0')
910  ThrowReaderException(CorruptImageError,"CorruptImage");
911  p++;
912  length=0;
913  blob=Base64Decode(p,&length);
914  if (length == 0)
915  ThrowReaderException(CorruptImageError,"CorruptImage");
916  read_info=CloneImageInfo(image_info);
917  (void) SetImageInfoProgressMonitor(read_info,(MagickProgressMonitor) NULL,
918  (void *) NULL);
919  *read_info->filename='\0';
920  *read_info->magick='\0';
921  image=BlobToImage(read_info,blob,length,exception);
922  blob=(unsigned char *) RelinquishMagickMemory(blob);
923  read_info=DestroyImageInfo(read_info);
924  return(image);
925 }
926 
927 /*
928 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
929 % %
930 % %
931 % %
932 % W r i t e I m a g e %
933 % %
934 % %
935 % %
936 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
937 %
938 % WriteImage() writes an image or an image sequence to a file or file handle.
939 % If writing to a file is on disk, the name is defined by the filename member
940 % of the image structure. WriteImage() returns MagickFalse is there is a
941 % memory shortage or if the image cannot be written. Check the exception
942 % member of image to determine the cause for any failure.
943 %
944 % The format of the WriteImage method is:
945 %
946 % MagickBooleanType WriteImage(const ImageInfo *image_info,Image *image,
947 % ExceptionInfo *exception)
948 %
949 % A description of each parameter follows:
950 %
951 % o image_info: the image info.
952 %
953 % o image: the image.
954 %
955 % o exception: return any errors or warnings in this structure.
956 %
957 */
959  Image *image,ExceptionInfo *exception)
960 {
961  char
962  filename[MagickPathExtent];
963 
964  const char
965  *option;
966 
967  const DelegateInfo
968  *delegate_info;
969 
970  const MagickInfo
971  *magick_info;
972 
974  *sans_exception;
975 
976  ImageInfo
977  *write_info;
978 
980  status,
981  temporary;
982 
984  domain;
985 
987  rights;
988 
989  /*
990  Determine image type from filename prefix or suffix (e.g. image.jpg).
991  */
992  assert(image_info != (ImageInfo *) NULL);
993  assert(image_info->signature == MagickCoreSignature);
994  if (image->debug != MagickFalse)
996  image_info->filename);
997  assert(image != (Image *) NULL);
998  assert(image->signature == MagickCoreSignature);
999  assert(exception != (ExceptionInfo *) NULL);
1000  sans_exception=AcquireExceptionInfo();
1001  write_info=CloneImageInfo(image_info);
1002  (void) CopyMagickString(write_info->filename,image->filename,
1004  (void) SetImageInfo(write_info,1,sans_exception);
1005  if (*write_info->magick == '\0')
1006  (void) CopyMagickString(write_info->magick,image->magick,MagickPathExtent);
1007  (void) CopyMagickString(filename,image->filename,MagickPathExtent);
1008  (void) CopyMagickString(image->filename,write_info->filename,
1010  domain=CoderPolicyDomain;
1011  rights=WritePolicyRights;
1012  if (IsRightsAuthorized(domain,rights,write_info->magick) == MagickFalse)
1013  {
1014  sans_exception=DestroyExceptionInfo(sans_exception);
1015  write_info=DestroyImageInfo(write_info);
1016  errno=EPERM;
1017  ThrowBinaryException(PolicyError,"NotAuthorized",filename);
1018  }
1019  /*
1020  Call appropriate image writer based on image type.
1021  */
1022  magick_info=GetMagickInfo(write_info->magick,sans_exception);
1023  sans_exception=DestroyExceptionInfo(sans_exception);
1024  if (magick_info != (const MagickInfo *) NULL)
1025  {
1026  if (GetMagickEndianSupport(magick_info) == MagickFalse)
1027  image->endian=UndefinedEndian;
1028  else
1029  if ((image_info->endian == UndefinedEndian) &&
1030  (GetMagickRawSupport(magick_info) != MagickFalse))
1031  {
1032  unsigned long
1033  lsb_first;
1034 
1035  lsb_first=1;
1036  image->endian=(*(char *) &lsb_first) == 1 ? LSBEndian : MSBEndian;
1037  }
1038  }
1039  (void) SyncImageProfiles(image);
1040  DisassociateImageStream(image);
1041  option=GetImageOption(image_info,"delegate:bimodal");
1042  if ((IsStringTrue(option) != MagickFalse) &&
1043  (write_info->page == (char *) NULL) &&
1044  (GetPreviousImageInList(image) == (Image *) NULL) &&
1045  (GetNextImageInList(image) == (Image *) NULL) &&
1046  (IsTaintImage(image) == MagickFalse) )
1047  {
1048  delegate_info=GetDelegateInfo(image->magick,write_info->magick,exception);
1049  if ((delegate_info != (const DelegateInfo *) NULL) &&
1050  (GetDelegateMode(delegate_info) == 0) &&
1052  {
1053  /*
1054  Process image with bi-modal delegate.
1055  */
1056  (void) CopyMagickString(image->filename,image->magick_filename,
1058  status=InvokeDelegate(write_info,image,image->magick,
1059  write_info->magick,exception);
1060  write_info=DestroyImageInfo(write_info);
1061  (void) CopyMagickString(image->filename,filename,MagickPathExtent);
1062  return(status);
1063  }
1064  }
1065  status=MagickFalse;
1066  temporary=MagickFalse;
1067  if ((magick_info != (const MagickInfo *) NULL) &&
1068  (GetMagickSeekableStream(magick_info) != MagickFalse))
1069  {
1070  char
1071  image_filename[MagickPathExtent];
1072 
1073  (void) CopyMagickString(image_filename,image->filename,MagickPathExtent);
1074  status=OpenBlob(image_info,image,WriteBinaryBlobMode,exception);
1075  (void) CopyMagickString(image->filename, image_filename,MagickPathExtent);
1076  if (status != MagickFalse)
1077  {
1078  if (IsBlobSeekable(image) == MagickFalse)
1079  {
1080  /*
1081  A seekable stream is required by the encoder.
1082  */
1083  write_info->adjoin=MagickTrue;
1084  (void) CopyMagickString(write_info->filename,image->filename,
1086  (void) AcquireUniqueFilename(image->filename);
1087  temporary=MagickTrue;
1088  }
1089  (void) CloseBlob(image);
1090  }
1091  }
1092  if ((magick_info != (const MagickInfo *) NULL) &&
1093  (GetImageEncoder(magick_info) != (EncodeImageHandler *) NULL))
1094  {
1095  /*
1096  Call appropriate image writer based on image type.
1097  */
1098  if (GetMagickEncoderThreadSupport(magick_info) == MagickFalse)
1099  LockSemaphoreInfo(magick_info->semaphore);
1100  status=GetImageEncoder(magick_info)(write_info,image,exception);
1101  if (GetMagickEncoderThreadSupport(magick_info) == MagickFalse)
1102  UnlockSemaphoreInfo(magick_info->semaphore);
1103  }
1104  else
1105  {
1106  delegate_info=GetDelegateInfo((char *) NULL,write_info->magick,exception);
1107  if (delegate_info != (DelegateInfo *) NULL)
1108  {
1109  /*
1110  Process the image with delegate.
1111  */
1112  *write_info->filename='\0';
1113  if (GetDelegateThreadSupport(delegate_info) == MagickFalse)
1114  LockSemaphoreInfo(delegate_info->semaphore);
1115  status=InvokeDelegate(write_info,image,(char *) NULL,
1116  write_info->magick,exception);
1117  if (GetDelegateThreadSupport(delegate_info) == MagickFalse)
1118  UnlockSemaphoreInfo(delegate_info->semaphore);
1119  (void) CopyMagickString(image->filename,filename,MagickPathExtent);
1120  }
1121  else
1122  {
1123  sans_exception=AcquireExceptionInfo();
1124  magick_info=GetMagickInfo(write_info->magick,sans_exception);
1125  sans_exception=DestroyExceptionInfo(sans_exception);
1126  if ((write_info->affirm == MagickFalse) &&
1127  (magick_info == (const MagickInfo *) NULL))
1128  {
1129  (void) CopyMagickString(write_info->magick,image->magick,
1131  magick_info=GetMagickInfo(write_info->magick,exception);
1132  }
1133  if ((magick_info == (const MagickInfo *) NULL) ||
1134  (GetImageEncoder(magick_info) == (EncodeImageHandler *) NULL))
1135  {
1136  char
1137  extension[MagickPathExtent];
1138 
1139  GetPathComponent(image->filename,ExtensionPath,extension);
1140  if (*extension != '\0')
1141  magick_info=GetMagickInfo(extension,exception);
1142  else
1143  magick_info=GetMagickInfo(image->magick,exception);
1144  (void) CopyMagickString(image->filename,filename,
1146  }
1147  if ((magick_info == (const MagickInfo *) NULL) ||
1148  (GetImageEncoder(magick_info) == (EncodeImageHandler *) NULL))
1149  {
1150  magick_info=GetMagickInfo(image->magick,exception);
1151  if ((magick_info == (const MagickInfo *) NULL) ||
1152  (GetImageEncoder(magick_info) == (EncodeImageHandler *) NULL))
1153  (void) ThrowMagickException(exception,GetMagickModule(),
1154  MissingDelegateError,"NoEncodeDelegateForThisImageFormat",
1155  "`%s'",write_info->magick);
1156  else
1157  (void) ThrowMagickException(exception,GetMagickModule(),
1158  MissingDelegateWarning,"NoEncodeDelegateForThisImageFormat",
1159  "`%s'",write_info->magick);
1160  }
1161  if ((magick_info != (const MagickInfo *) NULL) &&
1162  (GetImageEncoder(magick_info) != (EncodeImageHandler *) NULL))
1163  {
1164  /*
1165  Call appropriate image writer based on image type.
1166  */
1167  if (GetMagickEncoderThreadSupport(magick_info) == MagickFalse)
1168  LockSemaphoreInfo(magick_info->semaphore);
1169  status=GetImageEncoder(magick_info)(write_info,image,exception);
1170  if (GetMagickEncoderThreadSupport(magick_info) == MagickFalse)
1171  UnlockSemaphoreInfo(magick_info->semaphore);
1172  }
1173  }
1174  }
1175  if (temporary != MagickFalse)
1176  {
1177  /*
1178  Copy temporary image file to permanent.
1179  */
1180  status=OpenBlob(write_info,image,ReadBinaryBlobMode,exception);
1181  if (status != MagickFalse)
1182  {
1183  (void) RelinquishUniqueFileResource(write_info->filename);
1184  status=ImageToFile(image,write_info->filename,exception);
1185  }
1186  (void) CloseBlob(image);
1187  (void) RelinquishUniqueFileResource(image->filename);
1188  (void) CopyMagickString(image->filename,write_info->filename,
1190  }
1191  if ((LocaleCompare(write_info->magick,"info") != 0) &&
1192  (write_info->verbose != MagickFalse))
1193  (void) IdentifyImage(image,stdout,MagickFalse,exception);
1194  write_info=DestroyImageInfo(write_info);
1195  return(status);
1196 }
1197 
1198 /*
1199 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1200 % %
1201 % %
1202 % %
1203 % W r i t e I m a g e s %
1204 % %
1205 % %
1206 % %
1207 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1208 %
1209 % WriteImages() writes an image sequence into one or more files. While
1210 % WriteImage() can write an image sequence, it is limited to writing
1211 % the sequence into a single file using a format which supports multiple
1212 % frames. WriteImages(), however, does not have this limitation, instead it
1213 % generates multiple output files if necessary (or when requested). When
1214 % ImageInfo's adjoin flag is set to MagickFalse, the file name is expected
1215 % to include a printf-style formatting string for the frame number (e.g.
1216 % "image%02d.png").
1217 %
1218 % The format of the WriteImages method is:
1219 %
1220 % MagickBooleanType WriteImages(const ImageInfo *image_info,Image *images,
1221 % const char *filename,ExceptionInfo *exception)
1222 %
1223 % A description of each parameter follows:
1224 %
1225 % o image_info: the image info.
1226 %
1227 % o images: the image list.
1228 %
1229 % o filename: the image filename.
1230 %
1231 % o exception: return any errors or warnings in this structure.
1232 %
1233 */
1235  Image *images,const char *filename,ExceptionInfo *exception)
1236 {
1237 #define WriteImageTag "Write/Image"
1238 
1240  *sans_exception;
1241 
1242  ImageInfo
1243  *write_info;
1244 
1246  proceed;
1247 
1249  progress;
1250 
1252  progress_monitor;
1253 
1255  number_images;
1256 
1258  status;
1259 
1260  register Image
1261  *p;
1262 
1263  assert(image_info != (const ImageInfo *) NULL);
1264  assert(image_info->signature == MagickCoreSignature);
1265  assert(images != (Image *) NULL);
1266  assert(images->signature == MagickCoreSignature);
1267  if (images->debug != MagickFalse)
1268  (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",images->filename);
1269  assert(exception != (ExceptionInfo *) NULL);
1270  write_info=CloneImageInfo(image_info);
1271  *write_info->magick='\0';
1272  images=GetFirstImageInList(images);
1273  if (filename != (const char *) NULL)
1274  for (p=images; p != (Image *) NULL; p=GetNextImageInList(p))
1275  (void) CopyMagickString(p->filename,filename,MagickPathExtent);
1276  (void) CopyMagickString(write_info->filename,images->filename,
1278  sans_exception=AcquireExceptionInfo();
1279  (void) SetImageInfo(write_info,(unsigned int) GetImageListLength(images),
1280  sans_exception);
1281  sans_exception=DestroyExceptionInfo(sans_exception);
1282  if (*write_info->magick == '\0')
1283  (void) CopyMagickString(write_info->magick,images->magick,MagickPathExtent);
1284  p=images;
1285  for ( ; GetNextImageInList(p) != (Image *) NULL; p=GetNextImageInList(p))
1286  {
1287  register Image
1288  *next;
1289 
1290  next=GetNextImageInList(p);
1291  if (next == (Image *) NULL)
1292  break;
1293  if (p->scene >= next->scene)
1294  {
1295  register ssize_t
1296  i;
1297 
1298  /*
1299  Generate consistent scene numbers.
1300  */
1301  i=(ssize_t) images->scene;
1302  for (p=images; p != (Image *) NULL; p=GetNextImageInList(p))
1303  p->scene=(size_t) i++;
1304  break;
1305  }
1306  }
1307  /*
1308  Write images.
1309  */
1310  status=MagickTrue;
1311  progress_monitor=(MagickProgressMonitor) NULL;
1312  progress=0;
1313  number_images=GetImageListLength(images);
1314  for (p=images; p != (Image *) NULL; p=GetNextImageInList(p))
1315  {
1316  if (number_images != 1)
1317  progress_monitor=SetImageProgressMonitor(p,(MagickProgressMonitor) NULL,
1318  p->client_data);
1319  status&=WriteImage(write_info,p,exception);
1320  if (number_images != 1)
1321  (void) SetImageProgressMonitor(p,progress_monitor,p->client_data);
1322  if (write_info->adjoin != MagickFalse)
1323  break;
1324  if (number_images != 1)
1325  {
1326  proceed=SetImageProgress(p,WriteImageTag,progress++,number_images);
1327  if (proceed == MagickFalse)
1328  break;
1329  }
1330  }
1331  write_info=DestroyImageInfo(write_info);
1332  return(status != 0 ? MagickTrue : MagickFalse);
1333 }
size_t rows
Definition: image.h:175
MagickExport Image * ResizeImage(const Image *image, const size_t columns, const size_t rows, const FilterType filter, ExceptionInfo *exception)
Definition: resize.c:2819
MagickExport Image * CloneImages(const Image *images, const char *scenes, ExceptionInfo *exception)
Definition: list.c:199
EndianType endian
Definition: image.h:395
size_t signature
Definition: image.h:479
static MagickBooleanType SetImageProgress(const Image *image, const char *tag, const MagickOffsetType offset, const MagickSizeType extent)
DisposeType dispose
Definition: image.h:240
char magick[MagickPathExtent]
Definition: image.h:471
MagickExport MagickBooleanType GetDelegateThreadSupport(const DelegateInfo *delegate_info)
Definition: delegate.c:1474
char * scenes
Definition: image.h:381
MagickExport MagickBooleanType IsRightsAuthorized(const PolicyDomain domain, const PolicyRights rights, const char *pattern)
Definition: policy.c:568
ssize_t ticks_per_second
Definition: image.h:248
FilterType filter
Definition: image.h:222
MagickExport void UnlockSemaphoreInfo(SemaphoreInfo *semaphore_info)
Definition: semaphore.c:449
MagickExport ssize_t ParseCommandOption(const CommandOption option, const MagickBooleanType list, const char *options)
Definition: option.c:2647
OrientationType
Definition: image.h:79
char * extract
Definition: image.h:381
PolicyRights
Definition: policy.h:40
size_t signature
Definition: exception.h:123
size_t number_scenes
Definition: image.h:387
MagickExport Image * PingImage(const ImageInfo *image_info, ExceptionInfo *exception)
Definition: constitute.c:209
double rho
Definition: geometry.h:105
MagickExport MagickStatusType ParseAbsoluteGeometry(const char *geometry, RectangleInfo *region_info)
Definition: geometry.c:686
EndianType endian
Definition: image.h:231
MagickBooleanType taint
Definition: image.h:172
StorageType
Definition: pixel.h:140
MagickExport MagickBooleanType IdentifyImage(Image *image, FILE *file, const MagickBooleanType verbose, ExceptionInfo *exception)
Definition: identify.c:428
MagickBooleanType debug
Definition: image.h:476
MagickExport MagickBooleanType GetMagickEncoderThreadSupport(const MagickInfo *magick_info)
Definition: magick.c:462
MagickExport const DelegateInfo * GetDelegateInfo(const char *decode, const char *encode, ExceptionInfo *exception)
Definition: delegate.c:1159
MagickExport Image * ReadInlineImage(const ImageInfo *image_info, const char *content, ExceptionInfo *exception)
Definition: constitute.c:886
MagickExport ExceptionInfo * AcquireExceptionInfo(void)
Definition: exception.c:107
MagickExport ssize_t GetDelegateMode(const DelegateInfo *delegate_info)
Definition: delegate.c:1441
MagickBooleanType EncodeImageHandler(const ImageInfo *, Image *, ExceptionInfo *)
Definition: magick.h:53
ResolutionType units
Definition: image.h:201
size_t delay
Definition: image.h:243
#define WriteImageTag
char magick[MagickPathExtent]
Definition: image.h:322
size_t magick_rows
Definition: image.h:327
MagickExport MagickBooleanType ImageToFile(Image *image, char *filename, ExceptionInfo *exception)
Definition: blob.c:1653
MagickBooleanType verbose
Definition: image.h:436
static long StringToLong(const char *magick_restrict value)
MagickExport const char * GetImageOption(const ImageInfo *image_info, const char *option)
Definition: option.c:1986
double sigma
Definition: geometry.h:105
size_t width
Definition: geometry.h:129
MagickExport MagickBooleanType AcquireUniqueFilename(char *path)
Definition: utility.c:111
#define ThrowBinaryException(severity, tag, context)
Definition: log.h:52
ssize_t MagickOffsetType
Definition: magick-type.h:116
MagickExport MagickBooleanType SetImageOption(ImageInfo *image_info, const char *option, const char *value)
Definition: option.c:2917
Definition: image.h:154
MagickExport Image * GetPreviousImageInList(const Image *images)
Definition: list.c:784
SemaphoreInfo * semaphore
Definition: delegate.h:45
StreamHandler stream
Definition: image.h:459
MagickExport MagickBooleanType GetMagickRawSupport(const MagickInfo *magick_info)
Definition: magick.c:840
MagickExport Image * CropImage(const Image *image, const RectangleInfo *geometry, ExceptionInfo *exception)
Definition: transform.c:532
MagickExport const struct stat * GetBlobProperties(const Image *)
Definition: blob.c:1342
double x
Definition: geometry.h:122
MagickExport Image * PingImages(ImageInfo *image_info, const char *filename, ExceptionInfo *exception)
Definition: constitute.c:264
#define MagickCoreSignature
MagickExport MagickBooleanType ImportImagePixels(Image *image, const ssize_t x, const ssize_t y, const size_t width, const size_t height, const char *map, const StorageType type, const void *pixels, ExceptionInfo *exception)
Definition: pixel.c:4124
MagickExport void LockSemaphoreInfo(SemaphoreInfo *semaphore_info)
Definition: semaphore.c:292
MagickExport Image * GetFirstImageInList(const Image *images)
Definition: list.c:541
SemaphoreInfo * semaphore
Definition: magick.h:87
MagickExport Image * BlobToImage(const ImageInfo *image_info, const void *blob, const size_t length, ExceptionInfo *exception)
Definition: blob.c:319
MagickExport void GetPathComponent(const char *path, PathType type, char *component)
Definition: utility.c:1198
MagickBooleanType
Definition: magick-type.h:145
MagickExport Image * NewImageList(void)
Definition: list.c:916
size_t scene
Definition: image.h:243
unsigned int MagickStatusType
Definition: magick-type.h:108
MagickExport MagickBooleanType WriteImage(const ImageInfo *image_info, Image *image, ExceptionInfo *exception)
Definition: constitute.c:958
MagickExport unsigned char * Base64Decode(const char *source, size_t *length)
Definition: utility.c:332
char filename[MagickPathExtent]
Definition: image.h:471
double y
Definition: geometry.h:122
MagickExport MagickBooleanType RelinquishUniqueFileResource(const char *path)
Definition: resource.c:987
MagickExport MagickBooleanType CloseBlob(Image *)
MagickExport MagickBooleanType SetImageProperty(Image *image, const char *property, const char *value, ExceptionInfo *exception)
Definition: property.c:3938
MagickExport const StringInfo * GetImageProfile(const Image *image, const char *name)
Definition: profile.c:248
MagickExport ssize_t FormatMagickTime(const time_t time, const size_t length, char *timestamp)
Definition: string.c:1170
size_t scene
Definition: image.h:387
#define magick_unused(x)
RectangleInfo page
Definition: image.h:215
size_t magick_columns
Definition: image.h:327
size_t MagickSizeType
Definition: magick-type.h:117
#define MagickPathExtent
MagickExport MagickBooleanType IsStringTrue(const char *value)
Definition: string.c:1458
MagickExport MagickBooleanType IsBlobTemporary(const Image *image)
Definition: blob.c:2140
#define ThrowFileException(exception, severity, tag, context)
static size_t PingStream(const Image *magick_unused(image), const void *magick_unused(pixels), const size_t columns)
Definition: constitute.c:197
MagickExport Image * ReadImage(const ImageInfo *image_info, ExceptionInfo *exception)
Definition: constitute.c:357
MagickBooleanType LogMagickEvent(const LogEventType type, const char *module, const char *function, const size_t line, const char *format,...)
Definition: log.c:1384
MagickExport MagickBooleanType SetImageInfo(ImageInfo *image_info, const unsigned int frames, ExceptionInfo *exception)
Definition: image.c:2494
#define ThrowReaderException(severity, tag)
char magick_filename[MagickPathExtent]
Definition: image.h:322
MagickExport DecodeImageHandler * GetImageDecoder(const MagickInfo *magick_info)
Definition: magick.c:212
MagickExport MagickBooleanType ThrowMagickException(ExceptionInfo *exception, const char *module, const char *function, const size_t line, const ExceptionType severity, const char *tag, const char *format,...)
Definition: exception.c:1061
MagickExport MagickBooleanType IsPathAccessible(const char *path)
Definition: utility.c:1451
MagickExport MagickBooleanType SetImageBackgroundColor(Image *image, ExceptionInfo *exception)
Definition: image.c:2215
size_t signature
Definition: image.h:357
size_t columns
Definition: image.h:175
MagickExport const MagickInfo * GetMagickInfo(const char *name, ExceptionInfo *exception)
Definition: magick.c:529
MagickExport Image * AcquireImage(const ImageInfo *image_info, ExceptionInfo *exception)
Definition: image.c:152
MagickExport MagickBooleanType OpenBlob(const ImageInfo *, Image *, const BlobMode, ExceptionInfo *)
MagickBooleanType(* MagickProgressMonitor)(const char *, const MagickOffsetType, const MagickSizeType, void *)
Definition: monitor.h:26
size_t height
Definition: geometry.h:129
MagickExport void ResetTimer(TimerInfo *time_info)
Definition: timer.c:331
MagickExport EncodeImageHandler * GetImageEncoder(const MagickInfo *magick_info)
Definition: magick.c:241
MagickExport Image * ReadStream(const ImageInfo *image_info, StreamHandler stream, ExceptionInfo *exception)
Definition: stream.c:971
MagickExport MagickProgressMonitor SetImageProgressMonitor(Image *image, const MagickProgressMonitor progress_monitor, void *client_data)
Definition: monitor.c:85
MagickExport size_t CopyMagickString(char *destination, const char *source, const size_t length)
Definition: string.c:743
MagickExport Image * DestroyImageList(Image *images)
Definition: list.c:442
MagickExport MagickBooleanType GetMagickEndianSupport(const MagickInfo *magick_info)
Definition: magick.c:494
MagickExport size_t InterpretImageFilename(const ImageInfo *image_info, Image *image, const char *format, int value, char *filename, ExceptionInfo *exception)
Definition: image.c:1609
MagickExport MagickBooleanType IsBlobSeekable(const Image *image)
Definition: blob.c:2091
MagickExport Image * ReadImages(ImageInfo *image_info, const char *filename, ExceptionInfo *exception)
Definition: constitute.c:787
TimerInfo timer
Definition: image.h:303
PolicyDomain
Definition: policy.h:28
MagickExport int LocaleCompare(const char *p, const char *q)
Definition: locale.c:1412
MagickExport MagickBooleanType GetMagickDecoderThreadSupport(const MagickInfo *magick_info)
Definition: magick.c:400
DisposeType
Definition: layer.h:27
char filename[MagickPathExtent]
Definition: image.h:322
#define GetMagickModule()
Definition: log.h:28
MagickBooleanType affirm
Definition: image.h:375
#define ThrowImageException(severity, tag)
MagickExport Image * ConstituteImage(const size_t columns, const size_t rows, const char *map, const StorageType storage, const void *pixels, ExceptionInfo *exception)
Definition: constitute.c:132
MagickExport char * InterpretImageProperties(ImageInfo *image_info, Image *image, const char *embed_text, ExceptionInfo *exception)
Definition: property.c:3263
MagickExport ImageInfo * DestroyImageInfo(ImageInfo *image_info)
Definition: image.c:1238
MagickExport MagickBooleanType IsTaintImage(const Image *image)
Definition: image.c:1913
MagickExport void ReplaceImageInList(Image **images, Image *replace)
Definition: list.c:1144
MagickExport Image * GetNextImageInList(const Image *images)
Definition: list.c:752
MagickExport char * DestroyString(char *string)
Definition: string.c:813
MagickExport MagickBooleanType DeleteImageProperty(Image *image, const char *property)
Definition: property.c:279
MagickExport const char * GetImageProperty(const Image *image, const char *property, ExceptionInfo *exception)
Definition: property.c:2169
MagickExport ImageInfo * CloneImageInfo(const ImageInfo *image_info)
Definition: image.c:939
MagickExport MagickStatusType ParseGeometry(const char *geometry, GeometryInfo *geometry_info)
Definition: geometry.c:836
MagickExport void AppendImageToList(Image **images, const Image *append)
Definition: list.c:77
MagickPrivate MagickBooleanType SyncImageProfiles(Image *)
Definition: profile.c:2126
MagickExport void * RelinquishMagickMemory(void *memory)
Definition: memory.c:997
PointInfo resolution
Definition: image.h:212
#define magick_unreferenced(x)
MagickExport MagickProgressMonitor SetImageInfoProgressMonitor(ImageInfo *image_info, const MagickProgressMonitor progress_monitor, void *client_data)
Definition: monitor.c:134
MagickExport MagickBooleanType InvokeDelegate(ImageInfo *image_info, Image *image, const char *decode, const char *encode, ExceptionInfo *exception)
Definition: delegate.c:1624
ResolutionType
Definition: image.h:92
#define MagickExport
OrientationType orientation
Definition: image.h:169
MagickExport MagickBooleanType GetMagickSeekableStream(const MagickInfo *magick_info)
Definition: magick.c:872
MagickBooleanType adjoin
Definition: image.h:375
char * page
Definition: image.h:381
MagickBooleanType ping
Definition: image.h:436
MagickExport MagickBooleanType IsSceneGeometry(const char *geometry, const MagickBooleanType pedantic)
Definition: geometry.c:634
MagickExport size_t GetImageListLength(const Image *images)
Definition: list.c:680
void * client_data
Definition: image.h:309
MagickExport Image * DestroyImage(Image *image)
Definition: image.c:1167
MagickExport MagickStatusType ParseRegionGeometry(const Image *image, const char *geometry, RectangleInfo *region_info, ExceptionInfo *exception)
Definition: geometry.c:1532
MagickExport void DisassociateImageStream(Image *image)
Definition: image.c:1300
size_t(* StreamHandler)(const Image *, const void *, const size_t)
Definition: stream.h:29
MagickBooleanType temporary
Definition: image.h:375
MagickBooleanType debug
Definition: image.h:337
MagickExport ExceptionInfo * DestroyExceptionInfo(ExceptionInfo *exception)
Definition: exception.c:420
MagickExport MagickBooleanType WriteImages(const ImageInfo *image_info, Image *images, const char *filename, ExceptionInfo *exception)
Definition: constitute.c:1234
ExceptionType severity
Definition: exception.h:104
Image * DecodeImageHandler(const ImageInfo *, ExceptionInfo *)
Definition: magick.h:50