MagickCore  7.0.7
Convert, Edit, Or Compose Bitmap Images
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-2018 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 % https://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 
391  /*
392  Determine image type from filename prefix or suffix (e.g. image.jpg).
393  */
394  assert(image_info != (ImageInfo *) NULL);
395  assert(image_info->signature == MagickCoreSignature);
396  assert(image_info->filename != (char *) NULL);
397  if (image_info->debug != MagickFalse)
399  image_info->filename);
400  assert(exception != (ExceptionInfo *) NULL);
401  read_info=CloneImageInfo(image_info);
402  (void) CopyMagickString(magick_filename,read_info->filename,MagickPathExtent);
403  (void) SetImageInfo(read_info,0,exception);
404  (void) CopyMagickString(filename,read_info->filename,MagickPathExtent);
405  (void) CopyMagickString(magick,read_info->magick,MagickPathExtent);
406  /*
407  Call appropriate image reader based on image type.
408  */
409  sans_exception=AcquireExceptionInfo();
410  magick_info=GetMagickInfo(read_info->magick,sans_exception);
411  sans_exception=DestroyExceptionInfo(sans_exception);
412  if (magick_info != (const MagickInfo *) NULL)
413  {
415  domain;
416 
418  rights;
419 
420  domain=CoderPolicyDomain;
421  rights=ReadPolicyRights;
422  if (IsRightsAuthorized(domain,rights,magick_info->module) == MagickFalse)
423  {
424  errno=EPERM;
426  "NotAuthorized","`%s'",read_info->filename);
427  read_info=DestroyImageInfo(read_info);
428  return((Image *) 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) &&
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  ssize_t
607  option_type;
608 
609  next->taint=MagickFalse;
610  GetPathComponent(magick_filename,MagickPath,magick_path);
611  if (*magick_path == '\0' && *next->magick == '\0')
612  (void) CopyMagickString(next->magick,magick,MagickPathExtent);
613  (void) CopyMagickString(next->magick_filename,magick_filename,
615  if (IsBlobTemporary(image) != MagickFalse)
616  (void) CopyMagickString(next->filename,filename,MagickPathExtent);
617  if (next->magick_columns == 0)
618  next->magick_columns=next->columns;
619  if (next->magick_rows == 0)
620  next->magick_rows=next->rows;
621  value=GetImageProperty(next,"tiff:Orientation",exception);
622  if (value == (char *) NULL)
623  value=GetImageProperty(next,"exif:Orientation",exception);
624  if (value != (char *) NULL)
625  {
627  (void) DeleteImageProperty(next,"tiff:Orientation");
628  (void) DeleteImageProperty(next,"exif:Orientation");
629  }
630  value=GetImageProperty(next,"exif:XResolution",exception);
631  if (value != (char *) NULL)
632  {
633  geometry_info.rho=next->resolution.x;
634  geometry_info.sigma=1.0;
635  flags=ParseGeometry(value,&geometry_info);
636  if (geometry_info.sigma != 0)
637  next->resolution.x=geometry_info.rho/geometry_info.sigma;
638  if (strchr(value,',') != (char *) NULL)
639  next->resolution.x=geometry_info.rho+geometry_info.sigma/1000.0;
640  (void) DeleteImageProperty(next,"exif:XResolution");
641  }
642  value=GetImageProperty(next,"exif:YResolution",exception);
643  if (value != (char *) NULL)
644  {
645  geometry_info.rho=next->resolution.y;
646  geometry_info.sigma=1.0;
647  flags=ParseGeometry(value,&geometry_info);
648  if (geometry_info.sigma != 0)
649  next->resolution.y=geometry_info.rho/geometry_info.sigma;
650  if (strchr(value,',') != (char *) NULL)
651  next->resolution.y=geometry_info.rho+geometry_info.sigma/1000.0;
652  (void) DeleteImageProperty(next,"exif:YResolution");
653  }
654  value=GetImageProperty(next,"tiff:ResolutionUnit",exception);
655  if (value == (char *) NULL)
656  value=GetImageProperty(next,"exif:ResolutionUnit",exception);
657  if (value != (char *) NULL)
658  {
660  value);
661  if (option_type >= 0)
662  next->units=(ResolutionType) option_type;
663  (void) DeleteImageProperty(next,"exif:ResolutionUnit");
664  (void) DeleteImageProperty(next,"tiff:ResolutionUnit");
665  }
666  if (next->page.width == 0)
667  next->page.width=next->columns;
668  if (next->page.height == 0)
669  next->page.height=next->rows;
670  option=GetImageOption(read_info,"caption");
671  if (option != (const char *) NULL)
672  {
673  property=InterpretImageProperties(read_info,next,option,exception);
674  (void) SetImageProperty(next,"caption",property,exception);
675  property=DestroyString(property);
676  }
677  option=GetImageOption(read_info,"comment");
678  if (option != (const char *) NULL)
679  {
680  property=InterpretImageProperties(read_info,next,option,exception);
681  (void) SetImageProperty(next,"comment",property,exception);
682  property=DestroyString(property);
683  }
684  option=GetImageOption(read_info,"label");
685  if (option != (const char *) NULL)
686  {
687  property=InterpretImageProperties(read_info,next,option,exception);
688  (void) SetImageProperty(next,"label",property,exception);
689  property=DestroyString(property);
690  }
691  if (LocaleCompare(next->magick,"TEXT") == 0)
692  (void) ParseAbsoluteGeometry("0x0+0+0",&next->page);
693  if ((read_info->extract != (char *) NULL) &&
694  (read_info->stream == (StreamHandler) NULL))
695  {
697  geometry;
698 
699  SetGeometry(next,&geometry);
700  flags=ParseAbsoluteGeometry(read_info->extract,&geometry);
701  if ((next->columns != geometry.width) ||
702  (next->rows != geometry.height))
703  {
704  if (((flags & XValue) != 0) || ((flags & YValue) != 0))
705  {
706  Image
707  *crop_image;
708 
709  crop_image=CropImage(next,&geometry,exception);
710  if (crop_image != (Image *) NULL)
711  ReplaceImageInList(&next,crop_image);
712  }
713  else
714  if (((flags & WidthValue) != 0) || ((flags & HeightValue) != 0))
715  {
716  Image
717  *size_image;
718 
719  flags=ParseRegionGeometry(next,read_info->extract,&geometry,
720  exception);
721  size_image=ResizeImage(next,geometry.width,geometry.height,
722  next->filter,exception);
723  if (size_image != (Image *) NULL)
724  ReplaceImageInList(&next,size_image);
725  }
726  }
727  }
728  profile=GetImageProfile(next,"icc");
729  if (profile == (const StringInfo *) NULL)
730  profile=GetImageProfile(next,"icm");
731  profile=GetImageProfile(next,"iptc");
732  if (profile == (const StringInfo *) NULL)
733  profile=GetImageProfile(next,"8bim");
734  (void) FormatMagickTime(GetBlobProperties(next)->st_mtime,MagickPathExtent,
735  timestamp);
736  (void) SetImageProperty(next,"date:modify",timestamp,exception);
737  (void) FormatMagickTime(GetBlobProperties(next)->st_ctime,MagickPathExtent,
738  timestamp);
739  (void) SetImageProperty(next,"date:create",timestamp,exception);
740  option=GetImageOption(image_info,"delay");
741  if (option != (const char *) NULL)
742  {
743  flags=ParseGeometry(option,&geometry_info);
744  if ((flags & GreaterValue) != 0)
745  {
746  if (next->delay > (size_t) floor(geometry_info.rho+0.5))
747  next->delay=(size_t) floor(geometry_info.rho+0.5);
748  }
749  else
750  if ((flags & LessValue) != 0)
751  {
752  if (next->delay < (size_t) floor(geometry_info.rho+0.5))
753  next->ticks_per_second=(ssize_t) floor(geometry_info.sigma+0.5);
754  }
755  else
756  next->delay=(size_t) floor(geometry_info.rho+0.5);
757  if ((flags & SigmaValue) != 0)
758  next->ticks_per_second=(ssize_t) floor(geometry_info.sigma+0.5);
759  }
760  option=GetImageOption(image_info,"dispose");
761  if (option != (const char *) NULL)
762  {
764  option);
765  if (option_type >= 0)
766  next->dispose=(DisposeType) option_type;
767  }
768  if (read_info->verbose != MagickFalse)
769  (void) IdentifyImage(next,stderr,MagickFalse,exception);
770  image=next;
771  }
772  read_info=DestroyImageInfo(read_info);
773  return(GetFirstImageInList(image));
774 }
775 
776 /*
777 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
778 % %
779 % %
780 % %
781 % R e a d I m a g e s %
782 % %
783 % %
784 % %
785 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
786 %
787 % ReadImages() reads one or more images and returns them as an image list.
788 %
789 % The format of the ReadImage method is:
790 %
791 % Image *ReadImages(ImageInfo *image_info,const char *filename,
792 % ExceptionInfo *exception)
793 %
794 % A description of each parameter follows:
795 %
796 % o image_info: the image info.
797 %
798 % o filename: the image filename.
799 %
800 % o exception: return any errors or warnings in this structure.
801 %
802 */
803 MagickExport Image *ReadImages(ImageInfo *image_info,const char *filename,
804  ExceptionInfo *exception)
805 {
806  char
807  read_filename[MagickPathExtent];
808 
809  Image
810  *image,
811  *images;
812 
813  ImageInfo
814  *read_info;
815 
816  /*
817  Read image list from a file.
818  */
819  assert(image_info != (ImageInfo *) NULL);
820  assert(image_info->signature == MagickCoreSignature);
821  if (image_info->debug != MagickFalse)
823  image_info->filename);
824  assert(exception != (ExceptionInfo *) NULL);
825  read_info=CloneImageInfo(image_info);
826  *read_info->magick='\0';
827  (void) SetImageOption(read_info,"filename",filename);
828  (void) CopyMagickString(read_info->filename,filename,MagickPathExtent);
829  (void) InterpretImageFilename(read_info,(Image *) NULL,filename,
830  (int) read_info->scene,read_filename,exception);
831  if (LocaleCompare(read_filename,read_info->filename) != 0)
832  {
834  *sans;
835 
836  ssize_t
837  extent,
838  scene;
839 
840  /*
841  Images of the form image-%d.png[1-5].
842  */
843  sans=AcquireExceptionInfo();
844  (void) SetImageInfo(read_info,0,sans);
845  sans=DestroyExceptionInfo(sans);
846  if (read_info->number_scenes != 0)
847  {
848  (void) CopyMagickString(read_filename,read_info->filename,
850  images=NewImageList();
851  extent=(ssize_t) (read_info->scene+read_info->number_scenes);
852  scene=(ssize_t) read_info->scene;
853  for ( ; scene < (ssize_t) extent; scene++)
854  {
855  (void) InterpretImageFilename(image_info,(Image *) NULL,
856  read_filename,(int) scene,read_info->filename,exception);
857  image=ReadImage(read_info,exception);
858  if (image == (Image *) NULL)
859  continue;
860  AppendImageToList(&images,image);
861  }
862  read_info=DestroyImageInfo(read_info);
863  return(images);
864  }
865  }
866  (void) CopyMagickString(read_info->filename,filename,MagickPathExtent);
867  image=ReadImage(read_info,exception);
868  read_info=DestroyImageInfo(read_info);
869  return(image);
870 }
871 
872 /*
873 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
874 % %
875 % %
876 % %
877 + R e a d I n l i n e I m a g e %
878 % %
879 % %
880 % %
881 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
882 %
883 % ReadInlineImage() reads a Base64-encoded inline image or image sequence.
884 % The method returns a NULL if there is a memory shortage or if the image
885 % cannot be read. On failure, a NULL image is returned and exception
886 % describes the reason for the failure.
887 %
888 % The format of the ReadInlineImage method is:
889 %
890 % Image *ReadInlineImage(const ImageInfo *image_info,const char *content,
891 % ExceptionInfo *exception)
892 %
893 % A description of each parameter follows:
894 %
895 % o image_info: the image info.
896 %
897 % o content: the image encoded in Base64.
898 %
899 % o exception: return any errors or warnings in this structure.
900 %
901 */
903  const char *content,ExceptionInfo *exception)
904 {
905  Image
906  *image;
907 
908  ImageInfo
909  *read_info;
910 
911  unsigned char
912  *blob;
913 
914  size_t
915  length;
916 
917  register const char
918  *p;
919 
920  /*
921  Skip over header (e.g. data:image/gif;base64,).
922  */
923  image=NewImageList();
924  for (p=content; (*p != ',') && (*p != '\0'); p++) ;
925  if (*p == '\0')
926  ThrowReaderException(CorruptImageError,"CorruptImage");
927  p++;
928  length=0;
929  blob=Base64Decode(p,&length);
930  if (length == 0)
931  {
932  blob=(unsigned char *) RelinquishMagickMemory(blob);
933  ThrowReaderException(CorruptImageError,"CorruptImage");
934  }
935  read_info=CloneImageInfo(image_info);
936  (void) SetImageInfoProgressMonitor(read_info,(MagickProgressMonitor) NULL,
937  (void *) NULL);
938  *read_info->filename='\0';
939  *read_info->magick='\0';
940  image=BlobToImage(read_info,blob,length,exception);
941  blob=(unsigned char *) RelinquishMagickMemory(blob);
942  read_info=DestroyImageInfo(read_info);
943  return(image);
944 }
945 
946 /*
947 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
948 % %
949 % %
950 % %
951 % W r i t e I m a g e %
952 % %
953 % %
954 % %
955 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
956 %
957 % WriteImage() writes an image or an image sequence to a file or file handle.
958 % If writing to a file is on disk, the name is defined by the filename member
959 % of the image structure. WriteImage() returns MagickFalse is there is a
960 % memory shortage or if the image cannot be written. Check the exception
961 % member of image to determine the cause for any failure.
962 %
963 % The format of the WriteImage method is:
964 %
965 % MagickBooleanType WriteImage(const ImageInfo *image_info,Image *image,
966 % ExceptionInfo *exception)
967 %
968 % A description of each parameter follows:
969 %
970 % o image_info: the image info.
971 %
972 % o image: the image.
973 %
974 % o exception: return any errors or warnings in this structure.
975 %
976 */
978  Image *image,ExceptionInfo *exception)
979 {
980  char
981  filename[MagickPathExtent];
982 
983  const char
984  *option;
985 
986  const DelegateInfo
987  *delegate_info;
988 
989  const MagickInfo
990  *magick_info;
991 
993  *sans_exception;
994 
995  ImageInfo
996  *write_info;
997 
999  status,
1000  temporary;
1001 
1002  /*
1003  Determine image type from filename prefix or suffix (e.g. image.jpg).
1004  */
1005  assert(image_info != (ImageInfo *) NULL);
1006  assert(image_info->signature == MagickCoreSignature);
1007  if (image->debug != MagickFalse)
1009  image_info->filename);
1010  assert(image != (Image *) NULL);
1011  assert(image->signature == MagickCoreSignature);
1012  assert(exception != (ExceptionInfo *) NULL);
1013  sans_exception=AcquireExceptionInfo();
1014  write_info=CloneImageInfo(image_info);
1015  (void) CopyMagickString(write_info->filename,image->filename,
1017  (void) SetImageInfo(write_info,1,sans_exception);
1018  if (*write_info->magick == '\0')
1019  (void) CopyMagickString(write_info->magick,image->magick,MagickPathExtent);
1020  (void) CopyMagickString(filename,image->filename,MagickPathExtent);
1021  (void) CopyMagickString(image->filename,write_info->filename,
1023  /*
1024  Call appropriate image writer based on image type.
1025  */
1026  magick_info=GetMagickInfo(write_info->magick,sans_exception);
1027  sans_exception=DestroyExceptionInfo(sans_exception);
1028  if (magick_info != (const MagickInfo *) NULL)
1029  {
1030  PolicyDomain
1031  domain;
1032 
1033  PolicyRights
1034  rights;
1035 
1036  domain=CoderPolicyDomain;
1037  rights=WritePolicyRights;
1038  if (IsRightsAuthorized(domain,rights,magick_info->module) == MagickFalse)
1039  {
1040  write_info=DestroyImageInfo(write_info);
1041  errno=EPERM;
1042  ThrowBinaryException(PolicyError,"NotAuthorized",filename);
1043  }
1044  if (GetMagickEndianSupport(magick_info) == MagickFalse)
1045  image->endian=UndefinedEndian;
1046  else
1047  if ((image_info->endian == UndefinedEndian) &&
1048  (GetMagickRawSupport(magick_info) != MagickFalse))
1049  {
1050  unsigned long
1051  lsb_first;
1052 
1053  lsb_first=1;
1054  image->endian=(*(char *) &lsb_first) == 1 ? LSBEndian : MSBEndian;
1055  }
1056  }
1057  (void) SyncImageProfiles(image);
1058  DisassociateImageStream(image);
1059  option=GetImageOption(image_info,"delegate:bimodal");
1060  if ((IsStringTrue(option) != MagickFalse) &&
1061  (write_info->page == (char *) NULL) &&
1062  (GetPreviousImageInList(image) == (Image *) NULL) &&
1063  (GetNextImageInList(image) == (Image *) NULL) &&
1064  (IsTaintImage(image) == MagickFalse) )
1065  {
1066  delegate_info=GetDelegateInfo(image->magick,write_info->magick,exception);
1067  if ((delegate_info != (const DelegateInfo *) NULL) &&
1068  (GetDelegateMode(delegate_info) == 0) &&
1070  {
1071  /*
1072  Process image with bi-modal delegate.
1073  */
1074  (void) CopyMagickString(image->filename,image->magick_filename,
1076  status=InvokeDelegate(write_info,image,image->magick,
1077  write_info->magick,exception);
1078  write_info=DestroyImageInfo(write_info);
1079  (void) CopyMagickString(image->filename,filename,MagickPathExtent);
1080  return(status);
1081  }
1082  }
1083  status=MagickFalse;
1084  temporary=MagickFalse;
1085  if ((magick_info != (const MagickInfo *) NULL) &&
1086  (GetMagickEncoderSeekableStream(magick_info) != MagickFalse))
1087  {
1088  char
1089  image_filename[MagickPathExtent];
1090 
1091  (void) CopyMagickString(image_filename,image->filename,MagickPathExtent);
1092  status=OpenBlob(image_info,image,WriteBinaryBlobMode,exception);
1093  (void) CopyMagickString(image->filename, image_filename,MagickPathExtent);
1094  if (status != MagickFalse)
1095  {
1096  if (IsBlobSeekable(image) == MagickFalse)
1097  {
1098  /*
1099  A seekable stream is required by the encoder.
1100  */
1101  write_info->adjoin=MagickTrue;
1102  (void) CopyMagickString(write_info->filename,image->filename,
1104  (void) AcquireUniqueFilename(image->filename);
1105  temporary=MagickTrue;
1106  }
1107  (void) CloseBlob(image);
1108  }
1109  }
1110  if ((magick_info != (const MagickInfo *) NULL) &&
1111  (GetImageEncoder(magick_info) != (EncodeImageHandler *) NULL))
1112  {
1113  /*
1114  Call appropriate image writer based on image type.
1115  */
1116  if (GetMagickEncoderThreadSupport(magick_info) == MagickFalse)
1117  LockSemaphoreInfo(magick_info->semaphore);
1118  status=GetImageEncoder(magick_info)(write_info,image,exception);
1119  if (GetMagickEncoderThreadSupport(magick_info) == MagickFalse)
1120  UnlockSemaphoreInfo(magick_info->semaphore);
1121  }
1122  else
1123  {
1124  delegate_info=GetDelegateInfo((char *) NULL,write_info->magick,exception);
1125  if (delegate_info != (DelegateInfo *) NULL)
1126  {
1127  /*
1128  Process the image with delegate.
1129  */
1130  *write_info->filename='\0';
1131  if (GetDelegateThreadSupport(delegate_info) == MagickFalse)
1132  LockSemaphoreInfo(delegate_info->semaphore);
1133  status=InvokeDelegate(write_info,image,(char *) NULL,
1134  write_info->magick,exception);
1135  if (GetDelegateThreadSupport(delegate_info) == MagickFalse)
1136  UnlockSemaphoreInfo(delegate_info->semaphore);
1137  (void) CopyMagickString(image->filename,filename,MagickPathExtent);
1138  }
1139  else
1140  {
1141  sans_exception=AcquireExceptionInfo();
1142  magick_info=GetMagickInfo(write_info->magick,sans_exception);
1143  sans_exception=DestroyExceptionInfo(sans_exception);
1144  if ((write_info->affirm == MagickFalse) &&
1145  (magick_info == (const MagickInfo *) NULL))
1146  {
1147  (void) CopyMagickString(write_info->magick,image->magick,
1149  magick_info=GetMagickInfo(write_info->magick,exception);
1150  }
1151  if ((magick_info == (const MagickInfo *) NULL) ||
1152  (GetImageEncoder(magick_info) == (EncodeImageHandler *) NULL))
1153  {
1154  char
1155  extension[MagickPathExtent];
1156 
1157  GetPathComponent(image->filename,ExtensionPath,extension);
1158  if (*extension != '\0')
1159  magick_info=GetMagickInfo(extension,exception);
1160  else
1161  magick_info=GetMagickInfo(image->magick,exception);
1162  (void) CopyMagickString(image->filename,filename,
1164  }
1165  if ((magick_info == (const MagickInfo *) NULL) ||
1166  (GetImageEncoder(magick_info) == (EncodeImageHandler *) NULL))
1167  {
1168  magick_info=GetMagickInfo(image->magick,exception);
1169  if ((magick_info == (const MagickInfo *) NULL) ||
1170  (GetImageEncoder(magick_info) == (EncodeImageHandler *) NULL))
1171  (void) ThrowMagickException(exception,GetMagickModule(),
1172  MissingDelegateError,"NoEncodeDelegateForThisImageFormat",
1173  "`%s'",write_info->magick);
1174  else
1175  (void) ThrowMagickException(exception,GetMagickModule(),
1176  MissingDelegateWarning,"NoEncodeDelegateForThisImageFormat",
1177  "`%s'",write_info->magick);
1178  }
1179  if ((magick_info != (const MagickInfo *) NULL) &&
1180  (GetImageEncoder(magick_info) != (EncodeImageHandler *) NULL))
1181  {
1182  /*
1183  Call appropriate image writer based on image type.
1184  */
1185  if (GetMagickEncoderThreadSupport(magick_info) == MagickFalse)
1186  LockSemaphoreInfo(magick_info->semaphore);
1187  status=GetImageEncoder(magick_info)(write_info,image,exception);
1188  if (GetMagickEncoderThreadSupport(magick_info) == MagickFalse)
1189  UnlockSemaphoreInfo(magick_info->semaphore);
1190  }
1191  }
1192  }
1193  if (temporary != MagickFalse)
1194  {
1195  /*
1196  Copy temporary image file to permanent.
1197  */
1198  status=OpenBlob(write_info,image,ReadBinaryBlobMode,exception);
1199  if (status != MagickFalse)
1200  {
1201  (void) RelinquishUniqueFileResource(write_info->filename);
1202  status=ImageToFile(image,write_info->filename,exception);
1203  }
1204  (void) CloseBlob(image);
1205  (void) RelinquishUniqueFileResource(image->filename);
1206  (void) CopyMagickString(image->filename,write_info->filename,
1208  }
1209  if ((LocaleCompare(write_info->magick,"info") != 0) &&
1210  (write_info->verbose != MagickFalse))
1211  (void) IdentifyImage(image,stdout,MagickFalse,exception);
1212  write_info=DestroyImageInfo(write_info);
1213  return(status);
1214 }
1215 
1216 /*
1217 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1218 % %
1219 % %
1220 % %
1221 % W r i t e I m a g e s %
1222 % %
1223 % %
1224 % %
1225 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1226 %
1227 % WriteImages() writes an image sequence into one or more files. While
1228 % WriteImage() can write an image sequence, it is limited to writing
1229 % the sequence into a single file using a format which supports multiple
1230 % frames. WriteImages(), however, does not have this limitation, instead it
1231 % generates multiple output files if necessary (or when requested). When
1232 % ImageInfo's adjoin flag is set to MagickFalse, the file name is expected
1233 % to include a printf-style formatting string for the frame number (e.g.
1234 % "image%02d.png").
1235 %
1236 % The format of the WriteImages method is:
1237 %
1238 % MagickBooleanType WriteImages(const ImageInfo *image_info,Image *images,
1239 % const char *filename,ExceptionInfo *exception)
1240 %
1241 % A description of each parameter follows:
1242 %
1243 % o image_info: the image info.
1244 %
1245 % o images: the image list.
1246 %
1247 % o filename: the image filename.
1248 %
1249 % o exception: return any errors or warnings in this structure.
1250 %
1251 */
1253  Image *images,const char *filename,ExceptionInfo *exception)
1254 {
1255 #define WriteImageTag "Write/Image"
1256 
1258  *sans_exception;
1259 
1260  ImageInfo
1261  *write_info;
1262 
1264  proceed;
1265 
1267  progress;
1268 
1270  progress_monitor;
1271 
1273  number_images;
1274 
1276  status;
1277 
1278  register Image
1279  *p;
1280 
1281  assert(image_info != (const ImageInfo *) NULL);
1282  assert(image_info->signature == MagickCoreSignature);
1283  assert(images != (Image *) NULL);
1284  assert(images->signature == MagickCoreSignature);
1285  if (images->debug != MagickFalse)
1286  (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",images->filename);
1287  assert(exception != (ExceptionInfo *) NULL);
1288  write_info=CloneImageInfo(image_info);
1289  *write_info->magick='\0';
1290  images=GetFirstImageInList(images);
1291  if (filename != (const char *) NULL)
1292  for (p=images; p != (Image *) NULL; p=GetNextImageInList(p))
1293  (void) CopyMagickString(p->filename,filename,MagickPathExtent);
1294  (void) CopyMagickString(write_info->filename,images->filename,
1296  sans_exception=AcquireExceptionInfo();
1297  (void) SetImageInfo(write_info,(unsigned int) GetImageListLength(images),
1298  sans_exception);
1299  sans_exception=DestroyExceptionInfo(sans_exception);
1300  if (*write_info->magick == '\0')
1301  (void) CopyMagickString(write_info->magick,images->magick,MagickPathExtent);
1302  p=images;
1303  for ( ; GetNextImageInList(p) != (Image *) NULL; p=GetNextImageInList(p))
1304  {
1305  register Image
1306  *next;
1307 
1308  next=GetNextImageInList(p);
1309  if (next == (Image *) NULL)
1310  break;
1311  if (p->scene >= next->scene)
1312  {
1313  register ssize_t
1314  i;
1315 
1316  /*
1317  Generate consistent scene numbers.
1318  */
1319  i=(ssize_t) images->scene;
1320  for (p=images; p != (Image *) NULL; p=GetNextImageInList(p))
1321  p->scene=(size_t) i++;
1322  break;
1323  }
1324  }
1325  /*
1326  Write images.
1327  */
1328  status=MagickTrue;
1329  progress_monitor=(MagickProgressMonitor) NULL;
1330  progress=0;
1331  number_images=GetImageListLength(images);
1332  for (p=images; p != (Image *) NULL; p=GetNextImageInList(p))
1333  {
1334  if (number_images != 1)
1335  progress_monitor=SetImageProgressMonitor(p,(MagickProgressMonitor) NULL,
1336  p->client_data);
1337  status&=WriteImage(write_info,p,exception);
1338  if (number_images != 1)
1339  (void) SetImageProgressMonitor(p,progress_monitor,p->client_data);
1340  if (write_info->adjoin != MagickFalse)
1341  break;
1342  if (number_images != 1)
1343  {
1344  proceed=SetImageProgress(p,WriteImageTag,progress++,number_images);
1345  if (proceed == MagickFalse)
1346  break;
1347  }
1348  }
1349  write_info=DestroyImageInfo(write_info);
1350  return(status != 0 ? MagickTrue : MagickFalse);
1351 }
size_t rows
Definition: image.h:172
MagickExport Image * ResizeImage(const Image *image, const size_t columns, const size_t rows, const FilterType filter, ExceptionInfo *exception)
Definition: resize.c:2862
MagickExport Image * CloneImages(const Image *images, const char *scenes, ExceptionInfo *exception)
Definition: list.c:203
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:237
char magick[MagickPathExtent]
Definition: image.h:471
MagickExport MagickBooleanType GetDelegateThreadSupport(const DelegateInfo *delegate_info)
Definition: delegate.c:1473
char * scenes
Definition: image.h:381
MagickExport MagickBooleanType IsRightsAuthorized(const PolicyDomain domain, const PolicyRights rights, const char *pattern)
Definition: policy.c:594
ssize_t ticks_per_second
Definition: image.h:245
FilterType filter
Definition: image.h:219
MagickExport void UnlockSemaphoreInfo(SemaphoreInfo *semaphore_info)
Definition: semaphore.c:450
MagickExport ssize_t ParseCommandOption(const CommandOption option, const MagickBooleanType list, const char *options)
Definition: option.c:2954
OrientationType
Definition: image.h:76
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:106
MagickExport MagickStatusType ParseAbsoluteGeometry(const char *geometry, RectangleInfo *region_info)
Definition: geometry.c:698
EndianType endian
Definition: image.h:228
MagickBooleanType taint
Definition: image.h:169
StorageType
Definition: pixel.h:140
MagickExport MagickBooleanType IdentifyImage(Image *image, FILE *file, const MagickBooleanType verbose, ExceptionInfo *exception)
Definition: identify.c:469
MagickBooleanType debug
Definition: image.h:476
MagickExport MagickBooleanType GetMagickEncoderThreadSupport(const MagickInfo *magick_info)
Definition: magick.c:534
MagickExport const DelegateInfo * GetDelegateInfo(const char *decode, const char *encode, ExceptionInfo *exception)
Definition: delegate.c:1158
MagickExport Image * ReadInlineImage(const ImageInfo *image_info, const char *content, ExceptionInfo *exception)
Definition: constitute.c:902
char * module
Definition: magick.h:64
MagickExport ExceptionInfo * AcquireExceptionInfo(void)
Definition: exception.c:103
MagickExport ssize_t GetDelegateMode(const DelegateInfo *delegate_info)
Definition: delegate.c:1440
MagickBooleanType EncodeImageHandler(const ImageInfo *, Image *, ExceptionInfo *)
Definition: magick.h:56
ResolutionType units
Definition: image.h:198
size_t delay
Definition: image.h:240
#define WriteImageTag
char magick[MagickPathExtent]
Definition: image.h:319
size_t magick_rows
Definition: image.h:324
MagickExport MagickBooleanType ImageToFile(Image *image, char *filename, ExceptionInfo *exception)
Definition: blob.c:2127
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:2289
double sigma
Definition: geometry.h:106
size_t width
Definition: geometry.h:130
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:127
MagickExport MagickBooleanType SetImageOption(ImageInfo *image_info, const char *option, const char *value)
Definition: option.c:3224
Definition: image.h:151
MagickExport Image * GetPreviousImageInList(const Image *images)
Definition: list.c:794
SemaphoreInfo * semaphore
Definition: delegate.h:45
StreamHandler stream
Definition: image.h:459
MagickExport MagickBooleanType GetMagickRawSupport(const MagickInfo *magick_info)
Definition: magick.c:903
MagickExport Image * CropImage(const Image *image, const RectangleInfo *geometry, ExceptionInfo *exception)
Definition: transform.c:533
MagickExport const struct stat * GetBlobProperties(const Image *)
Definition: blob.c:1658
double x
Definition: geometry.h:123
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:4132
MagickExport void LockSemaphoreInfo(SemaphoreInfo *semaphore_info)
Definition: semaphore.c:293
MagickExport MagickBooleanType GetMagickDecoderSeekableStream(const MagickInfo *magick_info)
Definition: magick.c:404
MagickExport Image * GetFirstImageInList(const Image *images)
Definition: list.c:545
SemaphoreInfo * semaphore
Definition: magick.h:90
MagickExport Image * BlobToImage(const ImageInfo *image_info, const void *blob, const size_t length, ExceptionInfo *exception)
Definition: blob.c:416
MagickExport void GetPathComponent(const char *path, PathType type, char *component)
Definition: utility.c:1213
MagickBooleanType
Definition: magick-type.h:156
MagickExport Image * NewImageList(void)
Definition: list.c:929
size_t scene
Definition: image.h:240
unsigned int MagickStatusType
Definition: magick-type.h:119
MagickExport MagickBooleanType WriteImage(const ImageInfo *image_info, Image *image, ExceptionInfo *exception)
Definition: constitute.c:977
MagickExport unsigned char * Base64Decode(const char *source, size_t *length)
Definition: utility.c:346
char filename[MagickPathExtent]
Definition: image.h:471
double y
Definition: geometry.h:123
MagickExport MagickBooleanType RelinquishUniqueFileResource(const char *path)
Definition: resource.c:1191
MagickExport MagickBooleanType CloseBlob(Image *)
MagickExport MagickBooleanType SetImageProperty(Image *image, const char *property, const char *value, ExceptionInfo *exception)
Definition: property.c:4024
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:1181
size_t scene
Definition: image.h:387
#define magick_unused(x)
RectangleInfo page
Definition: image.h:212
size_t magick_columns
Definition: image.h:324
size_t MagickSizeType
Definition: magick-type.h:128
#define MagickPathExtent
MagickExport MagickBooleanType IsStringTrue(const char *value)
Definition: string.c:1498
MagickExport MagickBooleanType IsBlobTemporary(const Image *image)
Definition: blob.c:2788
#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
MagickExport MagickBooleanType SetImageInfo(ImageInfo *image_info, const unsigned int frames, ExceptionInfo *exception)
Definition: image.c:2677
#define ThrowReaderException(severity, tag)
char magick_filename[MagickPathExtent]
Definition: image.h:319
MagickExport DecodeImageHandler * GetImageDecoder(const MagickInfo *magick_info)
Definition: magick.c:216
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:1058
MagickExport MagickBooleanType LogMagickEvent(const LogEventType type, const char *module, const char *function, const size_t line, const char *format,...)
Definition: log.c:1397
MagickExport MagickBooleanType IsPathAccessible(const char *path)
Definition: utility.c:1468
MagickExport MagickBooleanType SetImageBackgroundColor(Image *image, ExceptionInfo *exception)
Definition: image.c:2389
size_t signature
Definition: image.h:354
size_t columns
Definition: image.h:172
MagickExport const MagickInfo * GetMagickInfo(const char *name, ExceptionInfo *exception)
Definition: magick.c:601
MagickExport Image * AcquireImage(const ImageInfo *image_info, ExceptionInfo *exception)
Definition: image.c:154
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:130
MagickExport void ResetTimer(TimerInfo *time_info)
Definition: timer.c:349
MagickExport EncodeImageHandler * GetImageEncoder(const MagickInfo *magick_info)
Definition: magick.c:245
MagickExport Image * ReadStream(const ImageInfo *image_info, StreamHandler stream, ExceptionInfo *exception)
Definition: stream.c:1002
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:748
MagickExport Image * DestroyImageList(Image *images)
Definition: list.c:446
MagickExport MagickBooleanType GetMagickEndianSupport(const MagickInfo *magick_info)
Definition: magick.c:566
MagickExport size_t InterpretImageFilename(const ImageInfo *image_info, Image *image, const char *format, int value, char *filename, ExceptionInfo *exception)
Definition: image.c:1625
MagickExport MagickBooleanType IsBlobSeekable(const Image *image)
Definition: blob.c:2709
MagickExport Image * ReadImages(ImageInfo *image_info, const char *filename, ExceptionInfo *exception)
Definition: constitute.c:803
TimerInfo timer
Definition: image.h:300
PolicyDomain
Definition: policy.h:28
MagickExport int LocaleCompare(const char *p, const char *q)
Definition: locale.c:1408
MagickExport MagickBooleanType GetMagickDecoderThreadSupport(const MagickInfo *magick_info)
Definition: magick.c:438
DisposeType
Definition: layer.h:27
char filename[MagickPathExtent]
Definition: image.h:319
#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 MagickBooleanType GetMagickEncoderSeekableStream(const MagickInfo *magick_info)
Definition: magick.c:500
MagickExport char * InterpretImageProperties(ImageInfo *image_info, Image *image, const char *embed_text, ExceptionInfo *exception)
Definition: property.c:3294
MagickExport ImageInfo * DestroyImageInfo(ImageInfo *image_info)
Definition: image.c:1254
MagickExport MagickBooleanType IsTaintImage(const Image *image)
Definition: image.c:1929
MagickExport void ReplaceImageInList(Image **images, Image *replace)
Definition: list.c:1157
MagickExport Image * GetNextImageInList(const Image *images)
Definition: list.c:762
MagickExport char * DestroyString(char *string)
Definition: string.c:816
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:2199
MagickExport ImageInfo * CloneImageInfo(const ImageInfo *image_info)
Definition: image.c:943
MagickExport MagickStatusType ParseGeometry(const char *geometry, GeometryInfo *geometry_info)
Definition: geometry.c:848
MagickExport void AppendImageToList(Image **images, const Image *append)
Definition: list.c:77
MagickExport void SetGeometry(const Image *image, RectangleInfo *geometry)
Definition: geometry.c:1653
MagickPrivate MagickBooleanType SyncImageProfiles(Image *)
Definition: profile.c:2093
MagickExport void * RelinquishMagickMemory(void *memory)
Definition: memory.c:1027
PointInfo resolution
Definition: image.h:209
#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:1623
ResolutionType
Definition: image.h:89
#define MagickExport
OrientationType orientation
Definition: image.h:166
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:646
MagickExport size_t GetImageListLength(const Image *images)
Definition: list.c:687
void * client_data
Definition: image.h:306
MagickExport Image * DestroyImage(Image *image)
Definition: image.c:1183
MagickExport MagickStatusType ParseRegionGeometry(const Image *image, const char *geometry, RectangleInfo *region_info, ExceptionInfo *exception)
Definition: geometry.c:1614
MagickExport void DisassociateImageStream(Image *image)
Definition: image.c:1316
size_t(* StreamHandler)(const Image *, const void *, const size_t)
Definition: stream.h:31
MagickBooleanType temporary
Definition: image.h:375
MagickBooleanType debug
Definition: image.h:334
MagickExport ExceptionInfo * DestroyExceptionInfo(ExceptionInfo *exception)
Definition: exception.c:406
MagickExport MagickBooleanType WriteImages(const ImageInfo *image_info, Image *images, const char *filename, ExceptionInfo *exception)
Definition: constitute.c:1252
ExceptionType severity
Definition: exception.h:104
Image * DecodeImageHandler(const ImageInfo *, ExceptionInfo *)
Definition: magick.h:53