MagickCore  6.9.1
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-2015 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 "magick/studio.h"
43 #include "magick/attribute.h"
44 #include "magick/blob.h"
45 #include "magick/blob-private.h"
46 #include "magick/exception.h"
48 #include "magick/cache.h"
49 #include "magick/client.h"
51 #include "magick/constitute.h"
52 #include "magick/delegate.h"
53 #include "magick/geometry.h"
54 #include "magick/identify.h"
55 #include "magick/image-private.h"
56 #include "magick/list.h"
57 #include "magick/magick.h"
58 #include "magick/memory_.h"
59 #include "magick/monitor.h"
60 #include "magick/monitor-private.h"
61 #include "magick/option.h"
62 #include "magick/pixel.h"
63 #include "magick/policy.h"
64 #include "magick/profile.h"
65 #include "magick/property.h"
66 #include "magick/quantum.h"
67 #include "magick/resize.h"
68 #include "magick/resource_.h"
69 #include "magick/semaphore.h"
70 #include "magick/statistic.h"
71 #include "magick/stream.h"
72 #include "magick/string_.h"
73 #include "magick/string-private.h"
74 #include "magick/timer.h"
75 #include "magick/token.h"
76 #include "magick/transform.h"
77 #include "magick/utility.h"
78 
79 /*
80 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
81 % %
82 % %
83 % %
84 % C o n s t i t u t e I m a g e %
85 % %
86 % %
87 % %
88 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
89 %
90 % ConstituteImage() returns an image from the pixel data you supply.
91 % The pixel data must be in scanline order top-to-bottom. The data can be
92 % char, short int, int, float, or double. Float and double require the
93 % pixels to be normalized [0..1], otherwise [0..QuantumRange]. For example, to
94 % create a 640x480 image from unsigned red-green-blue character data, use:
95 %
96 % image = ConstituteImage(640,480,"RGB",CharPixel,pixels,&exception);
97 %
98 % The format of the ConstituteImage method is:
99 %
100 % Image *ConstituteImage(const size_t columns,const size_t rows,
101 % const char *map,const StorageType storage,const void *pixels,
102 % ExceptionInfo *exception)
103 %
104 % A description of each parameter follows:
105 %
106 % o columns: width in pixels of the image.
107 %
108 % o rows: height in pixels of the image.
109 %
110 % o map: This string reflects the expected ordering of the pixel array.
111 % It can be any combination or order of R = red, G = green, B = blue,
112 % A = alpha (0 is transparent), O = opacity (0 is opaque), C = cyan,
113 % Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
114 % P = pad.
115 %
116 % o storage: Define the data type of the pixels. Float and double types are
117 % expected to be normalized [0..1] otherwise [0..QuantumRange]. Choose
118 % from these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
119 % LongPixel, QuantumPixel, or ShortPixel.
120 %
121 % o pixels: This array of values contain the pixel components as defined by
122 % map and type. You must preallocate this array where the expected
123 % length varies depending on the values of width, height, map, and type.
124 %
125 % o exception: return any errors or warnings in this structure.
126 %
127 */
128 MagickExport Image *ConstituteImage(const size_t columns,
129  const size_t rows,const char *map,const StorageType storage,
130  const void *pixels,ExceptionInfo *exception)
131 {
132  Image
133  *image;
134 
136  status;
137 
138  /*
139  Allocate image structure.
140  */
141  assert(map != (const char *) NULL);
142  (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",map);
143  assert(pixels != (void *) NULL);
144  assert(exception != (ExceptionInfo *) NULL);
145  assert(exception->signature == MagickSignature);
146  image=AcquireImage((ImageInfo *) NULL);
147  if (image == (Image *) NULL)
148  return((Image *) NULL);
149  if ((columns == 0) || (rows == 0))
150  ThrowImageException(OptionError,"NonZeroWidthAndHeightRequired");
151  image->columns=columns;
152  image->rows=rows;
153  (void) SetImageBackgroundColor(image);
154  status=ImportImagePixels(image,0,0,columns,rows,map,storage,pixels);
155  if (status == MagickFalse)
156  {
157  InheritException(exception,&image->exception);
158  image=DestroyImage(image);
159  }
160  return(image);
161 }
162 
163 /*
164 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
165 % %
166 % %
167 % %
168 % P i n g I m a g e %
169 % %
170 % %
171 % %
172 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
173 %
174 % PingImage() returns all the properties of an image or image sequence
175 % except for the pixels. It is much faster and consumes far less memory
176 % than ReadImage(). On failure, a NULL image is returned and exception
177 % describes the reason for the failure.
178 %
179 % The format of the PingImage method is:
180 %
181 % Image *PingImage(const ImageInfo *image_info,ExceptionInfo *exception)
182 %
183 % A description of each parameter follows:
184 %
185 % o image_info: Ping the image defined by the file or filename members of
186 % this structure.
187 %
188 % o exception: return any errors or warnings in this structure.
189 %
190 */
191 
192 #if defined(__cplusplus) || defined(c_plusplus)
193 extern "C" {
194 #endif
195 
196 static size_t PingStream(const Image *magick_unused(image),
197  const void *magick_unused(pixels),const size_t columns)
198 {
199  magick_unreferenced(image);
200  magick_unreferenced(pixels);
201 
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 == MagickSignature);
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);
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(const ImageInfo *image_info,ExceptionInfo *exception)
253 %
254 % A description of each parameter follows:
255 %
256 % o image_info: the image info.
257 %
258 % o exception: return any errors or warnings in this structure.
259 %
260 */
262  ExceptionInfo *exception)
263 {
264  char
265  filename[MaxTextExtent];
266 
267  Image
268  *image,
269  *images;
270 
271  ImageInfo
272  *read_info;
273 
274  /*
275  Ping image list from a file.
276  */
277  assert(image_info != (ImageInfo *) NULL);
278  assert(image_info->signature == MagickSignature);
279  if (image_info->debug != MagickFalse)
281  image_info->filename);
282  assert(exception != (ExceptionInfo *) NULL);
283  (void) InterpretImageFilename(image_info,(Image *) NULL,image_info->filename,
284  (int) image_info->scene,filename);
285  if (LocaleCompare(filename,image_info->filename) != 0)
286  {
288  *sans;
289 
290  ssize_t
291  extent,
292  scene;
293 
294  /*
295  Images of the form image-%d.png[1-5].
296  */
297  read_info=CloneImageInfo(image_info);
298  sans=AcquireExceptionInfo();
299  (void) SetImageInfo(read_info,0,sans);
300  sans=DestroyExceptionInfo(sans);
301  if (read_info->number_scenes == 0)
302  {
303  read_info=DestroyImageInfo(read_info);
304  return(PingImage(image_info,exception));
305  }
306  (void) CopyMagickString(filename,read_info->filename,MaxTextExtent);
307  images=NewImageList();
308  extent=(ssize_t) (read_info->scene+read_info->number_scenes);
309  for (scene=(ssize_t) read_info->scene; scene < (ssize_t) extent; scene++)
310  {
311  (void) InterpretImageFilename(image_info,(Image *) NULL,filename,(int)
312  scene,read_info->filename);
313  image=PingImage(read_info,exception);
314  if (image == (Image *) NULL)
315  continue;
316  AppendImageToList(&images,image);
317  }
318  read_info=DestroyImageInfo(read_info);
319  return(images);
320  }
321  return(PingImage(image_info,exception));
322 }
323 
324 /*
325 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
326 % %
327 % %
328 % %
329 % R e a d I m a g e %
330 % %
331 % %
332 % %
333 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
334 %
335 % ReadImage() reads an image or image sequence from a file or file handle.
336 % The method returns a NULL if there is a memory shortage or if the image
337 % cannot be read. On failure, a NULL image is returned and exception
338 % describes the reason for the failure.
339 %
340 % The format of the ReadImage method is:
341 %
342 % Image *ReadImage(const ImageInfo *image_info,ExceptionInfo *exception)
343 %
344 % A description of each parameter follows:
345 %
346 % o image_info: Read the image defined by the file or filename members of
347 % this structure.
348 %
349 % o exception: return any errors or warnings in this structure.
350 %
351 */
353  ExceptionInfo *exception)
354 {
355  char
356  filename[MaxTextExtent],
357  magick[MaxTextExtent],
358  magick_filename[MaxTextExtent];
359 
360  const char
361  *value;
362 
363  const DelegateInfo
364  *delegate_info;
365 
366  const MagickInfo
367  *magick_info;
368 
370  *sans_exception;
371 
373  geometry_info;
374 
375  Image
376  *image,
377  *next;
378 
379  ImageInfo
380  *read_info;
381 
383  flags,
384  thread_support;
385 
387  domain;
388 
390  rights;
391 
392  /*
393  Determine image type from filename prefix or suffix (e.g. image.jpg).
394  */
395  assert(image_info != (ImageInfo *) NULL);
396  assert(image_info->signature == MagickSignature);
397  assert(image_info->filename != (char *) NULL);
398  if (image_info->debug != MagickFalse)
400  image_info->filename);
401  assert(exception != (ExceptionInfo *) NULL);
402  read_info=CloneImageInfo(image_info);
403  (void) CopyMagickString(magick_filename,read_info->filename,MaxTextExtent);
404  (void) SetImageInfo(read_info,0,exception);
405  (void) CopyMagickString(filename,read_info->filename,MaxTextExtent);
406  (void) CopyMagickString(magick,read_info->magick,MaxTextExtent);
407  domain=CoderPolicyDomain;
408  rights=ReadPolicyRights;
409  if (IsRightsAuthorized(domain,rights,read_info->magick) == MagickFalse)
410  {
411  errno=EPERM;
413  "NotAuthorized","`%s'",read_info->filename);
414  read_info=DestroyImageInfo(read_info);
415  return((Image *) NULL);
416  }
417  /*
418  Call appropriate image reader based on image type.
419  */
420  sans_exception=AcquireExceptionInfo();
421  magick_info=GetMagickInfo(read_info->magick,sans_exception);
422  sans_exception=DestroyExceptionInfo(sans_exception);
423  if (magick_info != (const MagickInfo *) NULL)
424  {
425  if (GetMagickEndianSupport(magick_info) == MagickFalse)
426  read_info->endian=UndefinedEndian;
427  else
428  if ((image_info->endian == UndefinedEndian) &&
429  (GetMagickRawSupport(magick_info) != MagickFalse))
430  {
431  size_t
432  lsb_first;
433 
434  lsb_first=1;
435  read_info->endian=(*(char *) &lsb_first) == 1 ? LSBEndian :
436  MSBEndian;
437  }
438  }
439  if ((magick_info != (const MagickInfo *) NULL) &&
440  (GetMagickSeekableStream(magick_info) != MagickFalse))
441  {
443  status;
444 
445  image=AcquireImage(read_info);
446  (void) CopyMagickString(image->filename,read_info->filename,
447  MaxTextExtent);
448  status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
449  if (status == MagickFalse)
450  {
451  read_info=DestroyImageInfo(read_info);
452  image=DestroyImage(image);
453  return((Image *) NULL);
454  }
455  if (IsBlobSeekable(image) == MagickFalse)
456  {
457  /*
458  Coder requires a seekable stream.
459  */
460  *read_info->filename='\0';
461  status=ImageToFile(image,read_info->filename,exception);
462  if (status == MagickFalse)
463  {
464  (void) CloseBlob(image);
465  read_info=DestroyImageInfo(read_info);
466  image=DestroyImage(image);
467  return((Image *) NULL);
468  }
469  read_info->temporary=MagickTrue;
470  }
471  (void) CloseBlob(image);
472  image=DestroyImage(image);
473  }
474  image=NewImageList();
475  if ((magick_info == (const MagickInfo *) NULL) ||
476  (GetImageDecoder(magick_info) == (DecodeImageHandler *) NULL))
477  {
478  delegate_info=GetDelegateInfo(read_info->magick,(char *) NULL,exception);
479  if (delegate_info == (const DelegateInfo *) NULL)
480  {
481  (void) SetImageInfo(read_info,0,exception);
482  (void) CopyMagickString(read_info->filename,filename,MaxTextExtent);
483  magick_info=GetMagickInfo(read_info->magick,exception);
484  }
485  }
486  if ((magick_info != (const MagickInfo *) NULL) &&
487  (GetImageDecoder(magick_info) != (DecodeImageHandler *) NULL))
488  {
489  thread_support=GetMagickThreadSupport(magick_info);
490  if ((thread_support & DecoderThreadSupport) == 0)
491  LockSemaphoreInfo(magick_info->semaphore);
492  image=GetImageDecoder(magick_info)(read_info,exception);
493  if ((thread_support & DecoderThreadSupport) == 0)
494  UnlockSemaphoreInfo(magick_info->semaphore);
495  }
496  else
497  {
498  delegate_info=GetDelegateInfo(read_info->magick,(char *) NULL,exception);
499  if (delegate_info == (const DelegateInfo *) NULL)
500  {
501  (void) ThrowMagickException(exception,GetMagickModule(),
502  MissingDelegateError,"NoDecodeDelegateForThisImageFormat","`%s'",
503  read_info->magick);
504  if (read_info->temporary != MagickFalse)
505  (void) RelinquishUniqueFileResource(read_info->filename);
506  read_info=DestroyImageInfo(read_info);
507  return((Image *) NULL);
508  }
509  /*
510  Let our decoding delegate process the image.
511  */
512  image=AcquireImage(read_info);
513  if (image == (Image *) NULL)
514  {
515  read_info=DestroyImageInfo(read_info);
516  return((Image *) NULL);
517  }
518  (void) CopyMagickString(image->filename,read_info->filename,
519  MaxTextExtent);
520  *read_info->filename='\0';
521  if (GetDelegateThreadSupport(delegate_info) == MagickFalse)
522  LockSemaphoreInfo(delegate_info->semaphore);
523  (void) InvokeDelegate(read_info,image,read_info->magick,(char *) NULL,
524  exception);
525  if (GetDelegateThreadSupport(delegate_info) == MagickFalse)
526  UnlockSemaphoreInfo(delegate_info->semaphore);
527  image=DestroyImageList(image);
528  read_info->temporary=MagickTrue;
529  (void) SetImageInfo(read_info,0,exception);
530  magick_info=GetMagickInfo(read_info->magick,exception);
531  if ((magick_info == (const MagickInfo *) NULL) ||
532  (GetImageDecoder(magick_info) == (DecodeImageHandler *) NULL))
533  {
534  if (IsPathAccessible(read_info->filename) != MagickFalse)
535  (void) ThrowMagickException(exception,GetMagickModule(),
536  MissingDelegateError,"NoDecodeDelegateForThisImageFormat","`%s'",
537  read_info->magick);
538  else
539  ThrowFileException(exception,FileOpenError,"UnableToOpenFile",
540  read_info->filename);
541  read_info=DestroyImageInfo(read_info);
542  return((Image *) NULL);
543  }
544  thread_support=GetMagickThreadSupport(magick_info);
545  if ((thread_support & DecoderThreadSupport) == 0)
546  LockSemaphoreInfo(magick_info->semaphore);
547  image=(Image *) (GetImageDecoder(magick_info))(read_info,exception);
548  if ((thread_support & DecoderThreadSupport) == 0)
549  UnlockSemaphoreInfo(magick_info->semaphore);
550  }
551  if (read_info->temporary != MagickFalse)
552  {
553  (void) RelinquishUniqueFileResource(read_info->filename);
554  read_info->temporary=MagickFalse;
555  if (image != (Image *) NULL)
556  (void) CopyMagickString(image->filename,filename,MaxTextExtent);
557  }
558  if (image == (Image *) NULL)
559  {
560  read_info=DestroyImageInfo(read_info);
561  return(image);
562  }
563  if (exception->severity >= ErrorException)
565  "Coder (%s) generated an image despite an error (%d), "
566  "notify the developers",image->magick,exception->severity);
567  if (IsBlobTemporary(image) != MagickFalse)
568  (void) RelinquishUniqueFileResource(read_info->filename);
569  if ((GetNextImageInList(image) != (Image *) NULL) &&
571  {
572  Image
573  *clones;
574 
575  clones=CloneImages(image,read_info->scenes,exception);
576  if (clones == (Image *) NULL)
578  "SubimageSpecificationReturnsNoImages","`%s'",read_info->filename);
579  else
580  {
581  image=DestroyImageList(image);
582  image=GetFirstImageInList(clones);
583  }
584  }
585  for (next=image; next != (Image *) NULL; next=GetNextImageInList(next))
586  {
587  char
588  magick_path[MaxTextExtent],
589  *property,
590  timestamp[MaxTextExtent];
591 
592  const char
593  *option;
594 
595  const StringInfo
596  *profile;
597 
598  next->taint=MagickFalse;
599  GetPathComponent(magick_filename,MagickPath,magick_path);
600  if (*magick_path == '\0' && *next->magick == '\0')
601  (void) CopyMagickString(next->magick,magick,MaxTextExtent);
602  (void) CopyMagickString(next->magick_filename,magick_filename,
603  MaxTextExtent);
604  if (IsBlobTemporary(image) != MagickFalse)
605  (void) CopyMagickString(next->filename,filename,MaxTextExtent);
606  if (next->magick_columns == 0)
607  next->magick_columns=next->columns;
608  if (next->magick_rows == 0)
609  next->magick_rows=next->rows;
610  value=GetImageProperty(next,"tiff:Orientation");
611  if (value == (char *) NULL)
612  value=GetImageProperty(next,"exif:Orientation");
613  if (value != (char *) NULL)
614  {
616  (void) DeleteImageProperty(next,"tiff:Orientation");
617  (void) DeleteImageProperty(next,"exif:Orientation");
618  }
619  value=GetImageProperty(next,"exif:XResolution");
620  if (value != (char *) NULL)
621  {
622  geometry_info.rho=next->x_resolution;
623  geometry_info.sigma=1.0;
624  (void) ParseGeometry(value,&geometry_info);
625  if (geometry_info.sigma != 0)
626  next->x_resolution=geometry_info.rho/geometry_info.sigma;
627  (void) DeleteImageProperty(next,"exif:XResolution");
628  }
629  value=GetImageProperty(next,"exif:YResolution");
630  if (value != (char *) NULL)
631  {
632  geometry_info.rho=next->y_resolution;
633  geometry_info.sigma=1.0;
634  (void) ParseGeometry(value,&geometry_info);
635  if (geometry_info.sigma != 0)
636  next->y_resolution=geometry_info.rho/geometry_info.sigma;
637  (void) DeleteImageProperty(next,"exif:YResolution");
638  }
639  value=GetImageProperty(next,"tiff:ResolutionUnit");
640  if (value == (char *) NULL)
641  value=GetImageProperty(next,"exif:ResolutionUnit");
642  if (value != (char *) NULL)
643  {
644  next->units=(ResolutionType) (StringToLong(value)-1);
645  (void) DeleteImageProperty(next,"exif:ResolutionUnit");
646  (void) DeleteImageProperty(next,"tiff:ResolutionUnit");
647  }
648  if (next->page.width == 0)
649  next->page.width=next->columns;
650  if (next->page.height == 0)
651  next->page.height=next->rows;
652  option=GetImageOption(read_info,"caption");
653  if (option != (const char *) NULL)
654  {
655  property=InterpretImageProperties(read_info,next,option);
656  (void) SetImageProperty(next,"caption",property);
657  property=DestroyString(property);
658  }
659  option=GetImageOption(read_info,"comment");
660  if (option != (const char *) NULL)
661  {
662  property=InterpretImageProperties(read_info,next,option);
663  (void) SetImageProperty(next,"comment",property);
664  property=DestroyString(property);
665  }
666  option=GetImageOption(read_info,"label");
667  if (option != (const char *) NULL)
668  {
669  property=InterpretImageProperties(read_info,next,option);
670  (void) SetImageProperty(next,"label",property);
671  property=DestroyString(property);
672  }
673  if (LocaleCompare(next->magick,"TEXT") == 0)
674  (void) ParseAbsoluteGeometry("0x0+0+0",&next->page);
675  if ((read_info->extract != (char *) NULL) &&
676  (read_info->stream == (StreamHandler) NULL))
677  {
679  geometry;
680 
681  flags=ParseAbsoluteGeometry(read_info->extract,&geometry);
682  if ((next->columns != geometry.width) ||
683  (next->rows != geometry.height))
684  {
685  if (((flags & XValue) != 0) || ((flags & YValue) != 0))
686  {
687  Image
688  *crop_image;
689 
690  crop_image=CropImage(next,&geometry,exception);
691  if (crop_image != (Image *) NULL)
692  ReplaceImageInList(&next,crop_image);
693  }
694  else
695  if (((flags & WidthValue) != 0) || ((flags & HeightValue) != 0))
696  {
697  Image
698  *size_image;
699 
700  (void) ParseRegionGeometry(next,read_info->extract,&geometry,
701  exception);
702  size_image=ResizeImage(next,geometry.width,geometry.height,
703  next->filter,next->blur,exception);
704  if (size_image != (Image *) NULL)
705  ReplaceImageInList(&next,size_image);
706  }
707  }
708  }
709  profile=GetImageProfile(next,"icc");
710  if (profile == (const StringInfo *) NULL)
711  profile=GetImageProfile(next,"icm");
712  if (profile != (const StringInfo *) NULL)
713  {
715  next->color_profile.info=GetStringInfoDatum(profile);
716  }
717  profile=GetImageProfile(next,"iptc");
718  if (profile == (const StringInfo *) NULL)
719  profile=GetImageProfile(next,"8bim");
720  if (profile != (const StringInfo *) NULL)
721  {
722  next->iptc_profile.length=GetStringInfoLength(profile);
723  next->iptc_profile.info=GetStringInfoDatum(profile);
724  }
725  (void) FormatMagickTime(GetBlobProperties(next)->st_mtime,MaxTextExtent,
726  timestamp);
727  (void) SetImageProperty(next,"date:modify",timestamp);
728  (void) FormatMagickTime(GetBlobProperties(next)->st_ctime,MaxTextExtent,
729  timestamp);
730  (void) SetImageProperty(next,"date:create",timestamp);
731  option=GetImageOption(image_info,"delay");
732  if (option != (const char *) NULL)
733  {
735  geometry_info;
736 
737  flags=ParseGeometry(option,&geometry_info);
738  if ((flags & GreaterValue) != 0)
739  {
740  if (next->delay > (size_t) floor(geometry_info.rho+0.5))
741  next->delay=(size_t) floor(geometry_info.rho+0.5);
742  }
743  else
744  if ((flags & LessValue) != 0)
745  {
746  if (next->delay < (size_t) floor(geometry_info.rho+0.5))
747  next->ticks_per_second=(ssize_t) floor(geometry_info.sigma+0.5);
748  }
749  else
750  next->delay=(size_t) floor(geometry_info.rho+0.5);
751  if ((flags & SigmaValue) != 0)
752  next->ticks_per_second=(ssize_t) floor(geometry_info.sigma+0.5);
753  }
754  option=GetImageOption(image_info,"dispose");
755  if (option != (const char *) NULL)
757  MagickFalse,option);
758  if (read_info->verbose != MagickFalse)
759  (void) IdentifyImage(next,stderr,MagickFalse);
760  image=next;
761  }
762  read_info=DestroyImageInfo(read_info);
763  return(GetFirstImageInList(image));
764 }
765 
766 /*
767 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
768 % %
769 % %
770 % %
771 % R e a d I m a g e s %
772 % %
773 % %
774 % %
775 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
776 %
777 % ReadImages() reads one or more images and returns them as an image list.
778 %
779 % The format of the ReadImage method is:
780 %
781 % Image *ReadImages(const ImageInfo *image_info,ExceptionInfo *exception)
782 %
783 % A description of each parameter follows:
784 %
785 % o image_info: the image info.
786 %
787 % o exception: return any errors or warnings in this structure.
788 %
789 */
791  ExceptionInfo *exception)
792 {
793  char
794  filename[MaxTextExtent];
795 
796  Image
797  *image,
798  *images;
799 
800  ImageInfo
801  *read_info;
802 
803  /*
804  Read image list from a file.
805  */
806  assert(image_info != (ImageInfo *) NULL);
807  assert(image_info->signature == MagickSignature);
808  if (image_info->debug != MagickFalse)
810  image_info->filename);
811  assert(exception != (ExceptionInfo *) NULL);
812  read_info=CloneImageInfo(image_info);
813  *read_info->magick='\0';
814  (void) InterpretImageFilename(read_info,(Image *) NULL,read_info->filename,
815  (int) read_info->scene,filename);
816  if (LocaleCompare(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  read_info=DestroyImageInfo(read_info);
834  return(ReadImage(image_info,exception));
835  }
836  (void) CopyMagickString(filename,read_info->filename,MaxTextExtent);
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,filename,(int)
842  scene,read_info->filename);
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 %
948 % A description of each parameter follows:
949 %
950 % o image_info: the image info.
951 %
952 % o image: the image.
953 %
954 */
956  Image *image)
957 {
958  char
959  filename[MaxTextExtent];
960 
961  const char
962  *option;
963 
964  const DelegateInfo
965  *delegate_info;
966 
967  const MagickInfo
968  *magick_info;
969 
971  *exception,
972  *sans_exception;
973 
974  ImageInfo
975  *write_info;
976 
978  status,
979  temporary;
980 
982  thread_support;
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 == MagickSignature);
995  if (image->debug != MagickFalse)
997  image_info->filename);
998  assert(image != (Image *) NULL);
999  assert(image->signature == MagickSignature);
1000  exception=(&image->exception);
1001  sans_exception=AcquireExceptionInfo();
1002  write_info=CloneImageInfo(image_info);
1003  (void) CopyMagickString(write_info->filename,image->filename,MaxTextExtent);
1004  (void) SetImageInfo(write_info,1,sans_exception);
1005  if (*write_info->magick == '\0')
1006  (void) CopyMagickString(write_info->magick,image->magick,MaxTextExtent);
1007  if (LocaleCompare(write_info->magick,"clipmask") == 0)
1008  {
1009  if (image->clip_mask == (Image *) NULL)
1010  {
1011  (void) ThrowMagickException(exception,GetMagickModule(),
1012  OptionError,"NoClipPathDefined","`%s'",image->filename);
1013  write_info=DestroyImageInfo(write_info);
1014  return(MagickFalse);
1015  }
1016  image=image->clip_mask;
1017  (void) SetImageInfo(write_info,1,sans_exception);
1018  }
1019  (void) CopyMagickString(filename,image->filename,MaxTextExtent);
1020  (void) CopyMagickString(image->filename,write_info->filename,MaxTextExtent);
1021  domain=CoderPolicyDomain;
1022  rights=WritePolicyRights;
1023  if (IsRightsAuthorized(domain,rights,write_info->magick) == MagickFalse)
1024  {
1025  sans_exception=DestroyExceptionInfo(sans_exception);
1026  write_info=DestroyImageInfo(write_info);
1027  errno=EPERM;
1028  ThrowBinaryException(PolicyError,"NotAuthorized",filename);
1029  }
1030  /*
1031  Call appropriate image reader based on image type.
1032  */
1033  magick_info=GetMagickInfo(write_info->magick,sans_exception);
1034  sans_exception=DestroyExceptionInfo(sans_exception);
1035  if (magick_info != (const MagickInfo *) NULL)
1036  {
1037  if (GetMagickEndianSupport(magick_info) == MagickFalse)
1038  image->endian=UndefinedEndian;
1039  else
1040  if ((image_info->endian == UndefinedEndian) &&
1041  (GetMagickRawSupport(magick_info) != MagickFalse))
1042  {
1043  size_t
1044  lsb_first;
1045 
1046  lsb_first=1;
1047  image->endian=(*(char *) &lsb_first) == 1 ? LSBEndian : MSBEndian;
1048  }
1049  }
1050  (void) SyncImageProfiles(image);
1051  DisassociateImageStream(image);
1052  option=GetImageOption(image_info,"delegate:bimodal");
1053  if ((option != (const char *) NULL) &&
1054  (IsMagickTrue(option) != MagickFalse) &&
1055  (write_info->page == (char *) NULL) &&
1056  (GetPreviousImageInList(image) == (Image *) NULL) &&
1057  (GetNextImageInList(image) == (Image *) NULL) &&
1058  (IsTaintImage(image) == MagickFalse))
1059  {
1060  delegate_info=GetDelegateInfo(image->magick,write_info->magick,
1061  exception);
1062  if ((delegate_info != (const DelegateInfo *) NULL) &&
1063  (GetDelegateMode(delegate_info) == 0) &&
1065  {
1066  /*
1067  Process image with bi-modal delegate.
1068  */
1069  (void) CopyMagickString(image->filename,image->magick_filename,
1070  MaxTextExtent);
1071  status=InvokeDelegate(write_info,image,image->magick,
1072  write_info->magick,exception);
1073  write_info=DestroyImageInfo(write_info);
1074  (void) CopyMagickString(image->filename,filename,MaxTextExtent);
1075  return(status);
1076  }
1077  }
1078  status=MagickFalse;
1079  temporary=MagickFalse;
1080  if ((magick_info != (const MagickInfo *) NULL) &&
1081  (GetMagickSeekableStream(magick_info) != MagickFalse))
1082  {
1083  char
1084  filename[MaxTextExtent];
1085 
1086  (void) CopyMagickString(filename,image->filename,MaxTextExtent);
1087  status=OpenBlob(image_info,image,WriteBinaryBlobMode,exception);
1088  (void) CopyMagickString(image->filename,filename,MaxTextExtent);
1089  if (status != MagickFalse)
1090  {
1091  if (IsBlobSeekable(image) == MagickFalse)
1092  {
1093  /*
1094  A seekable stream is required by the encoder.
1095  */
1096  write_info->adjoin=MagickTrue;
1097  (void) CopyMagickString(write_info->filename,image->filename,
1098  MaxTextExtent);
1099  (void) AcquireUniqueFilename(image->filename);
1100  temporary=MagickTrue;
1101  }
1102  (void) CloseBlob(image);
1103  }
1104  }
1105  if ((magick_info != (const MagickInfo *) NULL) &&
1106  (GetImageEncoder(magick_info) != (EncodeImageHandler *) NULL))
1107  {
1108  /*
1109  Call appropriate image writer based on image type.
1110  */
1111  thread_support=GetMagickThreadSupport(magick_info);
1112  if ((thread_support & EncoderThreadSupport) == 0)
1113  LockSemaphoreInfo(magick_info->semaphore);
1114  status=GetImageEncoder(magick_info)(write_info,image);
1115  if ((thread_support & EncoderThreadSupport) == 0)
1116  UnlockSemaphoreInfo(magick_info->semaphore);
1117  }
1118  else
1119  {
1120  delegate_info=GetDelegateInfo((char *) NULL,write_info->magick,
1121  exception);
1122  if (delegate_info != (DelegateInfo *) NULL)
1123  {
1124  /*
1125  Process the image with delegate.
1126  */
1127  *write_info->filename='\0';
1128  if (GetDelegateThreadSupport(delegate_info) == MagickFalse)
1129  LockSemaphoreInfo(delegate_info->semaphore);
1130  status=InvokeDelegate(write_info,image,(char *) NULL,
1131  write_info->magick,exception);
1132  if (GetDelegateThreadSupport(delegate_info) == MagickFalse)
1133  UnlockSemaphoreInfo(delegate_info->semaphore);
1134  (void) CopyMagickString(image->filename,filename,MaxTextExtent);
1135  }
1136  else
1137  {
1138  sans_exception=AcquireExceptionInfo();
1139  magick_info=GetMagickInfo(write_info->magick,sans_exception);
1140  sans_exception=DestroyExceptionInfo(sans_exception);
1141  if ((write_info->affirm == MagickFalse) &&
1142  (magick_info == (const MagickInfo *) NULL))
1143  {
1144  (void) CopyMagickString(write_info->magick,image->magick,
1145  MaxTextExtent);
1146  magick_info=GetMagickInfo(write_info->magick,exception);
1147  }
1148  if ((magick_info == (const MagickInfo *) NULL) ||
1149  (GetImageEncoder(magick_info) == (EncodeImageHandler *) NULL))
1150  {
1151  char
1152  extension[MaxTextExtent];
1153 
1154  GetPathComponent(image->filename,ExtensionPath,extension);
1155  if (*extension != '\0')
1156  magick_info=GetMagickInfo(extension,exception);
1157  else
1158  magick_info=GetMagickInfo(image->magick,exception);
1159  (void) CopyMagickString(image->filename,filename,MaxTextExtent);
1160  }
1161  if ((magick_info == (const MagickInfo *) NULL) ||
1162  (GetImageEncoder(magick_info) == (EncodeImageHandler *) NULL))
1163  {
1164  magick_info=GetMagickInfo(image->magick,exception);
1165  if ((magick_info == (const MagickInfo *) NULL) ||
1166  (GetImageEncoder(magick_info) == (EncodeImageHandler *) NULL))
1167  (void) ThrowMagickException(exception,GetMagickModule(),
1168  MissingDelegateError,"NoEncodeDelegateForThisImageFormat",
1169  "`%s'",write_info->magick);
1170  else
1171  (void) ThrowMagickException(exception,GetMagickModule(),
1172  MissingDelegateWarning,"NoEncodeDelegateForThisImageFormat",
1173  "`%s'",write_info->magick);
1174  }
1175  if ((magick_info != (const MagickInfo *) NULL) &&
1176  (GetImageEncoder(magick_info) != (EncodeImageHandler *) NULL))
1177  {
1178  /*
1179  Call appropriate image writer based on image type.
1180  */
1181  thread_support=GetMagickThreadSupport(magick_info);
1182  if ((thread_support & EncoderThreadSupport) == 0)
1183  LockSemaphoreInfo(magick_info->semaphore);
1184  status=GetImageEncoder(magick_info)(write_info,image);
1185  if ((thread_support & EncoderThreadSupport) == 0)
1186  UnlockSemaphoreInfo(magick_info->semaphore);
1187  }
1188  }
1189  }
1190  if (temporary != MagickFalse)
1191  {
1192  /*
1193  Copy temporary image file to permanent.
1194  */
1195  status=OpenBlob(write_info,image,ReadBinaryBlobMode,exception);
1196  if (status != MagickFalse)
1197  {
1198  (void) RelinquishUniqueFileResource(write_info->filename);
1199  status=ImageToFile(image,write_info->filename,exception);
1200  }
1201  (void) CloseBlob(image);
1202  (void) RelinquishUniqueFileResource(image->filename);
1203  (void) CopyMagickString(image->filename,write_info->filename,
1204  MaxTextExtent);
1205  }
1206  if ((LocaleCompare(write_info->magick,"info") != 0) &&
1207  (write_info->verbose != MagickFalse))
1208  (void) IdentifyImage(image,stderr,MagickFalse);
1209  write_info=DestroyImageInfo(write_info);
1210  return(status);
1211 }
1212 
1213 /*
1214 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1215 % %
1216 % %
1217 % %
1218 % W r i t e I m a g e s %
1219 % %
1220 % %
1221 % %
1222 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1223 %
1224 % WriteImages() writes an image sequence into one or more files. While
1225 % WriteImage() can write an image sequence, it is limited to writing
1226 % the sequence into a single file using a format which supports multiple
1227 % frames. WriteImages(), however, does not have this limitation, instead it
1228 % generates multiple output files if necessary (or when requested). When
1229 % ImageInfo's adjoin flag is set to MagickFalse, the file name is expected
1230 % to include a printf-style formatting string for the frame number (e.g.
1231 % "image%02d.png").
1232 %
1233 % The format of the WriteImages method is:
1234 %
1235 % MagickBooleanType WriteImages(const ImageInfo *image_info,Image *images,
1236 % const char *filename,ExceptionInfo *exception)
1237 %
1238 % A description of each parameter follows:
1239 %
1240 % o image_info: the image info.
1241 %
1242 % o images: the image list.
1243 %
1244 % o filename: the image filename.
1245 %
1246 % o exception: return any errors or warnings in this structure.
1247 %
1248 */
1250  Image *images,const char *filename,ExceptionInfo *exception)
1251 {
1252 #define WriteImageTag "Write/Image"
1253 
1255  *sans_exception;
1256 
1257  ImageInfo
1258  *write_info;
1259 
1261  proceed;
1262 
1264  i;
1265 
1267  progress_monitor;
1268 
1270  number_images;
1271 
1273  status;
1274 
1275  register Image
1276  *p;
1277 
1278  assert(image_info != (const ImageInfo *) NULL);
1279  assert(image_info->signature == MagickSignature);
1280  assert(images != (Image *) NULL);
1281  assert(images->signature == MagickSignature);
1282  if (images->debug != MagickFalse)
1283  (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",images->filename);
1284  assert(exception != (ExceptionInfo *) NULL);
1285  write_info=CloneImageInfo(image_info);
1286  *write_info->magick='\0';
1287  images=GetFirstImageInList(images);
1288  if (filename != (const char *) NULL)
1289  for (p=images; p != (Image *) NULL; p=GetNextImageInList(p))
1290  (void) CopyMagickString(p->filename,filename,MaxTextExtent);
1291  (void) CopyMagickString(write_info->filename,images->filename,MaxTextExtent);
1292  sans_exception=AcquireExceptionInfo();
1293  (void) SetImageInfo(write_info,(unsigned int) GetImageListLength(images),
1294  sans_exception);
1295  sans_exception=DestroyExceptionInfo(sans_exception);
1296  if (*write_info->magick == '\0')
1297  (void) CopyMagickString(write_info->magick,images->magick,MaxTextExtent);
1298  p=images;
1299  for ( ; GetNextImageInList(p) != (Image *) NULL; p=GetNextImageInList(p))
1300  if (p->scene >= GetNextImageInList(p)->scene)
1301  {
1302  register ssize_t
1303  i;
1304 
1305  /*
1306  Generate consistent scene numbers.
1307  */
1308  i=(ssize_t) images->scene;
1309  for (p=images; p != (Image *) NULL; p=GetNextImageInList(p))
1310  p->scene=(size_t) i++;
1311  break;
1312  }
1313  /*
1314  Write images.
1315  */
1316  status=MagickTrue;
1317  progress_monitor=(MagickProgressMonitor) NULL;
1318  i=0;
1319  number_images=GetImageListLength(images);
1320  for (p=images; p != (Image *) NULL; p=GetNextImageInList(p))
1321  {
1322  if (number_images != 1)
1323  progress_monitor=SetImageProgressMonitor(p,(MagickProgressMonitor) NULL,
1324  p->client_data);
1325  status&=WriteImage(write_info,p);
1326  GetImageException(p,exception);
1327  if (number_images != 1)
1328  (void) SetImageProgressMonitor(p,progress_monitor,p->client_data);
1329  if (write_info->adjoin != MagickFalse)
1330  break;
1331  if (number_images != 1)
1332  {
1333  proceed=SetImageProgress(p,WriteImageTag,i++,number_images);
1334  if (proceed == MagickFalse)
1335  break;
1336  }
1337  }
1338  write_info=DestroyImageInfo(write_info);
1339  return(status != 0 ? MagickTrue : MagickFalse);
1340 }
size_t rows
Definition: image.h:174
MagickExport MagickBooleanType IdentifyImage(Image *image, FILE *file, const MagickBooleanType verbose)
Definition: identify.c:487
double y_resolution
Definition: image.h:209
MagickExport Image * CloneImages(const Image *images, const char *scenes, ExceptionInfo *exception)
Definition: list.c:199
char filename[MaxTextExtent]
Definition: image.h:467
EndianType endian
Definition: image.h:387
size_t signature
Definition: image.h:486
static MagickBooleanType SetImageProgress(const Image *image, const char *tag, const MagickOffsetType offset, const MagickSizeType extent)
DisposeType dispose
Definition: image.h:238
MagickExport MagickBooleanType GetDelegateThreadSupport(const DelegateInfo *delegate_info)
Definition: delegate.c:948
char * scenes
Definition: image.h:373
MagickExport MagickBooleanType IsRightsAuthorized(const PolicyDomain domain, const PolicyRights rights, const char *pattern)
Definition: policy.c:559
ssize_t ticks_per_second
Definition: image.h:248
MagickExport void UnlockSemaphoreInfo(SemaphoreInfo *semaphore_info)
Definition: semaphore.c:449
ProfileInfo iptc_profile
Definition: image.h:299
MagickExport ssize_t ParseCommandOption(const CommandOption option, const MagickBooleanType list, const char *options)
Definition: option.c:2513
OrientationType
Definition: image.h:77
char * extract
Definition: image.h:373
PolicyRights
Definition: policy.h:39
char * value
Definition: configure.h:30
size_t signature
Definition: exception.h:124
size_t number_scenes
Definition: image.h:379
MagickExport Image * PingImage(const ImageInfo *image_info, ExceptionInfo *exception)
Definition: constitute.c:209
double rho
Definition: geometry.h:107
MagickExport MagickStatusType ParseAbsoluteGeometry(const char *geometry, RectangleInfo *region_info)
Definition: geometry.c:664
EndianType endian
Definition: image.h:229
MagickBooleanType taint
Definition: image.h:170
MagickBooleanType debug
Definition: image.h:473
MagickExport const DelegateInfo * GetDelegateInfo(const char *decode, const char *encode, ExceptionInfo *exception)
Definition: delegate.c:636
char magick[MaxTextExtent]
Definition: image.h:278
MagickExport Image * ReadInlineImage(const ImageInfo *image_info, const char *content, ExceptionInfo *exception)
Definition: constitute.c:886
MagickExport MagickBooleanType SetImageBackgroundColor(Image *image)
Definition: image.c:2270
MagickExport ExceptionInfo * AcquireExceptionInfo(void)
Definition: exception.c:101
MagickExport ssize_t GetDelegateMode(const DelegateInfo *delegate_info)
Definition: delegate.c:916
ResolutionType units
Definition: image.h:198
size_t delay
Definition: image.h:244
#define WriteImageTag
size_t magick_rows
Definition: image.h:283
MagickExport MagickBooleanType ImageToFile(Image *image, char *filename, ExceptionInfo *exception)
Definition: blob.c:1653
MagickBooleanType verbose
Definition: image.h:431
double blur
Definition: image.h:218
unsigned char * info
Definition: profile.h:36
MagickExport MagickStatusType GetMagickThreadSupport(const MagickInfo *magick_info)
Definition: magick.c:778
char magick_filename[MaxTextExtent]
Definition: image.h:278
double sigma
Definition: geometry.h:107
size_t width
Definition: geometry.h:124
MagickExport MagickBooleanType AcquireUniqueFilename(char *path)
Definition: utility.c:109
#define ThrowBinaryException(severity, tag, context)
Definition: log.h:38
ssize_t MagickOffsetType
Definition: magick-type.h:155
Definition: image.h:152
MagickExport Image * GetPreviousImageInList(const Image *images)
Definition: list.c:786
SemaphoreInfo * semaphore
Definition: delegate.h:52
StreamHandler stream
Definition: image.h:455
MagickExport MagickBooleanType GetMagickRawSupport(const MagickInfo *magick_info)
Definition: magick.c:715
MagickExport Image * CropImage(const Image *image, const RectangleInfo *geometry, ExceptionInfo *exception)
Definition: transform.c:612
MagickExport const struct stat * GetBlobProperties(const Image *)
Definition: blob.c:1338
MagickExport void LockSemaphoreInfo(SemaphoreInfo *semaphore_info)
Definition: semaphore.c:344
MagickExport unsigned char * GetStringInfoDatum(const StringInfo *string_info)
Definition: string.c:1256
MagickExport Image * GetFirstImageInList(const Image *images)
Definition: list.c:542
#define MagickSignature
char magick[MaxTextExtent]
Definition: image.h:467
SemaphoreInfo * semaphore
Definition: magick.h:102
MagickExport Image * BlobToImage(const ImageInfo *image_info, const void *blob, const size_t length, ExceptionInfo *exception)
Definition: blob.c:315
MagickExport void GetPathComponent(const char *path, PathType type, char *component)
Definition: utility.c:1190
MagickBooleanType
Definition: magick-type.h:211
char filename[MaxTextExtent]
Definition: image.h:278
MagickExport Image * NewImageList(void)
Definition: list.c:918
size_t scene
Definition: image.h:244
unsigned int MagickStatusType
Definition: magick-type.h:147
MagickExport MagickBooleanType IsMagickTrue(const char *value)
Definition: token.c:646
MagickExport const char * GetImageProperty(const Image *image, const char *property)
Definition: property.c:2048
static long StringToLong(const char *restrict value)
ProfileInfo color_profile
Definition: image.h:299
MagickExport unsigned char * Base64Decode(const char *source, size_t *length)
Definition: utility.c:329
MagickExport Image * AcquireImage(const ImageInfo *image_info)
Definition: image.c:149
MagickBooleanType EncodeImageHandler(const ImageInfo *, Image *)
Definition: magick.h:46
MagickExport MagickBooleanType RelinquishUniqueFileResource(const char *path)
Definition: resource.c:1029
#define MaxTextExtent
MagickExport MagickBooleanType CloseBlob(Image *)
MagickExport const StringInfo * GetImageProfile(const Image *image, const char *name)
Definition: profile.c:239
MagickExport ssize_t FormatMagickTime(const time_t time, const size_t length, char *timestamp)
Definition: string.c:1149
size_t scene
Definition: image.h:379
MagickExport MagickBooleanType WriteImage(const ImageInfo *image_info, Image *image)
Definition: constitute.c:955
#define magick_unused(x)
RectangleInfo page
Definition: image.h:213
size_t magick_columns
Definition: image.h:283
size_t MagickSizeType
Definition: magick-type.h:156
MagickExport int LocaleCompare(const char *p, const char *q)
Definition: string.c:1524
MagickExport MagickBooleanType IsBlobTemporary(const Image *image)
Definition: blob.c:2144
#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:196
MagickExport Image * ReadImage(const ImageInfo *image_info, ExceptionInfo *exception)
Definition: constitute.c:352
MagickBooleanType LogMagickEvent(const LogEventType type, const char *module, const char *function, const size_t line, const char *format,...)
Definition: log.c:1379
MagickExport const char * GetImageOption(const ImageInfo *image_info, const char *key)
Definition: option.c:1883
MagickExport MagickBooleanType SetImageInfo(ImageInfo *image_info, const unsigned int frames, ExceptionInfo *exception)
Definition: image.c:2630
#define ThrowReaderException(severity, tag)
MagickExport DecodeImageHandler * GetImageDecoder(const MagickInfo *magick_info)
Definition: magick.c:149
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:1047
MagickExport MagickBooleanType IsPathAccessible(const char *path)
Definition: utility.c:1426
size_t signature
Definition: image.h:307
size_t columns
Definition: image.h:174
MagickExport size_t InterpretImageFilename(const ImageInfo *image_info, Image *image, const char *format, int value, char *filename)
Definition: image.c:1648
MagickExport const MagickInfo * GetMagickInfo(const char *name, ExceptionInfo *exception)
Definition: magick.c:403
MagickExport Image * ResizeImage(const Image *image, const size_t columns, const size_t rows, const FilterTypes filter, const double blur, ExceptionInfo *exception)
Definition: resize.c:2908
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:124
MagickExport void ResetTimer(TimerInfo *time_info)
Definition: timer.c:331
MagickExport Image * ReadImages(const ImageInfo *image_info, ExceptionInfo *exception)
Definition: constitute.c:790
MagickExport EncodeImageHandler * GetImageEncoder(const MagickInfo *magick_info)
Definition: magick.c:179
MagickExport Image * ReadStream(const ImageInfo *image_info, StreamHandler stream, ExceptionInfo *exception)
Definition: stream.c:934
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:739
MagickExport Image * DestroyImageList(Image *images)
Definition: list.c:443
MagickExport MagickBooleanType GetMagickEndianSupport(const MagickInfo *magick_info)
Definition: magick.c:368
MagickExport MagickBooleanType IsBlobSeekable(const Image *image)
Definition: blob.c:2095
MagickExport char * InterpretImageProperties(const ImageInfo *image_info, Image *image, const char *embed_text)
Definition: property.c:3296
TimerInfo timer
Definition: image.h:261
PolicyDomain
Definition: policy.h:28
DisposeType
Definition: layer.h:25
#define GetMagickModule()
Definition: log.h:29
StorageType
Definition: constitute.h:25
MagickExport Image * PingImages(const ImageInfo *image_info, ExceptionInfo *exception)
Definition: constitute.c:261
MagickBooleanType affirm
Definition: image.h:367
#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:128
MagickExport ImageInfo * DestroyImageInfo(ImageInfo *image_info)
Definition: image.c:1237
MagickExport MagickBooleanType IsTaintImage(const Image *image)
Definition: image.c:1967
MagickExport MagickBooleanType SetImageProperty(Image *image, const char *property, const char *value)
Definition: property.c:3720
MagickExport MagickBooleanType SyncImageProfiles(Image *image)
Definition: profile.c:2132
MagickExport void ReplaceImageInList(Image **images, Image *replace)
Definition: list.c:1141
MagickExport Image * GetNextImageInList(const Image *images)
Definition: list.c:754
MagickExport char * DestroyString(char *string)
Definition: string.c:809
double x_resolution
Definition: image.h:209
MagickExport MagickBooleanType DeleteImageProperty(Image *image, const char *property)
Definition: property.c:270
MagickExport ImageInfo * CloneImageInfo(const ImageInfo *image_info)
Definition: image.c:934
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)
Definition: pixel.c:4122
MagickExport MagickStatusType ParseGeometry(const char *geometry, GeometryInfo *geometry_info)
Definition: geometry.c:814
MagickExport void AppendImageToList(Image **images, const Image *append)
Definition: list.c:77
size_t length
Definition: profile.h:33
MagickExport void * RelinquishMagickMemory(void *memory)
Definition: memory.c:963
MagickExport void GetImageException(Image *image, ExceptionInfo *exception)
Definition: image.c:1372
#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:1097
ResolutionType
Definition: image.h:90
#define MagickExport
OrientationType orientation
Definition: image.h:167
MagickExport MagickBooleanType GetMagickSeekableStream(const MagickInfo *magick_info)
Definition: magick.c:747
struct _ConfigureInfo * next
Definition: configure.h:38
struct _Image * clip_mask
Definition: image.h:240
MagickBooleanType adjoin
Definition: image.h:367
char * page
Definition: image.h:373
MagickBooleanType ping
Definition: image.h:431
MagickExport MagickBooleanType IsSceneGeometry(const char *geometry, const MagickBooleanType pedantic)
Definition: geometry.c:612
MagickExport size_t GetStringInfoLength(const StringInfo *string_info)
Definition: string.c:1285
MagickExport size_t GetImageListLength(const Image *images)
Definition: list.c:682
void * client_data
Definition: image.h:267
MagickExport Image * DestroyImage(Image *image)
Definition: image.c:1164
MagickExport MagickStatusType ParseRegionGeometry(const Image *image, const char *geometry, RectangleInfo *region_info, ExceptionInfo *exception)
Definition: geometry.c:1493
MagickExport void DisassociateImageStream(Image *image)
Definition: image.c:1304
size_t(* StreamHandler)(const Image *, const void *, const size_t)
Definition: stream.h:26
MagickBooleanType temporary
Definition: image.h:367
MagickBooleanType debug
Definition: image.h:290
MagickExport ExceptionInfo * DestroyExceptionInfo(ExceptionInfo *exception)
Definition: exception.c:431
ExceptionInfo exception
Definition: image.h:287
MagickExport MagickBooleanType WriteImages(const ImageInfo *image_info, Image *images, const char *filename, ExceptionInfo *exception)
Definition: constitute.c:1249
MagickExport void InheritException(ExceptionInfo *exception, const ExceptionInfo *relative)
Definition: exception.c:623
FilterTypes filter
Definition: image.h:223
ExceptionType severity
Definition: exception.h:105
Image * DecodeImageHandler(const ImageInfo *, ExceptionInfo *)
Definition: magick.h:43