MagickCore  6.8.9
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-2014 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  if (GetBlobError(image) != MagickFalse)
587  "AnErrorHasOccurredReadingFromFile",read_info->filename);
588  for (next=image; next != (Image *) NULL; next=GetNextImageInList(next))
589  {
590  char
591  magick_path[MaxTextExtent],
592  *property,
593  timestamp[MaxTextExtent];
594 
595  const char
596  *option;
597 
598  const StringInfo
599  *profile;
600 
601  next->taint=MagickFalse;
602  GetPathComponent(magick_filename,MagickPath,magick_path);
603  if (*magick_path == '\0' && *next->magick == '\0')
604  (void) CopyMagickString(next->magick,magick,MaxTextExtent);
605  (void) CopyMagickString(next->magick_filename,magick_filename,
606  MaxTextExtent);
607  if (IsBlobTemporary(image) != MagickFalse)
608  (void) CopyMagickString(next->filename,filename,MaxTextExtent);
609  if (next->magick_columns == 0)
610  next->magick_columns=next->columns;
611  if (next->magick_rows == 0)
612  next->magick_rows=next->rows;
613  value=GetImageProperty(next,"tiff:Orientation");
614  if (value == (char *) NULL)
615  value=GetImageProperty(next,"exif:Orientation");
616  if (value != (char *) NULL)
617  {
619  (void) DeleteImageProperty(next,"tiff:Orientation");
620  (void) DeleteImageProperty(next,"exif:Orientation");
621  }
622  value=GetImageProperty(next,"exif:XResolution");
623  if (value != (char *) NULL)
624  {
625  geometry_info.rho=next->x_resolution;
626  geometry_info.sigma=1.0;
627  flags=ParseGeometry(value,&geometry_info);
628  if (geometry_info.sigma != 0)
629  next->x_resolution=geometry_info.rho/geometry_info.sigma;
630  (void) DeleteImageProperty(next,"exif:XResolution");
631  }
632  value=GetImageProperty(next,"exif:YResolution");
633  if (value != (char *) NULL)
634  {
635  geometry_info.rho=next->y_resolution;
636  geometry_info.sigma=1.0;
637  flags=ParseGeometry(value,&geometry_info);
638  if (geometry_info.sigma != 0)
639  next->y_resolution=geometry_info.rho/geometry_info.sigma;
640  (void) DeleteImageProperty(next,"exif:YResolution");
641  }
642  value=GetImageProperty(next,"tiff:ResolutionUnit");
643  if (value == (char *) NULL)
644  value=GetImageProperty(next,"exif:ResolutionUnit");
645  if (value != (char *) NULL)
646  {
647  next->units=(ResolutionType) (StringToLong(value)-1);
648  (void) DeleteImageProperty(next,"exif:ResolutionUnit");
649  (void) DeleteImageProperty(next,"tiff:ResolutionUnit");
650  }
651  if (next->page.width == 0)
652  next->page.width=next->columns;
653  if (next->page.height == 0)
654  next->page.height=next->rows;
655  option=GetImageOption(read_info,"caption");
656  if (option != (const char *) NULL)
657  {
658  property=InterpretImageProperties(read_info,next,option);
659  (void) SetImageProperty(next,"caption",property);
660  property=DestroyString(property);
661  }
662  option=GetImageOption(read_info,"comment");
663  if (option != (const char *) NULL)
664  {
665  property=InterpretImageProperties(read_info,next,option);
666  (void) SetImageProperty(next,"comment",property);
667  property=DestroyString(property);
668  }
669  option=GetImageOption(read_info,"label");
670  if (option != (const char *) NULL)
671  {
672  property=InterpretImageProperties(read_info,next,option);
673  (void) SetImageProperty(next,"label",property);
674  property=DestroyString(property);
675  }
676  if (LocaleCompare(next->magick,"TEXT") == 0)
677  (void) ParseAbsoluteGeometry("0x0+0+0",&next->page);
678  if ((read_info->extract != (char *) NULL) &&
679  (read_info->stream == (StreamHandler) NULL))
680  {
682  geometry;
683 
684  flags=ParseAbsoluteGeometry(read_info->extract,&geometry);
685  if ((next->columns != geometry.width) ||
686  (next->rows != geometry.height))
687  {
688  if (((flags & XValue) != 0) || ((flags & YValue) != 0))
689  {
690  Image
691  *crop_image;
692 
693  crop_image=CropImage(next,&geometry,exception);
694  if (crop_image != (Image *) NULL)
695  ReplaceImageInList(&next,crop_image);
696  }
697  else
698  if (((flags & WidthValue) != 0) || ((flags & HeightValue) != 0))
699  {
700  Image
701  *size_image;
702 
703  flags=ParseRegionGeometry(next,read_info->extract,&geometry,
704  exception);
705  size_image=ResizeImage(next,geometry.width,geometry.height,
706  next->filter,next->blur,exception);
707  if (size_image != (Image *) NULL)
708  ReplaceImageInList(&next,size_image);
709  }
710  }
711  }
712  profile=GetImageProfile(next,"icc");
713  if (profile == (const StringInfo *) NULL)
714  profile=GetImageProfile(next,"icm");
715  if (profile != (const StringInfo *) NULL)
716  {
718  next->color_profile.info=GetStringInfoDatum(profile);
719  }
720  profile=GetImageProfile(next,"iptc");
721  if (profile == (const StringInfo *) NULL)
722  profile=GetImageProfile(next,"8bim");
723  if (profile != (const StringInfo *) NULL)
724  {
725  next->iptc_profile.length=GetStringInfoLength(profile);
726  next->iptc_profile.info=GetStringInfoDatum(profile);
727  }
728  (void) FormatMagickTime(GetBlobProperties(next)->st_mtime,MaxTextExtent,
729  timestamp);
730  (void) SetImageProperty(next,"date:modify",timestamp);
731  (void) FormatMagickTime(GetBlobProperties(next)->st_ctime,MaxTextExtent,
732  timestamp);
733  (void) SetImageProperty(next,"date:create",timestamp);
734  option=GetImageOption(image_info,"delay");
735  if (option != (const char *) NULL)
736  {
738  geometry_info;
739 
740  flags=ParseGeometry(option,&geometry_info);
741  if ((flags & GreaterValue) != 0)
742  {
743  if (next->delay > (size_t) floor(geometry_info.rho+0.5))
744  next->delay=(size_t) floor(geometry_info.rho+0.5);
745  }
746  else
747  if ((flags & LessValue) != 0)
748  {
749  if (next->delay < (size_t) floor(geometry_info.rho+0.5))
750  next->ticks_per_second=(ssize_t) floor(geometry_info.sigma+0.5);
751  }
752  else
753  next->delay=(size_t) floor(geometry_info.rho+0.5);
754  if ((flags & SigmaValue) != 0)
755  next->ticks_per_second=(ssize_t) floor(geometry_info.sigma+0.5);
756  }
757  option=GetImageOption(image_info,"dispose");
758  if (option != (const char *) NULL)
760  MagickFalse,option);
761  if (read_info->verbose != MagickFalse)
762  (void) IdentifyImage(next,stderr,MagickFalse);
763  image=next;
764  }
765  read_info=DestroyImageInfo(read_info);
766  return(GetFirstImageInList(image));
767 }
768 
769 /*
770 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
771 % %
772 % %
773 % %
774 % R e a d I m a g e s %
775 % %
776 % %
777 % %
778 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
779 %
780 % ReadImages() reads one or more images and returns them as an image list.
781 %
782 % The format of the ReadImage method is:
783 %
784 % Image *ReadImages(const ImageInfo *image_info,ExceptionInfo *exception)
785 %
786 % A description of each parameter follows:
787 %
788 % o image_info: the image info.
789 %
790 % o exception: return any errors or warnings in this structure.
791 %
792 */
794  ExceptionInfo *exception)
795 {
796  char
797  filename[MaxTextExtent];
798 
799  Image
800  *image,
801  *images;
802 
803  ImageInfo
804  *read_info;
805 
806  /*
807  Read image list from a file.
808  */
809  assert(image_info != (ImageInfo *) NULL);
810  assert(image_info->signature == MagickSignature);
811  if (image_info->debug != MagickFalse)
813  image_info->filename);
814  assert(exception != (ExceptionInfo *) NULL);
815  (void) InterpretImageFilename(image_info,(Image *) NULL,image_info->filename,
816  (int) image_info->scene,filename);
817  if (LocaleCompare(filename,image_info->filename) != 0)
818  {
820  *sans;
821 
822  ssize_t
823  extent,
824  scene;
825 
826  /*
827  Images of the form image-%d.png[1-5].
828  */
829  read_info=CloneImageInfo(image_info);
830  sans=AcquireExceptionInfo();
831  (void) SetImageInfo(read_info,0,sans);
832  sans=DestroyExceptionInfo(sans);
833  if (read_info->number_scenes == 0)
834  {
835  read_info=DestroyImageInfo(read_info);
836  return(ReadImage(image_info,exception));
837  }
838  (void) CopyMagickString(filename,read_info->filename,MaxTextExtent);
839  images=NewImageList();
840  extent=(ssize_t) (read_info->scene+read_info->number_scenes);
841  for (scene=(ssize_t) read_info->scene; scene < (ssize_t) extent; scene++)
842  {
843  (void) InterpretImageFilename(image_info,(Image *) NULL,filename,(int)
844  scene,read_info->filename);
845  image=ReadImage(read_info,exception);
846  if (image == (Image *) NULL)
847  continue;
848  AppendImageToList(&images,image);
849  }
850  read_info=DestroyImageInfo(read_info);
851  return(images);
852  }
853  return(ReadImage(image_info,exception));
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  if (*write_info->magick == '\0')
1005  (void) CopyMagickString(write_info->magick,image->magick,MaxTextExtent);
1006  (void) SetImageInfo(write_info,1,sans_exception);
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 (GetBlobError(image) != MagickFalse)
1192  "AnErrorHasOccurredWritingToFile",image->filename);
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,
1207  MaxTextExtent);
1208  }
1209  if ((LocaleCompare(write_info->magick,"info") != 0) &&
1210  (write_info->verbose != MagickFalse))
1211  (void) IdentifyImage(image,stderr,MagickFalse);
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  i;
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 == MagickSignature);
1283  assert(images != (Image *) NULL);
1284  assert(images->signature == MagickSignature);
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  images=GetFirstImageInList(images);
1290  if (filename != (const char *) NULL)
1291  for (p=images; p != (Image *) NULL; p=GetNextImageInList(p))
1292  (void) CopyMagickString(p->filename,filename,MaxTextExtent);
1293  (void) CopyMagickString(write_info->filename,images->filename,MaxTextExtent);
1294  if (*write_info->magick == '\0')
1295  (void) CopyMagickString(write_info->magick,images->magick,MaxTextExtent);
1296  sans_exception=AcquireExceptionInfo();
1297  (void) SetImageInfo(write_info,(unsigned int) GetImageListLength(images),
1298  sans_exception);
1299  sans_exception=DestroyExceptionInfo(sans_exception);
1300  p=images;
1301  for ( ; GetNextImageInList(p) != (Image *) NULL; p=GetNextImageInList(p))
1302  if (p->scene >= GetNextImageInList(p)->scene)
1303  {
1304  register ssize_t
1305  i;
1306 
1307  /*
1308  Generate consistent scene numbers.
1309  */
1310  i=(ssize_t) images->scene;
1311  for (p=images; p != (Image *) NULL; p=GetNextImageInList(p))
1312  p->scene=(size_t) i++;
1313  break;
1314  }
1315  /*
1316  Write images.
1317  */
1318  status=MagickTrue;
1319  progress_monitor=(MagickProgressMonitor) NULL;
1320  i=0;
1321  number_images=GetImageListLength(images);
1322  for (p=images; p != (Image *) NULL; p=GetNextImageInList(p))
1323  {
1324  if (number_images != 1)
1325  progress_monitor=SetImageProgressMonitor(p,(MagickProgressMonitor) NULL,
1326  p->client_data);
1327  status&=WriteImage(write_info,p);
1328  GetImageException(p,exception);
1329  if (number_images != 1)
1330  (void) SetImageProgressMonitor(p,progress_monitor,p->client_data);
1331  if (write_info->adjoin != MagickFalse)
1332  break;
1333  if (number_images != 1)
1334  {
1335  proceed=SetImageProgress(p,WriteImageTag,i++,number_images);
1336  if (proceed == MagickFalse)
1337  break;
1338  }
1339  }
1340  write_info=DestroyImageInfo(write_info);
1341  return(status != 0 ? MagickTrue : MagickFalse);
1342 }
size_t rows
Definition: image.h:172
MagickExport MagickBooleanType IdentifyImage(Image *image, FILE *file, const MagickBooleanType verbose)
Definition: identify.c:483
double y_resolution
Definition: image.h:207
MagickExport Image * CloneImages(const Image *images, const char *scenes, ExceptionInfo *exception)
Definition: list.c:199
char filename[MaxTextExtent]
Definition: image.h:465
EndianType endian
Definition: image.h:385
size_t signature
Definition: image.h:484
static MagickBooleanType SetImageProgress(const Image *image, const char *tag, const MagickOffsetType offset, const MagickSizeType extent)
DisposeType dispose
Definition: image.h:236
MagickExport MagickBooleanType GetDelegateThreadSupport(const DelegateInfo *delegate_info)
Definition: delegate.c:736
char * scenes
Definition: image.h:371
MagickExport MagickBooleanType IsRightsAuthorized(const PolicyDomain domain, const PolicyRights rights, const char *pattern)
Definition: policy.c:559
ssize_t ticks_per_second
Definition: image.h:246
MagickExport void UnlockSemaphoreInfo(SemaphoreInfo *semaphore_info)
Definition: semaphore.c:449
ProfileInfo iptc_profile
Definition: image.h:297
MagickExport ssize_t ParseCommandOption(const CommandOption option, const MagickBooleanType list, const char *options)
Definition: option.c:2495
OrientationType
Definition: image.h:75
MagickExport MagickBooleanType GetBlobError(const Image *image)
Definition: blob.c:1274
char * extract
Definition: image.h:371
PolicyRights
Definition: policy.h:39
char * value
Definition: configure.h:30
size_t(* StreamHandler)(const Image *, const void *, const size_t)
Definition: stream.h:26
size_t signature
Definition: exception.h:124
size_t number_scenes
Definition: image.h:377
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:662
EndianType endian
Definition: image.h:227
MagickBooleanType taint
Definition: image.h:168
MagickBooleanType debug
Definition: image.h:471
MagickExport const DelegateInfo * GetDelegateInfo(const char *decode, const char *encode, ExceptionInfo *exception)
Definition: delegate.c:428
char magick[MaxTextExtent]
Definition: image.h:276
MagickExport Image * ReadInlineImage(const ImageInfo *image_info, const char *content, ExceptionInfo *exception)
Definition: constitute.c:886
MagickExport MagickBooleanType SetImageBackgroundColor(Image *image)
Definition: image.c:2130
MagickExport ExceptionInfo * AcquireExceptionInfo(void)
Definition: exception.c:101
MagickExport ssize_t GetDelegateMode(const DelegateInfo *delegate_info)
Definition: delegate.c:704
ResolutionType units
Definition: image.h:196
size_t delay
Definition: image.h:242
#define WriteImageTag
size_t magick_rows
Definition: image.h:281
MagickExport MagickBooleanType ImageToFile(Image *image, char *filename, ExceptionInfo *exception)
Definition: blob.c:1685
MagickBooleanType verbose
Definition: image.h:429
double blur
Definition: image.h:216
unsigned char * info
Definition: profile.h:36
MagickExport MagickStatusType GetMagickThreadSupport(const MagickInfo *magick_info)
Definition: magick.c:777
char magick_filename[MaxTextExtent]
Definition: image.h:276
double sigma
Definition: geometry.h:107
size_t width
Definition: geometry.h:124
MagickExport MagickBooleanType AcquireUniqueFilename(char *path)
Definition: utility.c:108
#define ThrowBinaryException(severity, tag, context)
Definition: log.h:38
ssize_t MagickOffsetType
Definition: magick-type.h:155
Definition: image.h:150
MagickExport Image * GetPreviousImageInList(const Image *images)
Definition: list.c:786
SemaphoreInfo * semaphore
Definition: delegate.h:52
StreamHandler stream
Definition: image.h:453
MagickExport MagickBooleanType GetMagickRawSupport(const MagickInfo *magick_info)
Definition: magick.c:714
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:1370
MagickExport void LockSemaphoreInfo(SemaphoreInfo *semaphore_info)
Definition: semaphore.c:344
MagickExport unsigned char * GetStringInfoDatum(const StringInfo *string_info)
Definition: string.c:1265
MagickExport Image * GetFirstImageInList(const Image *images)
Definition: list.c:542
#define MagickSignature
char magick[MaxTextExtent]
Definition: image.h:465
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:322
MagickExport void GetPathComponent(const char *path, PathType type, char *component)
Definition: utility.c:1199
MagickBooleanType
Definition: magick-type.h:211
char filename[MaxTextExtent]
Definition: image.h:276
MagickExport Image * NewImageList(void)
Definition: list.c:918
size_t scene
Definition: image.h:242
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:2053
static long StringToLong(const char *restrict value)
ProfileInfo color_profile
Definition: image.h:297
MagickExport unsigned char * Base64Decode(const char *source, size_t *length)
Definition: utility.c:337
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:889
#define MaxTextExtent
MagickExport MagickBooleanType CloseBlob(Image *)
MagickExport const StringInfo * GetImageProfile(const Image *image, const char *name)
Definition: profile.c:265
MagickExport ssize_t FormatMagickTime(const time_t time, const size_t length, char *timestamp)
Definition: string.c:1158
size_t scene
Definition: image.h:377
MagickExport MagickBooleanType WriteImage(const ImageInfo *image_info, Image *image)
Definition: constitute.c:955
#define magick_unused(x)
RectangleInfo page
Definition: image.h:211
size_t magick_columns
Definition: image.h:281
size_t MagickSizeType
Definition: magick-type.h:156
MagickExport int LocaleCompare(const char *p, const char *q)
Definition: string.c:1533
MagickExport MagickBooleanType IsBlobTemporary(const Image *image)
Definition: blob.c:2174
#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:1380
MagickExport const char * GetImageOption(const ImageInfo *image_info, const char *key)
Definition: option.c:1866
MagickExport MagickBooleanType SetImageInfo(ImageInfo *image_info, const unsigned int frames, ExceptionInfo *exception)
Definition: image.c:2487
#define ThrowReaderException(severity, tag)
MagickExport DecodeImageHandler * GetImageDecoder(const MagickInfo *magick_info)
Definition: magick.c:148
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:1046
MagickExport MagickBooleanType IsPathAccessible(const char *path)
Definition: utility.c:1435
size_t signature
Definition: image.h:305
size_t columns
Definition: image.h:172
MagickExport size_t InterpretImageFilename(const ImageInfo *image_info, Image *image, const char *format, int value, char *filename)
Definition: image.c:1508
MagickExport const MagickInfo * GetMagickInfo(const char *name, ExceptionInfo *exception)
Definition: magick.c:402
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:2941
MagickExport MagickBooleanType OpenBlob(const ImageInfo *, Image *, const BlobMode, ExceptionInfo *)
size_t height
Definition: geometry.h:124
MagickExport void ResetTimer(TimerInfo *time_info)
Definition: timer.c:334
MagickExport Image * ReadImages(const ImageInfo *image_info, ExceptionInfo *exception)
Definition: constitute.c:793
MagickExport EncodeImageHandler * GetImageEncoder(const MagickInfo *magick_info)
Definition: magick.c:178
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:745
MagickExport Image * DestroyImageList(Image *images)
Definition: list.c:443
MagickExport MagickBooleanType GetMagickEndianSupport(const MagickInfo *magick_info)
Definition: magick.c:367
MagickExport MagickBooleanType IsBlobSeekable(const Image *image)
Definition: blob.c:2125
MagickExport char * InterpretImageProperties(const ImageInfo *image_info, Image *image, const char *embed_text)
Definition: property.c:3250
TimerInfo timer
Definition: image.h:259
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:365
#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:1097
MagickExport MagickBooleanType IsTaintImage(const Image *image)
Definition: image.c:1827
MagickExport MagickBooleanType SetImageProperty(Image *image, const char *property, const char *value)
Definition: property.c:3676
MagickExport MagickBooleanType SyncImageProfiles(Image *image)
Definition: profile.c:2170
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:815
double x_resolution
Definition: image.h:207
MagickExport MagickBooleanType DeleteImageProperty(Image *image, const char *property)
Definition: property.c:270
MagickExport ImageInfo * CloneImageInfo(const ImageInfo *image_info)
Definition: image.c:928
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:3937
MagickExport MagickStatusType ParseGeometry(const char *geometry, GeometryInfo *geometry_info)
Definition: geometry.c:812
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:951
MagickExport void GetImageException(Image *image, ExceptionInfo *exception)
Definition: image.c:1232
#define magick_unreferenced(x)
MagickExport MagickProgressMonitor SetImageInfoProgressMonitor(ImageInfo *image_info, const MagickProgressMonitor progress_monitor, void *client_data)
Definition: monitor.c:134
MagickBooleanType(* MagickProgressMonitor)(const char *, const MagickOffsetType, const MagickSizeType, void *)
Definition: monitor.h:26
MagickExport MagickBooleanType InvokeDelegate(ImageInfo *image_info, Image *image, const char *decode, const char *encode, ExceptionInfo *exception)
Definition: delegate.c:913
ResolutionType
Definition: image.h:88
#define MagickExport
OrientationType orientation
Definition: image.h:165
MagickExport MagickBooleanType GetMagickSeekableStream(const MagickInfo *magick_info)
Definition: magick.c:746
struct _ConfigureInfo * next
Definition: configure.h:38
struct _Image * clip_mask
Definition: image.h:238
MagickBooleanType adjoin
Definition: image.h:365
char * page
Definition: image.h:371
MagickBooleanType ping
Definition: image.h:429
MagickExport MagickBooleanType IsSceneGeometry(const char *geometry, const MagickBooleanType pedantic)
Definition: geometry.c:610
MagickExport size_t GetStringInfoLength(const StringInfo *string_info)
Definition: string.c:1294
MagickExport size_t GetImageListLength(const Image *images)
Definition: list.c:682
void * client_data
Definition: image.h:265
MagickExport Image * DestroyImage(Image *image)
Definition: image.c:1024
MagickExport MagickStatusType ParseRegionGeometry(const Image *image, const char *geometry, RectangleInfo *region_info, ExceptionInfo *exception)
Definition: geometry.c:1499
MagickExport void DisassociateImageStream(Image *image)
Definition: image.c:1164
MagickBooleanType temporary
Definition: image.h:365
MagickBooleanType debug
Definition: image.h:288
MagickExport ExceptionInfo * DestroyExceptionInfo(ExceptionInfo *exception)
Definition: exception.c:431
ExceptionInfo exception
Definition: image.h:285
MagickExport MagickBooleanType WriteImages(const ImageInfo *image_info, Image *images, const char *filename, ExceptionInfo *exception)
Definition: constitute.c:1252
MagickExport void InheritException(ExceptionInfo *exception, const ExceptionInfo *relative)
Definition: exception.c:623
FilterTypes filter
Definition: image.h:221
ExceptionType severity
Definition: exception.h:105
Image * DecodeImageHandler(const ImageInfo *, ExceptionInfo *)
Definition: magick.h:43