MagickCore  7.0.3
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,
313  images=NewImageList();
314  extent=(ssize_t) (read_info->scene+read_info->number_scenes);
315  for (scene=(ssize_t) read_info->scene; scene < (ssize_t) extent; scene++)
316  {
317  (void) InterpretImageFilename(image_info,(Image *) NULL,ping_filename,
318  (int) scene,read_info->filename,exception);
319  image=PingImage(read_info,exception);
320  if (image == (Image *) NULL)
321  continue;
322  AppendImageToList(&images,image);
323  }
324  read_info=DestroyImageInfo(read_info);
325  return(images);
326  }
327  return(PingImage(image_info,exception));
328 }
329 
330 /*
331 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
332 % %
333 % %
334 % %
335 % R e a d I m a g e %
336 % %
337 % %
338 % %
339 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
340 %
341 % ReadImage() reads an image or image sequence from a file or file handle.
342 % The method returns a NULL if there is a memory shortage or if the image
343 % cannot be read. On failure, a NULL image is returned and exception
344 % describes the reason for the failure.
345 %
346 % The format of the ReadImage method is:
347 %
348 % Image *ReadImage(const ImageInfo *image_info,ExceptionInfo *exception)
349 %
350 % A description of each parameter follows:
351 %
352 % o image_info: Read the image defined by the file or filename members of
353 % this structure.
354 %
355 % o exception: return any errors or warnings in this structure.
356 %
357 */
359  ExceptionInfo *exception)
360 {
361  char
362  filename[MagickPathExtent],
363  magick[MagickPathExtent],
364  magick_filename[MagickPathExtent];
365 
366  const char
367  *value;
368 
369  const DelegateInfo
370  *delegate_info;
371 
372  const MagickInfo
373  *magick_info;
374 
376  *sans_exception;
377 
379  geometry_info;
380 
381  Image
382  *image,
383  *next;
384 
385  ImageInfo
386  *read_info;
387 
389  flags;
390 
392  domain;
393 
395  rights;
396 
397  /*
398  Determine image type from filename prefix or suffix (e.g. image.jpg).
399  */
400  assert(image_info != (ImageInfo *) NULL);
401  assert(image_info->signature == MagickCoreSignature);
402  assert(image_info->filename != (char *) NULL);
403  if (image_info->debug != MagickFalse)
405  image_info->filename);
406  assert(exception != (ExceptionInfo *) NULL);
407  read_info=CloneImageInfo(image_info);
408  (void) CopyMagickString(magick_filename,read_info->filename,MagickPathExtent);
409  (void) SetImageInfo(read_info,0,exception);
410  (void) CopyMagickString(filename,read_info->filename,MagickPathExtent);
411  (void) CopyMagickString(magick,read_info->magick,MagickPathExtent);
412  domain=CoderPolicyDomain;
413  rights=ReadPolicyRights;
414  if (IsRightsAuthorized(domain,rights,read_info->magick) == MagickFalse)
415  {
416  errno=EPERM;
418  "NotAuthorized","`%s'",read_info->filename);
419  read_info=DestroyImageInfo(read_info);
420  return((Image *) NULL);
421  }
422  /*
423  Call appropriate image reader based on image type.
424  */
425  sans_exception=AcquireExceptionInfo();
426  magick_info=GetMagickInfo(read_info->magick,sans_exception);
427  sans_exception=DestroyExceptionInfo(sans_exception);
428  if (magick_info != (const MagickInfo *) NULL)
429  {
430  if (GetMagickEndianSupport(magick_info) == MagickFalse)
431  read_info->endian=UndefinedEndian;
432  else
433  if ((image_info->endian == UndefinedEndian) &&
434  (GetMagickRawSupport(magick_info) != MagickFalse))
435  {
436  unsigned long
437  lsb_first;
438 
439  lsb_first=1;
440  read_info->endian=(*(char *) &lsb_first) == 1 ? LSBEndian :
441  MSBEndian;
442  }
443  }
444  if ((magick_info != (const MagickInfo *) NULL) &&
445  (GetMagickSeekableStream(magick_info) != MagickFalse))
446  {
448  status;
449 
450  image=AcquireImage(read_info,exception);
451  (void) CopyMagickString(image->filename,read_info->filename,
453  status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
454  if (status == MagickFalse)
455  {
456  read_info=DestroyImageInfo(read_info);
457  image=DestroyImage(image);
458  return((Image *) NULL);
459  }
460  if (IsBlobSeekable(image) == MagickFalse)
461  {
462  /*
463  Coder requires a seekable stream.
464  */
465  *read_info->filename='\0';
466  status=ImageToFile(image,read_info->filename,exception);
467  if (status == MagickFalse)
468  {
469  (void) CloseBlob(image);
470  read_info=DestroyImageInfo(read_info);
471  image=DestroyImage(image);
472  return((Image *) NULL);
473  }
474  read_info->temporary=MagickTrue;
475  }
476  (void) CloseBlob(image);
477  image=DestroyImage(image);
478  }
479  image=NewImageList();
480  if ((magick_info == (const MagickInfo *) NULL) ||
481  (GetImageDecoder(magick_info) == (DecodeImageHandler *) NULL))
482  {
483  delegate_info=GetDelegateInfo(read_info->magick,(char *) NULL,exception);
484  if (delegate_info == (const DelegateInfo *) NULL)
485  {
486  (void) SetImageInfo(read_info,0,exception);
487  (void) CopyMagickString(read_info->filename,filename,
489  magick_info=GetMagickInfo(read_info->magick,exception);
490  }
491  }
492  if ((magick_info != (const MagickInfo *) NULL) &&
493  (GetImageDecoder(magick_info) != (DecodeImageHandler *) NULL))
494  {
495  if (GetMagickDecoderThreadSupport(magick_info) == MagickFalse)
496  LockSemaphoreInfo(magick_info->semaphore);
497  image=GetImageDecoder(magick_info)(read_info,exception);
498  if (GetMagickDecoderThreadSupport(magick_info) == MagickFalse)
499  UnlockSemaphoreInfo(magick_info->semaphore);
500  }
501  else
502  {
504  status;
505 
506  delegate_info=GetDelegateInfo(read_info->magick,(char *) NULL,exception);
507  if (delegate_info == (const DelegateInfo *) NULL)
508  {
509  (void) ThrowMagickException(exception,GetMagickModule(),
510  MissingDelegateError,"NoDecodeDelegateForThisImageFormat","`%s'",
511  read_info->magick);
512  if (read_info->temporary != MagickFalse)
513  (void) RelinquishUniqueFileResource(read_info->filename);
514  read_info=DestroyImageInfo(read_info);
515  return((Image *) NULL);
516  }
517  /*
518  Let our decoding delegate process the image.
519  */
520  image=AcquireImage(read_info,exception);
521  if (image == (Image *) NULL)
522  {
523  read_info=DestroyImageInfo(read_info);
524  return((Image *) NULL);
525  }
526  (void) CopyMagickString(image->filename,read_info->filename,
528  *read_info->filename='\0';
529  if (GetDelegateThreadSupport(delegate_info) == MagickFalse)
530  LockSemaphoreInfo(delegate_info->semaphore);
531  status=InvokeDelegate(read_info,image,read_info->magick,(char *) NULL,
532  exception);
533  if (GetDelegateThreadSupport(delegate_info) == MagickFalse)
534  UnlockSemaphoreInfo(delegate_info->semaphore);
535  image=DestroyImageList(image);
536  read_info->temporary=MagickTrue;
537  if (status != MagickFalse)
538  (void) SetImageInfo(read_info,0,exception);
539  magick_info=GetMagickInfo(read_info->magick,exception);
540  if ((magick_info == (const MagickInfo *) NULL) ||
541  (GetImageDecoder(magick_info) == (DecodeImageHandler *) NULL))
542  {
543  if (IsPathAccessible(read_info->filename) != MagickFalse)
544  (void) ThrowMagickException(exception,GetMagickModule(),
545  MissingDelegateError,"NoDecodeDelegateForThisImageFormat","`%s'",
546  read_info->magick);
547  else
548  ThrowFileException(exception,FileOpenError,"UnableToOpenFile",
549  read_info->filename);
550  read_info=DestroyImageInfo(read_info);
551  return((Image *) NULL);
552  }
553  if (GetMagickDecoderThreadSupport(magick_info) == MagickFalse)
554  LockSemaphoreInfo(magick_info->semaphore);
555  image=(Image *) (GetImageDecoder(magick_info))(read_info,exception);
556  if (GetMagickDecoderThreadSupport(magick_info) == MagickFalse)
557  UnlockSemaphoreInfo(magick_info->semaphore);
558  }
559  if (read_info->temporary != MagickFalse)
560  {
561  (void) RelinquishUniqueFileResource(read_info->filename);
562  read_info->temporary=MagickFalse;
563  if (image != (Image *) NULL)
564  (void) CopyMagickString(image->filename,filename,MagickPathExtent);
565  }
566  if (image == (Image *) NULL)
567  {
568  read_info=DestroyImageInfo(read_info);
569  return(image);
570  }
571  if (exception->severity >= ErrorException)
573  "Coder (%s) generated an image despite an error (%d), "
574  "notify the developers",image->magick,exception->severity);
575  if (IsBlobTemporary(image) != MagickFalse)
576  (void) RelinquishUniqueFileResource(read_info->filename);
577  if ((GetNextImageInList(image) != (Image *) NULL) &&
579  {
580  Image
581  *clones;
582 
583  clones=CloneImages(image,read_info->scenes,exception);
584  if (clones == (Image *) NULL)
586  "SubimageSpecificationReturnsNoImages","`%s'",read_info->filename);
587  else
588  {
589  image=DestroyImageList(image);
590  image=GetFirstImageInList(clones);
591  }
592  }
593  for (next=image; next != (Image *) NULL; next=GetNextImageInList(next))
594  {
595  char
596  magick_path[MagickPathExtent],
597  *property,
598  timestamp[MagickPathExtent];
599 
600  const char
601  *option;
602 
603  const StringInfo
604  *profile;
605 
606  next->taint=MagickFalse;
607  GetPathComponent(magick_filename,MagickPath,magick_path);
608  if (*magick_path == '\0' && *next->magick == '\0')
609  (void) CopyMagickString(next->magick,magick,MagickPathExtent);
610  (void) CopyMagickString(next->magick_filename,magick_filename,
612  if (IsBlobTemporary(image) != MagickFalse)
613  (void) CopyMagickString(next->filename,filename,MagickPathExtent);
614  if (next->magick_columns == 0)
615  next->magick_columns=next->columns;
616  if (next->magick_rows == 0)
617  next->magick_rows=next->rows;
618  value=GetImageProperty(next,"tiff:Orientation",exception);
619  if (value == (char *) NULL)
620  value=GetImageProperty(next,"exif:Orientation",exception);
621  if (value != (char *) NULL)
622  {
624  (void) DeleteImageProperty(next,"tiff:Orientation");
625  (void) DeleteImageProperty(next,"exif:Orientation");
626  }
627  value=GetImageProperty(next,"exif:XResolution",exception);
628  if (value != (char *) NULL)
629  {
630  geometry_info.rho=next->resolution.x;
631  geometry_info.sigma=1.0;
632  flags=ParseGeometry(value,&geometry_info);
633  if (geometry_info.sigma != 0)
634  next->resolution.x=geometry_info.rho/geometry_info.sigma;
635  (void) DeleteImageProperty(next,"exif:XResolution");
636  }
637  value=GetImageProperty(next,"exif:YResolution",exception);
638  if (value != (char *) NULL)
639  {
640  geometry_info.rho=next->resolution.y;
641  geometry_info.sigma=1.0;
642  flags=ParseGeometry(value,&geometry_info);
643  if (geometry_info.sigma != 0)
644  next->resolution.y=geometry_info.rho/geometry_info.sigma;
645  (void) DeleteImageProperty(next,"exif:YResolution");
646  }
647  value=GetImageProperty(next,"tiff:ResolutionUnit",exception);
648  if (value == (char *) NULL)
649  value=GetImageProperty(next,"exif:ResolutionUnit",exception);
650  if (value != (char *) NULL)
651  {
652  next->units=(ResolutionType) (StringToLong(value)-1);
653  (void) DeleteImageProperty(next,"exif:ResolutionUnit");
654  (void) DeleteImageProperty(next,"tiff:ResolutionUnit");
655  }
656  if (next->page.width == 0)
657  next->page.width=next->columns;
658  if (next->page.height == 0)
659  next->page.height=next->rows;
660  option=GetImageOption(read_info,"caption");
661  if (option != (const char *) NULL)
662  {
663  property=InterpretImageProperties(read_info,next,option,exception);
664  (void) SetImageProperty(next,"caption",property,exception);
665  property=DestroyString(property);
666  }
667  option=GetImageOption(read_info,"comment");
668  if (option != (const char *) NULL)
669  {
670  property=InterpretImageProperties(read_info,next,option,exception);
671  (void) SetImageProperty(next,"comment",property,exception);
672  property=DestroyString(property);
673  }
674  option=GetImageOption(read_info,"label");
675  if (option != (const char *) NULL)
676  {
677  property=InterpretImageProperties(read_info,next,option,exception);
678  (void) SetImageProperty(next,"label",property,exception);
679  property=DestroyString(property);
680  }
681  if (LocaleCompare(next->magick,"TEXT") == 0)
682  (void) ParseAbsoluteGeometry("0x0+0+0",&next->page);
683  if ((read_info->extract != (char *) NULL) &&
684  (read_info->stream == (StreamHandler) NULL))
685  {
687  geometry;
688 
689  flags=ParseAbsoluteGeometry(read_info->extract,&geometry);
690  if ((next->columns != geometry.width) ||
691  (next->rows != geometry.height))
692  {
693  if (((flags & XValue) != 0) || ((flags & YValue) != 0))
694  {
695  Image
696  *crop_image;
697 
698  crop_image=CropImage(next,&geometry,exception);
699  if (crop_image != (Image *) NULL)
700  ReplaceImageInList(&next,crop_image);
701  }
702  else
703  if (((flags & WidthValue) != 0) || ((flags & HeightValue) != 0))
704  {
705  Image
706  *size_image;
707 
708  flags=ParseRegionGeometry(next,read_info->extract,&geometry,
709  exception);
710  size_image=ResizeImage(next,geometry.width,geometry.height,
711  next->filter,exception);
712  if (size_image != (Image *) NULL)
713  ReplaceImageInList(&next,size_image);
714  }
715  }
716  }
717  profile=GetImageProfile(next,"icc");
718  if (profile == (const StringInfo *) NULL)
719  profile=GetImageProfile(next,"icm");
720  profile=GetImageProfile(next,"iptc");
721  if (profile == (const StringInfo *) NULL)
722  profile=GetImageProfile(next,"8bim");
723  (void) FormatMagickTime(GetBlobProperties(next)->st_mtime,MagickPathExtent,
724  timestamp);
725  (void) SetImageProperty(next,"date:modify",timestamp,exception);
726  (void) FormatMagickTime(GetBlobProperties(next)->st_ctime,MagickPathExtent,
727  timestamp);
728  (void) SetImageProperty(next,"date:create",timestamp,exception);
729  option=GetImageOption(image_info,"delay");
730  if (option != (const char *) NULL)
731  {
732  flags=ParseGeometry(option,&geometry_info);
733  if ((flags & GreaterValue) != 0)
734  {
735  if (next->delay > (size_t) floor(geometry_info.rho+0.5))
736  next->delay=(size_t) floor(geometry_info.rho+0.5);
737  }
738  else
739  if ((flags & LessValue) != 0)
740  {
741  if (next->delay < (size_t) floor(geometry_info.rho+0.5))
742  next->ticks_per_second=(ssize_t) floor(geometry_info.sigma+0.5);
743  }
744  else
745  next->delay=(size_t) floor(geometry_info.rho+0.5);
746  if ((flags & SigmaValue) != 0)
747  next->ticks_per_second=(ssize_t) floor(geometry_info.sigma+0.5);
748  }
749  option=GetImageOption(image_info,"dispose");
750  if (option != (const char *) NULL)
752  MagickFalse,option);
753  if (read_info->verbose != MagickFalse)
754  (void) IdentifyImage(next,stderr,MagickFalse,exception);
755  image=next;
756  }
757  read_info=DestroyImageInfo(read_info);
758  return(GetFirstImageInList(image));
759 }
760 
761 /*
762 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
763 % %
764 % %
765 % %
766 % R e a d I m a g e s %
767 % %
768 % %
769 % %
770 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
771 %
772 % ReadImages() reads one or more images and returns them as an image list.
773 %
774 % The format of the ReadImage method is:
775 %
776 % Image *ReadImages(ImageInfo *image_info,const char *filename,
777 % ExceptionInfo *exception)
778 %
779 % A description of each parameter follows:
780 %
781 % o image_info: the image info.
782 %
783 % o filename: the image filename.
784 %
785 % o exception: return any errors or warnings in this structure.
786 %
787 */
788 MagickExport Image *ReadImages(ImageInfo *image_info,const char *filename,
789  ExceptionInfo *exception)
790 {
791  char
792  read_filename[MagickPathExtent];
793 
794  Image
795  *image,
796  *images;
797 
798  ImageInfo
799  *read_info;
800 
801  /*
802  Read image list from a file.
803  */
804  assert(image_info != (ImageInfo *) NULL);
805  assert(image_info->signature == MagickCoreSignature);
806  if (image_info->debug != MagickFalse)
808  image_info->filename);
809  assert(exception != (ExceptionInfo *) NULL);
810  read_info=CloneImageInfo(image_info);
811  *read_info->magick='\0';
812  (void) SetImageOption(read_info,"filename",filename);
813  (void) CopyMagickString(read_info->filename,filename,MagickPathExtent);
814  (void) InterpretImageFilename(read_info,(Image *) NULL,filename,
815  (int) read_info->scene,read_filename,exception);
816  if (LocaleCompare(read_filename,read_info->filename) != 0)
817  {
819  *sans;
820 
821  ssize_t
822  extent,
823  scene;
824 
825  /*
826  Images of the form image-%d.png[1-5].
827  */
828  sans=AcquireExceptionInfo();
829  (void) SetImageInfo(read_info,0,sans);
830  sans=DestroyExceptionInfo(sans);
831  if (read_info->number_scenes != 0)
832  {
833  (void) CopyMagickString(read_filename,read_info->filename,
835  images=NewImageList();
836  extent=(ssize_t) (read_info->scene+read_info->number_scenes);
837  scene=(ssize_t) read_info->scene;
838  for ( ; scene < (ssize_t) extent; scene++)
839  {
840  (void) InterpretImageFilename(image_info,(Image *) NULL,
841  read_filename,(int) scene,read_info->filename,exception);
842  image=ReadImage(read_info,exception);
843  if (image == (Image *) NULL)
844  continue;
845  AppendImageToList(&images,image);
846  }
847  read_info=DestroyImageInfo(read_info);
848  return(images);
849  }
850  }
851  (void) CopyMagickString(read_info->filename,filename,MagickPathExtent);
852  image=ReadImage(read_info,exception);
853  read_info=DestroyImageInfo(read_info);
854  return(image);
855 }
856 
857 /*
858 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
859 % %
860 % %
861 % %
862 + R e a d I n l i n e I m a g e %
863 % %
864 % %
865 % %
866 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
867 %
868 % ReadInlineImage() reads a Base64-encoded inline image or image sequence.
869 % The method returns a NULL if there is a memory shortage or if the image
870 % cannot be read. On failure, a NULL image is returned and exception
871 % describes the reason for the failure.
872 %
873 % The format of the ReadInlineImage method is:
874 %
875 % Image *ReadInlineImage(const ImageInfo *image_info,const char *content,
876 % ExceptionInfo *exception)
877 %
878 % A description of each parameter follows:
879 %
880 % o image_info: the image info.
881 %
882 % o content: the image encoded in Base64.
883 %
884 % o exception: return any errors or warnings in this structure.
885 %
886 */
888  const char *content,ExceptionInfo *exception)
889 {
890  Image
891  *image;
892 
893  ImageInfo
894  *read_info;
895 
896  unsigned char
897  *blob;
898 
899  size_t
900  length;
901 
902  register const char
903  *p;
904 
905  /*
906  Skip over header (e.g. data:image/gif;base64,).
907  */
908  image=NewImageList();
909  for (p=content; (*p != ',') && (*p != '\0'); p++) ;
910  if (*p == '\0')
911  ThrowReaderException(CorruptImageError,"CorruptImage");
912  p++;
913  length=0;
914  blob=Base64Decode(p,&length);
915  if (length == 0)
916  ThrowReaderException(CorruptImageError,"CorruptImage");
917  read_info=CloneImageInfo(image_info);
918  (void) SetImageInfoProgressMonitor(read_info,(MagickProgressMonitor) NULL,
919  (void *) NULL);
920  *read_info->filename='\0';
921  *read_info->magick='\0';
922  image=BlobToImage(read_info,blob,length,exception);
923  blob=(unsigned char *) RelinquishMagickMemory(blob);
924  read_info=DestroyImageInfo(read_info);
925  return(image);
926 }
927 
928 /*
929 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
930 % %
931 % %
932 % %
933 % W r i t e I m a g e %
934 % %
935 % %
936 % %
937 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
938 %
939 % WriteImage() writes an image or an image sequence to a file or file handle.
940 % If writing to a file is on disk, the name is defined by the filename member
941 % of the image structure. WriteImage() returns MagickFalse is there is a
942 % memory shortage or if the image cannot be written. Check the exception
943 % member of image to determine the cause for any failure.
944 %
945 % The format of the WriteImage method is:
946 %
947 % MagickBooleanType WriteImage(const ImageInfo *image_info,Image *image,
948 % ExceptionInfo *exception)
949 %
950 % A description of each parameter follows:
951 %
952 % o image_info: the image info.
953 %
954 % o image: the image.
955 %
956 % o exception: return any errors or warnings in this structure.
957 %
958 */
960  Image *image,ExceptionInfo *exception)
961 {
962  char
963  filename[MagickPathExtent];
964 
965  const char
966  *option;
967 
968  const DelegateInfo
969  *delegate_info;
970 
971  const MagickInfo
972  *magick_info;
973 
975  *sans_exception;
976 
977  ImageInfo
978  *write_info;
979 
981  status,
982  temporary;
983 
985  domain;
986 
988  rights;
989 
990  /*
991  Determine image type from filename prefix or suffix (e.g. image.jpg).
992  */
993  assert(image_info != (ImageInfo *) NULL);
994  assert(image_info->signature == MagickCoreSignature);
995  if (image->debug != MagickFalse)
997  image_info->filename);
998  assert(image != (Image *) NULL);
999  assert(image->signature == MagickCoreSignature);
1000  assert(exception != (ExceptionInfo *) NULL);
1001  sans_exception=AcquireExceptionInfo();
1002  write_info=CloneImageInfo(image_info);
1003  (void) CopyMagickString(write_info->filename,image->filename,
1005  (void) SetImageInfo(write_info,1,sans_exception);
1006  if (*write_info->magick == '\0')
1007  (void) CopyMagickString(write_info->magick,image->magick,MagickPathExtent);
1008  (void) CopyMagickString(filename,image->filename,MagickPathExtent);
1009  (void) CopyMagickString(image->filename,write_info->filename,
1011  domain=CoderPolicyDomain;
1012  rights=WritePolicyRights;
1013  if (IsRightsAuthorized(domain,rights,write_info->magick) == MagickFalse)
1014  {
1015  sans_exception=DestroyExceptionInfo(sans_exception);
1016  write_info=DestroyImageInfo(write_info);
1017  errno=EPERM;
1018  ThrowBinaryException(PolicyError,"NotAuthorized",filename);
1019  }
1020  /*
1021  Call appropriate image writer based on image type.
1022  */
1023  magick_info=GetMagickInfo(write_info->magick,sans_exception);
1024  sans_exception=DestroyExceptionInfo(sans_exception);
1025  if (magick_info != (const MagickInfo *) NULL)
1026  {
1027  if (GetMagickEndianSupport(magick_info) == MagickFalse)
1028  image->endian=UndefinedEndian;
1029  else
1030  if ((image_info->endian == UndefinedEndian) &&
1031  (GetMagickRawSupport(magick_info) != MagickFalse))
1032  {
1033  unsigned long
1034  lsb_first;
1035 
1036  lsb_first=1;
1037  image->endian=(*(char *) &lsb_first) == 1 ? LSBEndian : MSBEndian;
1038  }
1039  }
1040  (void) SyncImageProfiles(image);
1041  DisassociateImageStream(image);
1042  option=GetImageOption(image_info,"delegate:bimodal");
1043  if ((IsStringTrue(option) != MagickFalse) &&
1044  (write_info->page == (char *) NULL) &&
1045  (GetPreviousImageInList(image) == (Image *) NULL) &&
1046  (GetNextImageInList(image) == (Image *) NULL) &&
1047  (IsTaintImage(image) == MagickFalse) )
1048  {
1049  delegate_info=GetDelegateInfo(image->magick,write_info->magick,exception);
1050  if ((delegate_info != (const DelegateInfo *) NULL) &&
1051  (GetDelegateMode(delegate_info) == 0) &&
1053  {
1054  /*
1055  Process image with bi-modal delegate.
1056  */
1057  (void) CopyMagickString(image->filename,image->magick_filename,
1059  status=InvokeDelegate(write_info,image,image->magick,
1060  write_info->magick,exception);
1061  write_info=DestroyImageInfo(write_info);
1062  (void) CopyMagickString(image->filename,filename,MagickPathExtent);
1063  return(status);
1064  }
1065  }
1066  status=MagickFalse;
1067  temporary=MagickFalse;
1068  if ((magick_info != (const MagickInfo *) NULL) &&
1069  (GetMagickSeekableStream(magick_info) != MagickFalse))
1070  {
1071  char
1072  image_filename[MagickPathExtent];
1073 
1074  (void) CopyMagickString(image_filename,image->filename,MagickPathExtent);
1075  status=OpenBlob(image_info,image,WriteBinaryBlobMode,exception);
1076  (void) CopyMagickString(image->filename, image_filename,MagickPathExtent);
1077  if (status != MagickFalse)
1078  {
1079  if (IsBlobSeekable(image) == MagickFalse)
1080  {
1081  /*
1082  A seekable stream is required by the encoder.
1083  */
1084  write_info->adjoin=MagickTrue;
1085  (void) CopyMagickString(write_info->filename,image->filename,
1087  (void) AcquireUniqueFilename(image->filename);
1088  temporary=MagickTrue;
1089  }
1090  (void) CloseBlob(image);
1091  }
1092  }
1093  if ((magick_info != (const MagickInfo *) NULL) &&
1094  (GetImageEncoder(magick_info) != (EncodeImageHandler *) NULL))
1095  {
1096  /*
1097  Call appropriate image writer based on image type.
1098  */
1099  if (GetMagickEncoderThreadSupport(magick_info) == MagickFalse)
1100  LockSemaphoreInfo(magick_info->semaphore);
1101  status=GetImageEncoder(magick_info)(write_info,image,exception);
1102  if (GetMagickEncoderThreadSupport(magick_info) == MagickFalse)
1103  UnlockSemaphoreInfo(magick_info->semaphore);
1104  }
1105  else
1106  {
1107  delegate_info=GetDelegateInfo((char *) NULL,write_info->magick,exception);
1108  if (delegate_info != (DelegateInfo *) NULL)
1109  {
1110  /*
1111  Process the image with delegate.
1112  */
1113  *write_info->filename='\0';
1114  if (GetDelegateThreadSupport(delegate_info) == MagickFalse)
1115  LockSemaphoreInfo(delegate_info->semaphore);
1116  status=InvokeDelegate(write_info,image,(char *) NULL,
1117  write_info->magick,exception);
1118  if (GetDelegateThreadSupport(delegate_info) == MagickFalse)
1119  UnlockSemaphoreInfo(delegate_info->semaphore);
1120  (void) CopyMagickString(image->filename,filename,MagickPathExtent);
1121  }
1122  else
1123  {
1124  sans_exception=AcquireExceptionInfo();
1125  magick_info=GetMagickInfo(write_info->magick,sans_exception);
1126  sans_exception=DestroyExceptionInfo(sans_exception);
1127  if ((write_info->affirm == MagickFalse) &&
1128  (magick_info == (const MagickInfo *) NULL))
1129  {
1130  (void) CopyMagickString(write_info->magick,image->magick,
1132  magick_info=GetMagickInfo(write_info->magick,exception);
1133  }
1134  if ((magick_info == (const MagickInfo *) NULL) ||
1135  (GetImageEncoder(magick_info) == (EncodeImageHandler *) NULL))
1136  {
1137  char
1138  extension[MagickPathExtent];
1139 
1140  GetPathComponent(image->filename,ExtensionPath,extension);
1141  if (*extension != '\0')
1142  magick_info=GetMagickInfo(extension,exception);
1143  else
1144  magick_info=GetMagickInfo(image->magick,exception);
1145  (void) CopyMagickString(image->filename,filename,
1147  }
1148  if ((magick_info == (const MagickInfo *) NULL) ||
1149  (GetImageEncoder(magick_info) == (EncodeImageHandler *) NULL))
1150  {
1151  magick_info=GetMagickInfo(image->magick,exception);
1152  if ((magick_info == (const MagickInfo *) NULL) ||
1153  (GetImageEncoder(magick_info) == (EncodeImageHandler *) NULL))
1154  (void) ThrowMagickException(exception,GetMagickModule(),
1155  MissingDelegateError,"NoEncodeDelegateForThisImageFormat",
1156  "`%s'",write_info->magick);
1157  else
1158  (void) ThrowMagickException(exception,GetMagickModule(),
1159  MissingDelegateWarning,"NoEncodeDelegateForThisImageFormat",
1160  "`%s'",write_info->magick);
1161  }
1162  if ((magick_info != (const MagickInfo *) NULL) &&
1163  (GetImageEncoder(magick_info) != (EncodeImageHandler *) NULL))
1164  {
1165  /*
1166  Call appropriate image writer based on image type.
1167  */
1168  if (GetMagickEncoderThreadSupport(magick_info) == MagickFalse)
1169  LockSemaphoreInfo(magick_info->semaphore);
1170  status=GetImageEncoder(magick_info)(write_info,image,exception);
1171  if (GetMagickEncoderThreadSupport(magick_info) == MagickFalse)
1172  UnlockSemaphoreInfo(magick_info->semaphore);
1173  }
1174  }
1175  }
1176  if (temporary != MagickFalse)
1177  {
1178  /*
1179  Copy temporary image file to permanent.
1180  */
1181  status=OpenBlob(write_info,image,ReadBinaryBlobMode,exception);
1182  if (status != MagickFalse)
1183  {
1184  (void) RelinquishUniqueFileResource(write_info->filename);
1185  status=ImageToFile(image,write_info->filename,exception);
1186  }
1187  (void) CloseBlob(image);
1188  (void) RelinquishUniqueFileResource(image->filename);
1189  (void) CopyMagickString(image->filename,write_info->filename,
1191  }
1192  if ((LocaleCompare(write_info->magick,"info") != 0) &&
1193  (write_info->verbose != MagickFalse))
1194  (void) IdentifyImage(image,stdout,MagickFalse,exception);
1195  write_info=DestroyImageInfo(write_info);
1196  return(status);
1197 }
1198 
1199 /*
1200 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1201 % %
1202 % %
1203 % %
1204 % W r i t e I m a g e s %
1205 % %
1206 % %
1207 % %
1208 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1209 %
1210 % WriteImages() writes an image sequence into one or more files. While
1211 % WriteImage() can write an image sequence, it is limited to writing
1212 % the sequence into a single file using a format which supports multiple
1213 % frames. WriteImages(), however, does not have this limitation, instead it
1214 % generates multiple output files if necessary (or when requested). When
1215 % ImageInfo's adjoin flag is set to MagickFalse, the file name is expected
1216 % to include a printf-style formatting string for the frame number (e.g.
1217 % "image%02d.png").
1218 %
1219 % The format of the WriteImages method is:
1220 %
1221 % MagickBooleanType WriteImages(const ImageInfo *image_info,Image *images,
1222 % const char *filename,ExceptionInfo *exception)
1223 %
1224 % A description of each parameter follows:
1225 %
1226 % o image_info: the image info.
1227 %
1228 % o images: the image list.
1229 %
1230 % o filename: the image filename.
1231 %
1232 % o exception: return any errors or warnings in this structure.
1233 %
1234 */
1236  Image *images,const char *filename,ExceptionInfo *exception)
1237 {
1238 #define WriteImageTag "Write/Image"
1239 
1241  *sans_exception;
1242 
1243  ImageInfo
1244  *write_info;
1245 
1247  proceed;
1248 
1250  progress;
1251 
1253  progress_monitor;
1254 
1256  number_images;
1257 
1259  status;
1260 
1261  register Image
1262  *p;
1263 
1264  assert(image_info != (const ImageInfo *) NULL);
1265  assert(image_info->signature == MagickCoreSignature);
1266  assert(images != (Image *) NULL);
1267  assert(images->signature == MagickCoreSignature);
1268  if (images->debug != MagickFalse)
1269  (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",images->filename);
1270  assert(exception != (ExceptionInfo *) NULL);
1271  write_info=CloneImageInfo(image_info);
1272  *write_info->magick='\0';
1273  images=GetFirstImageInList(images);
1274  if (filename != (const char *) NULL)
1275  for (p=images; p != (Image *) NULL; p=GetNextImageInList(p))
1276  (void) CopyMagickString(p->filename,filename,MagickPathExtent);
1277  (void) CopyMagickString(write_info->filename,images->filename,
1279  sans_exception=AcquireExceptionInfo();
1280  (void) SetImageInfo(write_info,(unsigned int) GetImageListLength(images),
1281  sans_exception);
1282  sans_exception=DestroyExceptionInfo(sans_exception);
1283  if (*write_info->magick == '\0')
1284  (void) CopyMagickString(write_info->magick,images->magick,MagickPathExtent);
1285  p=images;
1286  for ( ; GetNextImageInList(p) != (Image *) NULL; p=GetNextImageInList(p))
1287  {
1288  register Image
1289  *next;
1290 
1291  next=GetNextImageInList(p);
1292  if (next == (Image *) NULL)
1293  break;
1294  if (p->scene >= next->scene)
1295  {
1296  register ssize_t
1297  i;
1298 
1299  /*
1300  Generate consistent scene numbers.
1301  */
1302  i=(ssize_t) images->scene;
1303  for (p=images; p != (Image *) NULL; p=GetNextImageInList(p))
1304  p->scene=(size_t) i++;
1305  break;
1306  }
1307  }
1308  /*
1309  Write images.
1310  */
1311  status=MagickTrue;
1312  progress_monitor=(MagickProgressMonitor) NULL;
1313  progress=0;
1314  number_images=GetImageListLength(images);
1315  for (p=images; p != (Image *) NULL; p=GetNextImageInList(p))
1316  {
1317  if (number_images != 1)
1318  progress_monitor=SetImageProgressMonitor(p,(MagickProgressMonitor) NULL,
1319  p->client_data);
1320  status&=WriteImage(write_info,p,exception);
1321  if (number_images != 1)
1322  (void) SetImageProgressMonitor(p,progress_monitor,p->client_data);
1323  if (write_info->adjoin != MagickFalse)
1324  break;
1325  if (number_images != 1)
1326  {
1327  proceed=SetImageProgress(p,WriteImageTag,progress++,number_images);
1328  if (proceed == MagickFalse)
1329  break;
1330  }
1331  }
1332  write_info=DestroyImageInfo(write_info);
1333  return(status != 0 ? MagickTrue : MagickFalse);
1334 }
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:2653
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:461
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:887
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:1649
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:1992
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:2923
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:1338
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:317
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:959
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:990
MagickExport MagickBooleanType CloseBlob(Image *)
MagickExport MagickBooleanType SetImageProperty(Image *image, const char *property, const char *value, ExceptionInfo *exception)
Definition: property.c:3942
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:2136
#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:358
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:2495
#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:2216
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:350
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:972
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:1610
MagickExport MagickBooleanType IsBlobSeekable(const Image *image)
Definition: blob.c:2087
MagickExport Image * ReadImages(ImageInfo *image_info, const char *filename, ExceptionInfo *exception)
Definition: constitute.c:788
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:3267
MagickExport ImageInfo * DestroyImageInfo(ImageInfo *image_info)
Definition: image.c:1239
MagickExport MagickBooleanType IsTaintImage(const Image *image)
Definition: image.c:1914
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:2174
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:1168
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:1301
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:1235
ExceptionType severity
Definition: exception.h:104
Image * DecodeImageHandler(const ImageInfo *, ExceptionInfo *)
Definition: magick.h:50