MagickCore  7.0.10
list.c
Go to the documentation of this file.
1 /*
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 % %
4 % %
5 % %
6 % L IIIII SSSSS TTTTT %
7 % L I SS T %
8 % L I SSS T %
9 % L I SS T %
10 % LLLLL IIIII SSSSS T %
11 % %
12 % %
13 % MagickCore Image List Methods %
14 % %
15 % Software Design %
16 % Cristy %
17 % December 2002 %
18 % %
19 % %
20 % Copyright 1999-2020 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://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 /*
41  Include declarations.
42 */
43 #include "MagickCore/studio.h"
44 #include "MagickCore/artifact.h"
45 #include "MagickCore/blob.h"
47 #include "MagickCore/exception.h"
50 #include "MagickCore/list.h"
51 #include "MagickCore/memory_.h"
52 #include "MagickCore/string_.h"
54 
55 /*
56 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
57 % %
58 % %
59 % %
60 % A p p e n d I m a g e T o L i s t %
61 % %
62 % %
63 % %
64 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
65 %
66 % AppendImageToList() appends the second image list to the end of the first
67 % list. The given image list pointer is left unchanged, unless it was empty.
68 %
69 % The format of the AppendImageToList method is:
70 %
71 % AppendImageToList(Image *images,const Image *image)
72 %
73 % A description of each parameter follows:
74 %
75 % o images: the image list to be appended to.
76 %
77 % o image: the appended image or image list.
78 %
79 */
80 MagickExport void AppendImageToList(Image **images,const Image *append)
81 {
82  register Image
83  *p,
84  *q;
85 
86  assert(images != (Image **) NULL);
87  if (append == (Image *) NULL)
88  return;
89  assert(append->signature == MagickCoreSignature);
90  if (append->debug != MagickFalse)
91  (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",append->filename);
92  if ((*images) == (Image *) NULL)
93  {
94  *images=(Image *) append;
95  return;
96  }
97  assert((*images)->signature == MagickCoreSignature);
98  p=GetLastImageInList(*images);
99  q=GetFirstImageInList(append);
100  p->next=q;
101  q->previous=p;
102 }
103 
104 /*
105 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
106 % %
107 % %
108 % %
109 % C l o n e I m a g e L i s t %
110 % %
111 % %
112 % %
113 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
114 %
115 % CloneImageList() returns a duplicate of the image list.
116 %
117 % The format of the CloneImageList method is:
118 %
119 % Image *CloneImageList(const Image *images,ExceptionInfo *exception)
120 %
121 % A description of each parameter follows:
122 %
123 % o images: the image list.
124 %
125 % o exception: return any errors or warnings in this structure.
126 %
127 */
129 {
130  Image
131  *clone,
132  *image;
133 
134  register Image
135  *p;
136 
137  if (images == (Image *) NULL)
138  return((Image *) NULL);
139  assert(images->signature == MagickCoreSignature);
140  while (images->previous != (Image *) NULL)
141  {
142  assert(images != images->previous);
143  images=images->previous;
144  }
145  image=(Image *) NULL;
146  for (p=(Image *) NULL; images != (Image *) NULL; images=images->next)
147  {
148  assert(images != images->next);
149  clone=CloneImage(images,0,0,MagickTrue,exception);
150  if (clone == (Image *) NULL)
151  {
152  if (image != (Image *) NULL)
153  image=DestroyImageList(image);
154  return((Image *) NULL);
155  }
156  if (image == (Image *) NULL)
157  {
158  image=clone;
159  p=image;
160  continue;
161  }
162  p->next=clone;
163  clone->previous=p;
164  p=p->next;
165  }
166  return(image);
167 }
168 
169 /*
170 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
171 % %
172 % %
173 % %
174 % C l o n e I m a g e s %
175 % %
176 % %
177 % %
178 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
179 %
180 % CloneImages() clones one or more images from an image sequence, using a
181 % comma separated list of image numbers or ranges.
182 %
183 % The numbers start at 0 for the first image in the list, while negative
184 % numbers refer to images starting counting from the end of the range. Images
185 % may be referred to multiple times to clone them multiple times. Images
186 % referred beyond the available number of images in list are ignored.
187 %
188 % Images referenced may be reversed, and results in a clone of those images
189 % also being made with a reversed order.
190 %
191 % The format of the CloneImages method is:
192 %
193 % Image *CloneImages(const Image *images,const char *scenes,
194 % ExceptionInfo *exception)
195 %
196 % A description of each parameter follows:
197 %
198 % o images: the image sequence.
199 %
200 % o scenes: This character string specifies which scenes to clone
201 % (e.g. 1,3-5,7-3,2).
202 %
203 % o exception: return any errors or warnings in this structure.
204 %
205 */
206 MagickExport Image *CloneImages(const Image *images,const char *scenes,
207  ExceptionInfo *exception)
208 {
209  char
210  *p;
211 
212  const char
213  *artifact;
214 
215  const Image
216  *next;
217 
218  Image
219  *clone_images,
220  *image;
221 
222  register ssize_t
223  i;
224 
225  size_t
226  length;
227 
228  ssize_t
229  first,
230  last,
231  step;
232 
233  assert(images != (const Image *) NULL);
234  assert(images->signature == MagickCoreSignature);
235  assert(scenes != (char *) NULL);
236  if (images->debug != MagickFalse)
237  (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",images->filename);
238  assert(exception != (ExceptionInfo *) NULL);
239  assert(exception->signature == MagickCoreSignature);
240  clone_images=NewImageList();
241  images=GetFirstImageInList(images);
242  artifact=GetImageArtifact(images,"frames:step");
243  length=GetImageListLength(images);
244  for (p=(char *) scenes; *p != '\0';)
245  {
247  match;
248 
249  while ((isspace((int) ((unsigned char) *p)) != 0) || (*p == ','))
250  p++;
251  first=(ssize_t) strtol(p,&p,10);
252  if (first < 0)
253  first+=(ssize_t) length;
254  else
255  if (first > (ssize_t) length)
256  first=(ssize_t) length;
257  last=first;
258  while (isspace((int) ((unsigned char) *p)) != 0)
259  p++;
260  if (*p == '-')
261  {
262  last=(ssize_t) strtol(p+1,&p,10);
263  if (last < 0)
264  last+=(ssize_t) length;
265  else
266  if (last > (ssize_t) length)
267  last=(ssize_t) length;
268  }
269  match=MagickFalse;
270  step=1;
271  if (artifact != (const char *) NULL)
272  {
273  step=(ssize_t) StringToDouble(artifact,(char **) NULL);
274  if (step == 0)
275  step=1;
276  }
277  step=(ssize_t) (first > last ? -step : step);
278  for ( ; (first > -(last+step)) && (first < (last+step)); first+=step)
279  {
280  i=0;
281  for (next=images; next != (Image *) NULL; next=GetNextImageInList(next))
282  {
283  if (i == (ssize_t) first)
284  {
285  image=CloneImage(next,0,0,MagickTrue,exception);
286  if (image == (Image *) NULL)
287  break;
288  AppendImageToList(&clone_images,image);
289  match=MagickTrue;
290  }
291  i++;
292  }
293  if (match == MagickFalse)
295  "InvalidImageIndex","`%s'",images->filename);
296  }
297  }
298  return(GetFirstImageInList(clone_images));
299 }
300 
301 /*
302 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
303 % %
304 % %
305 % %
306 % D e l e t e I m a g e F r o m L i s t %
307 % %
308 % %
309 % %
310 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
311 %
312 % DeleteImageFromList() deletes an image from the list. List pointer
313 % is moved to the next image, if one is present. See RemoveImageFromList().
314 %
315 % The format of the DeleteImageFromList method is:
316 %
317 % DeleteImageFromList(Image **images)
318 %
319 % A description of each parameter follows:
320 %
321 % o images: the image list.
322 %
323 */
325 {
326  Image
327  *image;
328 
329  image=RemoveImageFromList(images);
330  if (image != (Image *) NULL)
331  (void) DestroyImage(image);
332 }
333 
334 /*
335 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
336 % %
337 % %
338 % %
339 % D e l e t e I m a g e s %
340 % %
341 % %
342 % %
343 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
344 %
345 % DeleteImages() deletes one or more images from an image sequence, using a
346 % comma separated list of image numbers or ranges.
347 %
348 % The numbers start at 0 for the first image, while negative numbers refer to
349 % images starting counting from the end of the range. Images may be referred to
350 % multiple times without problems. Image referred beyond the available number
351 % of images in list are ignored.
352 %
353 % If the referenced images are in the reverse order, that range will be
354 % completely ignored, unlike CloneImages().
355 %
356 % The format of the DeleteImages method is:
357 %
358 % DeleteImages(Image **images,const char *scenes,ExceptionInfo *exception)
359 %
360 % A description of each parameter follows:
361 %
362 % o images: the image sequence.
363 %
364 % o scenes: This character string specifies which scenes to delete
365 % (e.g. 1,3-5,-2-6,2).
366 %
367 % o exception: return any errors or warnings in this structure.
368 %
369 */
370 MagickExport void DeleteImages(Image **images,const char *scenes,
371  ExceptionInfo *exception)
372 {
373  char
374  *p;
375 
376  Image
377  *image;
378 
379  long
380  first,
381  last;
382 
384  *delete_list;
385 
386  register ssize_t
387  i;
388 
389  size_t
390  length;
391 
392  assert(images != (Image **) NULL);
393  assert((*images)->signature == MagickCoreSignature);
394  assert(scenes != (char *) NULL);
395  if ((*images)->debug != MagickFalse)
397  (*images)->filename);
398  assert(exception != (ExceptionInfo *) NULL);
399  assert(exception->signature == MagickCoreSignature);
400  *images=GetFirstImageInList(*images);
401  length=GetImageListLength(*images);
402  delete_list=(MagickBooleanType *) AcquireQuantumMemory(length,
403  sizeof(*delete_list));
404  if (delete_list == (MagickBooleanType *) NULL)
405  {
406  (void) ThrowMagickException(exception,GetMagickModule(),
407  ResourceLimitError,"MemoryAllocationFailed","`%s'",(*images)->filename);
408  return;
409  }
410  image=(*images);
411  for (i=0; i < (ssize_t) length; i++)
412  delete_list[i]=MagickFalse;
413  /*
414  Note which images will be deleted, avoid duplicates.
415  */
416  for (p=(char *) scenes; *p != '\0';)
417  {
418  while ((isspace((int) ((unsigned char) *p)) != 0) || (*p == ','))
419  p++;
420  first=strtol(p,&p,10);
421  if (first < 0)
422  first+=(long) length;
423  last=first;
424  while (isspace((int) ((unsigned char) *p)) != 0)
425  p++;
426  if (*p == '-')
427  {
428  last=strtol(p+1,&p,10);
429  if (last < 0)
430  last+=(long) length;
431  }
432  if (first > last)
433  continue;
434  for (i=(ssize_t) first; i <= (ssize_t) last; i++)
435  if ((i >= 0) && (i < (ssize_t) length))
436  delete_list[i]=MagickTrue;
437  }
438  /*
439  Delete images marked for deletion, once only.
440  */
441  image=(*images);
442  for (i=0; i < (ssize_t) length; i++)
443  {
444  *images=image;
445  image=GetNextImageInList(image);
446  if (delete_list[i] != MagickFalse)
447  DeleteImageFromList(images);
448  }
449  (void) RelinquishMagickMemory(delete_list);
450  *images=GetFirstImageInList(*images);
451 }
452 
453 /*
454 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
455 % %
456 % %
457 % %
458 % D e s t r o y I m a g e L i s t %
459 % %
460 % %
461 % %
462 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
463 %
464 % DestroyImageList() destroys an image list.
465 %
466 % The format of the DestroyImageList method is:
467 %
468 % Image *DestroyImageList(Image *image)
469 %
470 % A description of each parameter follows:
471 %
472 % o image: the image sequence.
473 %
474 */
476 {
477  if (images == (Image *) NULL)
478  return((Image *) NULL);
479  assert(images->signature == MagickCoreSignature);
480  if (images->debug != MagickFalse)
481  (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",images->filename);
482  while (images != (Image *) NULL)
483  DeleteImageFromList(&images);
484  return((Image *) NULL);
485 }
486 
487 /*
488 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
489 % %
490 % %
491 % %
492 % D u p l i c a t e I m a g e s %
493 % %
494 % %
495 % %
496 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
497 %
498 % DuplicateImages() duplicates one or more images from an image sequence,
499 % using a count and a comma separated list of image numbers or ranges.
500 %
501 % The numbers start at 0 for the first image, while negative numbers refer to
502 % images starting counting from the end of the range. Images may be referred to
503 % multiple times without problems. Image referred beyond the available number
504 % of images in list are ignored.
505 %
506 % The format of the DuplicateImages method is:
507 %
508 % Image *DuplicateImages(Image *images,const size_t number_duplicates,
509 % const char *scenes,ExceptionInfo *exception)
510 %
511 % A description of each parameter follows:
512 %
513 % o images: the image sequence.
514 %
515 % o number_duplicates: duplicate the image sequence this number of times.
516 %
517 % o scenes: This character string specifies which scenes to duplicate (e.g.
518 % 1,3-5,-2-6,2).
519 %
520 % o exception: return any errors or warnings in this structure.
521 %
522 */
524  const size_t number_duplicates,const char *scenes,ExceptionInfo *exception)
525 {
526  Image
527  *clone_images,
528  *duplicate_images;
529 
530  register ssize_t
531  i;
532 
533  /*
534  Duplicate images.
535  */
536  assert(images != (Image *) NULL);
537  assert(images->signature == MagickCoreSignature);
538  assert(scenes != (char *) NULL);
539  if (images->debug != MagickFalse)
540  (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",images->filename);
541  assert(exception != (ExceptionInfo *) NULL);
542  assert(exception->signature == MagickCoreSignature);
543  duplicate_images=NewImageList();
544  for (i=0; i < (ssize_t) number_duplicates; i++)
545  {
546  clone_images=CloneImages(images,scenes,exception);
547  AppendImageToList(&duplicate_images,clone_images);
548  }
549  return(duplicate_images);
550 }
551 
552 /*
553 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
554 % %
555 % %
556 % %
557 % G e t F i r s t I m a g e I n L i s t %
558 % %
559 % %
560 % %
561 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
562 %
563 % GetFirstImageInList() returns a pointer to the first image in the list.
564 %
565 % The format of the GetFirstImageInList method is:
566 %
567 % Image *GetFirstImageInList(const Image *images)
568 %
569 % A description of each parameter follows:
570 %
571 % o images: the image list.
572 %
573 */
575 {
576  register const Image
577  *p;
578 
579  if (images == (Image *) NULL)
580  return((Image *) NULL);
581  assert(images->signature == MagickCoreSignature);
582  for (p=images; p->previous != (Image *) NULL; p=p->previous) ;
583  return((Image *) p);
584 }
585 
586 /*
587 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
588 % %
589 % %
590 % %
591 % G e t I m a g e F r o m L i s t %
592 % %
593 % %
594 % %
595 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
596 %
597 % GetImageFromList() returns an image at the specified index from the image
598 % list. Starting with 0 as the first image in the list.
599 %
600 % A negative offset will return the image from the end of the list, such that
601 % an index of -1 is the last image.
602 %
603 % If no such image exists at the specified offset a NULL image pointer is
604 % returned. This will only happen if index is less that the negative of
605 % the list length, or larger than list length -1. EG: ( -N to N-1 )
606 %
607 % The format of the GetImageFromList method is:
608 %
609 % Image *GetImageFromList(const Image *images,const ssize_t index)
610 %
611 % A description of each parameter follows:
612 %
613 % o images: the image list.
614 %
615 % o index: the position within the list.
616 %
617 */
618 MagickExport Image *GetImageFromList(const Image *images,const ssize_t index)
619 {
620  register const Image
621  *p;
622 
623  register ssize_t
624  i;
625 
626  if (images == (Image *) NULL)
627  return((Image *) NULL);
628  assert(images->signature == MagickCoreSignature);
629  if (images->debug != MagickFalse)
630  (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",images->filename);
631  if (index < 0)
632  {
633  p=GetLastImageInList(images);
634  for (i=(-1); p != (Image *) NULL; p=p->previous)
635  if (i-- == index)
636  break;
637  }
638  else
639  {
640  p=GetFirstImageInList(images);
641  for (i=0; p != (Image *) NULL; p=p->next)
642  if (i++ == index)
643  break;
644  }
645  return((Image *) p);
646 }
647 
648 /*
649 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
650 % %
651 % %
652 % %
653 % G e t I m a g e I n d e x I n L i s t %
654 % %
655 % %
656 % %
657 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
658 %
659 % GetImageIndexInList() returns the offset in the list of the specified image.
660 %
661 % The format of the GetImageIndexInList method is:
662 %
663 % ssize_t GetImageIndexInList(const Image *images)
664 %
665 % A description of each parameter follows:
666 %
667 % o images: the image list.
668 %
669 */
670 MagickExport ssize_t GetImageIndexInList(const Image *images)
671 {
672  register ssize_t
673  i;
674 
675  if (images == (const Image *) NULL)
676  return(-1);
677  assert(images->signature == MagickCoreSignature);
678  for (i=0; images->previous != (Image *) NULL; i++)
679  {
680  assert(images != images->previous);
681  images=images->previous;
682  }
683  return(i);
684 }
685 
686 /*
687 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
688 % %
689 % %
690 % %
691 % G e t I m a g e L i s t L e n g t h %
692 % %
693 % %
694 % %
695 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
696 %
697 % GetImageListLength() returns the length of the list (the number of images in
698 % the list).
699 %
700 % The format of the GetImageListLength method is:
701 %
702 % size_t GetImageListLength(const Image *images)
703 %
704 % A description of each parameter follows:
705 %
706 % o images: the image list.
707 %
708 */
709 MagickExport size_t GetImageListLength(const Image *images)
710 {
711  register ssize_t
712  i;
713 
714  if (images == (Image *) NULL)
715  return(0);
716  assert(images->signature == MagickCoreSignature);
717  if (images->debug != MagickFalse)
718  (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",images->filename);
719  images=GetLastImageInList(images);
720  for (i=0; images != (Image *) NULL; images=images->previous)
721  {
722  assert(images != images->previous);
723  i++;
724  }
725  return((size_t) i);
726 }
727 
728 /*
729 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
730 % %
731 % %
732 % %
733 % G e t L a s t I m a g e I n L i s t %
734 % %
735 % %
736 % %
737 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
738 %
739 % GetLastImageInList() returns a pointer to the last image in the list.
740 %
741 % The format of the GetLastImageInList method is:
742 %
743 % Image *GetLastImageInList(const Image *images)
744 %
745 % A description of each parameter follows:
746 %
747 % o images: the image list.
748 %
749 */
751 {
752  register const Image
753  *p;
754 
755  if (images == (Image *) NULL)
756  return((Image *) NULL);
757  assert(images->signature == MagickCoreSignature);
758  for (p=images; p->next != (Image *) NULL; p=p->next) ;
759  return((Image *) p);
760 }
761 
762 /*
763 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
764 % %
765 % %
766 % %
767 % G e t N e x t I m a g e I n L i s t %
768 % %
769 % %
770 % %
771 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
772 %
773 % GetNextImageInList() returns the next image in the list.
774 %
775 % The format of the GetNextImageInList method is:
776 %
777 % Image *GetNextImageInList(const Image *images)
778 %
779 % A description of each parameter follows:
780 %
781 % o images: the image list.
782 %
783 */
785 {
786  if (images == (Image *) NULL)
787  return((Image *) NULL);
788  assert(images->signature == MagickCoreSignature);
789  if (images->debug != MagickFalse)
790  (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",images->filename);
791  return(images->next);
792 }
793 
794 /*
795 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
796 % %
797 % %
798 % %
799 % G e t P r e v i o u s I m a g e I n L i s t %
800 % %
801 % %
802 % %
803 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
804 %
805 % GetPreviousImageInList() returns the previous image in the list.
806 %
807 % The format of the GetPreviousImageInList method is:
808 %
809 % Image *GetPreviousImageInList(const Image *images)
810 %
811 % A description of each parameter follows:
812 %
813 % o images: the image list.
814 %
815 */
817 {
818  if (images == (Image *) NULL)
819  return((Image *) NULL);
820  assert(images->signature == MagickCoreSignature);
821  return(images->previous);
822 }
823 
824 /*
825 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
826 % %
827 % %
828 % I m a g e L i s t T o A r r a y %
829 % %
830 % %
831 % %
832 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
833 %
834 % ImageListToArray() is a convenience method that converts an image list to
835 % a sequential array, with a NULL image pointer at the end of the array.
836 %
837 % The images remain part of the original image list, with the array providing
838 % an alternative means of indexing the image array.
839 %
840 % group = ImageListToArray(images, exception);
841 % while (i = 0; group[i] != (Image *) NULL; i++)
842 % printf("%s\n", group[i]->filename);
843 % printf("%d images\n", i);
844 % group = RelinquishMagickMemory(group);
845 %
846 % The format of the ImageListToArray method is:
847 %
848 % Image **ImageListToArray(const Image *images,ExceptionInfo *exception)
849 %
850 % A description of each parameter follows:
851 %
852 % o image: the image list.
853 %
854 % o exception: return any errors or warnings in this structure.
855 %
856 */
858  ExceptionInfo *exception)
859 {
860  Image
861  **group;
862 
863  register ssize_t
864  i;
865 
866  if (images == (Image *) NULL)
867  return((Image **) NULL);
868  assert(images->signature == MagickCoreSignature);
869  if (images->debug != MagickFalse)
870  (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",images->filename);
871  group=(Image **) AcquireQuantumMemory((size_t) GetImageListLength(images)+1UL,
872  sizeof(*group));
873  if (group == (Image **) NULL)
874  {
875  (void) ThrowMagickException(exception,GetMagickModule(),
876  ResourceLimitError,"MemoryAllocationFailed","`%s'",images->filename);
877  return((Image **) NULL);
878  }
879  images=GetFirstImageInList(images);
880  for (i=0; images != (Image *) NULL; images=images->next)
881  {
882  assert(images != images->next);
883  group[i++]=(Image *) images;
884  }
885  group[i]=(Image *) NULL;
886  return(group);
887 }
888 
889 /*
890 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
891 % %
892 % %
893 % %
894 % I n s e r t I m a g e I n L i s t %
895 % %
896 % %
897 % %
898 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
899 %
900 % InsertImageInList() insert the given image or image list, into the first
901 % image list, immediately AFTER the image pointed to. The given image list
902 % pointer is left unchanged unless previously empty.
903 %
904 % The format of the InsertImageInList method is:
905 %
906 % InsertImageInList(Image **images,Image *insert)
907 %
908 % A description of each parameter follows:
909 %
910 % o images: the image list to insert into.
911 %
912 % o insert: the image list to insert.
913 %
914 */
916 {
917  Image
918  *split;
919 
920  assert(images != (Image **) NULL);
921  assert(insert != (Image *) NULL);
922  assert(insert->signature == MagickCoreSignature);
923  if (insert->debug != MagickFalse)
924  (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",insert->filename);
925  if ((*images) == (Image *) NULL)
926  return;
927  assert((*images)->signature == MagickCoreSignature);
928  split=SplitImageList(*images);
929  AppendImageToList(images,insert);
930  AppendImageToList(images,split);
931 }
932 
933 /*
934 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
935 % %
936 % %
937 % %
938 % N e w I m a g e L i s t %
939 % %
940 % %
941 % %
942 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
943 %
944 % NewImageList() creates an empty image list.
945 %
946 % The format of the NewImageList method is:
947 %
948 % Image *NewImageList(void)
949 %
950 */
952 {
953  return((Image *) NULL);
954 }
955 
956 /*
957 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
958 % %
959 % %
960 % %
961 % P r e p e n d I m a g e T o L i s t %
962 % %
963 % %
964 % %
965 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
966 %
967 % PrependImageToList() prepends the image to the beginning of the list.
968 %
969 % The format of the PrependImageToList method is:
970 %
971 % PrependImageToList(Image *images,Image *image)
972 %
973 % A description of each parameter follows:
974 %
975 % o images: the image list.
976 %
977 % o image: the image.
978 %
979 */
981 {
982  if (*images == (Image *) NULL)
983  {
984  *images=prepend;
985  return;
986  }
987  AppendImageToList(&prepend,*images);
988 }
989 
990 /*
991 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
992 % %
993 % %
994 % %
995 % R e m o v e I m a g e F r o m L i s t %
996 % %
997 % %
998 % %
999 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1000 %
1001 % RemoveImageFromList() removes and returns the image pointed to.
1002 %
1003 % The given image list pointer is set to point to the next image in list
1004 % if it exists, otherwise it is set to the previous image, or NULL if list
1005 % was emptied.
1006 %
1007 % The format of the RemoveImageFromList method is:
1008 %
1009 % Image *RemoveImageFromList(Image **images)
1010 %
1011 % A description of each parameter follows:
1012 %
1013 % o images: the image list.
1014 %
1015 */
1017 {
1018  register Image
1019  *p;
1020 
1021  assert(images != (Image **) NULL);
1022  if ((*images) == (Image *) NULL)
1023  return((Image *) NULL);
1024  assert((*images)->signature == MagickCoreSignature);
1025  if ((*images)->debug != MagickFalse)
1027  (*images)->filename);
1028  p=(*images);
1029  if ((p->previous == (Image *) NULL) && (p->next == (Image *) NULL))
1030  *images=(Image *) NULL;
1031  else
1032  {
1033  if (p->previous != (Image *) NULL)
1034  {
1035  p->previous->next=p->next;
1036  *images=p->previous;
1037  }
1038  if (p->next != (Image *) NULL)
1039  {
1040  p->next->previous=p->previous;
1041  *images=p->next;
1042  }
1043  p->previous=(Image *) NULL;
1044  p->next=(Image *) NULL;
1045  }
1046  return(p);
1047 }
1048 
1049 /*
1050 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1051 % %
1052 % %
1053 % %
1054 % R e m o v e F i r s t I m a g e F r o m L i s t %
1055 % %
1056 % %
1057 % %
1058 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1059 %
1060 % RemoveFirstImageFromList() removes and returns the first image in the list.
1061 %
1062 % If the given image list pointer pointed to the removed first image, it is
1063 % set to the new first image of list, or NULL if list was emptied, otherwise
1064 % it is left as is.
1065 %
1066 % The format of the RemoveFirstImageFromList method is:
1067 %
1068 % Image *RemoveFirstImageFromList(Image **images)
1069 %
1070 % A description of each parameter follows:
1071 %
1072 % o images: the image list.
1073 %
1074 */
1076 {
1077  Image
1078  *image;
1079 
1080  assert(images != (Image **) NULL);
1081  if ((*images) == (Image *) NULL)
1082  return((Image *) NULL);
1083  assert((*images)->signature == MagickCoreSignature);
1084  if ((*images)->debug != MagickFalse)
1086  (*images)->filename);
1087  image=(*images);
1088  while (image->previous != (Image *) NULL)
1089  image=image->previous;
1090  if (image == *images)
1091  *images=(*images)->next;
1092  if (image->next != (Image *) NULL)
1093  {
1094  image->next->previous=(Image *) NULL;
1095  image->next=(Image *) NULL;
1096  }
1097  return(image);
1098 }
1099 
1100 /*
1101 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1102 % %
1103 % %
1104 % %
1105 % R e m o v e L a s t I m a g e F r o m L i s t %
1106 % %
1107 % %
1108 % %
1109 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1110 %
1111 % RemoveLastImageFromList() removes and returns the last image from the list.
1112 %
1113 % If the given image list pointer pointed to the removed last image, it is
1114 % set to the new last image of list, or NULL if list was emptied, otherwise
1115 % it is left as is.
1116 %
1117 % The format of the RemoveLastImageFromList method is:
1118 %
1119 % Image *RemoveLastImageFromList(Image **images)
1120 %
1121 % A description of each parameter follows:
1122 %
1123 % o images: the image list.
1124 %
1125 */
1127 {
1128  Image
1129  *image;
1130 
1131  assert(images != (Image **) NULL);
1132  if ((*images) == (Image *) NULL)
1133  return((Image *) NULL);
1134  assert((*images)->signature == MagickCoreSignature);
1135  if ((*images)->debug != MagickFalse)
1137  (*images)->filename);
1138  image=(*images);
1139  while (image->next != (Image *) NULL)
1140  image=image->next;
1141  if (image == *images)
1142  *images=(*images)->previous;
1143  if (image->previous != (Image *) NULL)
1144  {
1145  image->previous->next=(Image *) NULL;
1146  image->previous=(Image *) NULL;
1147  }
1148  return(image);
1149 }
1150 
1151 /*
1152 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1153 % %
1154 % %
1155 % %
1156 % R e p l a c e I m a g e I n L i s t %
1157 % %
1158 % %
1159 % %
1160 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1161 %
1162 % ReplaceImageInList() replaces an image in the list with the given image, or
1163 % list of images. Old image is destroyed.
1164 %
1165 % The images list pointer is set to point to the first image of the inserted
1166 % list of images.
1167 %
1168 % The format of the ReplaceImageInList method is:
1169 %
1170 % ReplaceImageInList(Image **images,Image *replace)
1171 %
1172 % A description of each parameter follows:
1173 %
1174 % o images: the list and pointer to image to replace
1175 %
1176 % o replace: the image or image list replacing the original
1177 %
1178 */
1180 {
1181  assert(images != (Image **) NULL);
1182  assert(replace != (Image *) NULL);
1183  assert(replace->signature == MagickCoreSignature);
1184  if (replace->debug != MagickFalse)
1185  (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",replace->filename);
1186  if ((*images) == (Image *) NULL)
1187  return;
1188  assert((*images)->signature == MagickCoreSignature);
1189 
1190  /* link next pointer */
1191  replace=GetLastImageInList(replace);
1192  replace->next=(*images)->next;
1193  if (replace->next != (Image *) NULL)
1194  replace->next->previous=replace;
1195 
1196  /* link previous pointer - set images position to first replacement image */
1197  replace=GetFirstImageInList(replace);
1198  replace->previous=(*images)->previous;
1199  if (replace->previous != (Image *) NULL)
1200  replace->previous->next=replace;
1201 
1202  /* destroy the replaced image that was in images */
1203  (void) DestroyImage(*images);
1204  (*images)=replace;
1205 }
1206 
1207 /*
1208 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1209 % %
1210 % %
1211 % %
1212 % R e p l a c e I m a g e I n L i s t R e t u r n L a s t %
1213 % %
1214 % %
1215 % %
1216 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1217 %
1218 % ReplaceImageInListReturnLast() is exactly as ReplaceImageInList() except
1219 % the images pointer is set to the last image in the list of replacement
1220 % images.
1221 %
1222 % This allows you to simply use GetNextImageInList() to go to the image
1223 % that follows the just replaced image, even if a list of replacement images
1224 % was inserted.
1225 %
1226 % The format of the ReplaceImageInList method is:
1227 %
1228 % ReplaceImageInListReturnLast(Image **images,Image *replace)
1229 %
1230 % A description of each parameter follows:
1231 %
1232 % o images: the list and pointer to image to replace
1233 %
1234 % o replace: the image or image list replacing the original
1235 %
1236 */
1238 {
1239  assert(images != (Image **) NULL);
1240  assert(replace != (Image *) NULL);
1241  assert(replace->signature == MagickCoreSignature);
1242  if (replace->debug != MagickFalse)
1243  (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",replace->filename);
1244  if ((*images) == (Image *) NULL)
1245  return;
1246  assert((*images)->signature == MagickCoreSignature);
1247 
1248  /* link previous pointer */
1249  replace=GetFirstImageInList(replace);
1250  replace->previous=(*images)->previous;
1251  if (replace->previous != (Image *) NULL)
1252  replace->previous->next=replace;
1253 
1254  /* link next pointer - set images position to last replacement image */
1255  replace=GetLastImageInList(replace);
1256  replace->next=(*images)->next;
1257  if (replace->next != (Image *) NULL)
1258  replace->next->previous=replace;
1259 
1260  /* destroy the replaced image that was in images */
1261  (void) DestroyImage(*images);
1262  (*images)=replace;
1263 }
1264 
1265 /*
1266 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1267 % %
1268 % %
1269 % %
1270 % R e v e r s e I m a g e L i s t %
1271 % %
1272 % %
1273 % %
1274 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1275 %
1276 % ReverseImageList() reverses the order of an image list.
1277 % The list pointer is reset to that start of the re-ordered list.
1278 %
1279 % The format of the ReverseImageList method is:
1280 %
1281 % void ReverseImageList(Image **images)
1282 %
1283 % A description of each parameter follows:
1284 %
1285 % o images: the image list.
1286 %
1287 */
1289 {
1290  Image
1291  *next;
1292 
1293  register Image
1294  *p;
1295 
1296  assert(images != (Image **) NULL);
1297  if ((*images) == (Image *) NULL)
1298  return;
1299  assert((*images)->signature == MagickCoreSignature);
1300  if ((*images)->debug != MagickFalse)
1302  (*images)->filename);
1303  for (p=(*images); p->next != (Image *) NULL; p=p->next) ;
1304  *images=p;
1305  for ( ; p != (Image *) NULL; p=p->next)
1306  {
1307  next=p->next;
1308  p->next=p->previous;
1309  p->previous=next;
1310  }
1311 }
1312 
1313 /*
1314 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1315 % %
1316 % %
1317 % %
1318 % S p l i c e I m a g e I n t o L i s t %
1319 % %
1320 % %
1321 % %
1322 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1323 %
1324 % SpliceImageIntoList() removes 'length' images from the list and replaces
1325 % them with the specified splice. Removed images are returned.
1326 %
1327 % The format of the SpliceImageIntoList method is:
1328 %
1329 % SpliceImageIntoList(Image **images,const size_t,
1330 % const Image *splice)
1331 %
1332 % A description of each parameter follows:
1333 %
1334 % o images: the image list.
1335 %
1336 % o length: the length of the image list to remove.
1337 %
1338 % o splice: Replace the removed image list with this list.
1339 %
1340 */
1342  const size_t length,const Image *splice)
1343 {
1344  Image
1345  *image,
1346  *split;
1347 
1348  register size_t
1349  i;
1350 
1351  assert(images != (Image **) NULL);
1352  assert(splice != (Image *) NULL);
1353  assert(splice->signature == MagickCoreSignature);
1354  if ((*images) == (Image *) NULL)
1355  return((Image *) NULL);
1356  assert((*images)->signature == MagickCoreSignature);
1357  if ((*images)->debug != MagickFalse)
1359  (*images)->filename);
1360  split=SplitImageList(*images);
1361  AppendImageToList(images,splice);
1362  image=(Image *) NULL;
1363  for (i=0; (i < length) && (split != (Image *) NULL); i++)
1364  AppendImageToList(&image,RemoveImageFromList(&split));
1365  AppendImageToList(images,split);
1366  return(image);
1367 }
1368 
1369 /*
1370 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1371 % %
1372 % %
1373 % %
1374 % S p l i t I m a g e L i s t %
1375 % %
1376 % %
1377 % %
1378 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1379 %
1380 % SplitImageList() splits an image into two lists, after given image
1381 % The list that was split off is returned, which may be empty.
1382 %
1383 % The format of the SplitImageList method is:
1384 %
1385 % Image *SplitImageList(Image *images)
1386 %
1387 % A description of each parameter follows:
1388 %
1389 % o images: the image list.
1390 %
1391 */
1393 {
1394  if ((images == (Image *) NULL) || (images->next == (Image *) NULL))
1395  return((Image *) NULL);
1396  images=images->next;
1397  images->previous->next=(Image *) NULL;
1398  images->previous=(Image *) NULL;
1399  return(images);
1400 }
1401 
1402 /*
1403 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1404 % %
1405 % %
1406 % %
1407 + S y n c I m a g e L i s t %
1408 % %
1409 % %
1410 % %
1411 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1412 %
1413 % SyncImageList() synchronizes the scene numbers in an image list.
1414 %
1415 % The format of the SyncImageList method is:
1416 %
1417 % void SyncImageList(Image *images)
1418 %
1419 % A description of each parameter follows:
1420 %
1421 % o images: the image list.
1422 %
1423 */
1425 {
1426  register Image
1427  *p,
1428  *q;
1429 
1430  if (images == (Image *) NULL)
1431  return;
1432  assert(images->signature == MagickCoreSignature);
1433  for (p=images; p != (Image *) NULL; p=p->next)
1434  {
1435  for (q=p->next; q != (Image *) NULL; q=q->next)
1436  if (p->scene == q->scene)
1437  break;
1438  if (q != (Image *) NULL)
1439  break;
1440  }
1441  if (p == (Image *) NULL)
1442  return;
1443  for (p=images->next; p != (Image *) NULL; p=p->next)
1444  p->scene=p->previous->scene+1;
1445 }
1446 
1447 /*
1448 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1449 % %
1450 % %
1451 % %
1452 + S y n c N e x t I m a g e I n L i s t %
1453 % %
1454 % %
1455 % %
1456 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1457 %
1458 % SyncNextImageInList() returns the next image in the list after the blob
1459 % referenced is synchronized with the current image.
1460 %
1461 % The format of the SyncNextImageInList method is:
1462 %
1463 % Image *SyncNextImageInList(const Image *images)
1464 %
1465 % A description of each parameter follows:
1466 %
1467 % o images: the image list.
1468 %
1469 */
1471 {
1472  if (images == (Image *) NULL)
1473  return((Image *) NULL);
1474  assert(images->signature == MagickCoreSignature);
1475  if (images->next == (Image *) NULL)
1476  return((Image *) NULL);
1477  if (images->blob != images->next->blob)
1478  {
1479  DestroyBlob(images->next);
1480  images->next->blob=ReferenceBlob(images->blob);
1481  }
1482  if (images->next->compression == UndefinedCompression)
1483  images->next->compression=images->compression;
1484  if (images->next->endian == UndefinedEndian)
1485  images->next->endian=images->endian;
1486  return(images->next);
1487 }
MagickExport Image * CloneImages(const Image *images, const char *scenes, ExceptionInfo *exception)
Definition: list.c:206
MagickExport Image * GetImageFromList(const Image *images, const ssize_t index)
Definition: list.c:618
size_t signature
Definition: exception.h:123
MagickExport Image * RemoveFirstImageFromList(Image **images)
Definition: list.c:1075
EndianType endian
Definition: image.h:228
MagickExport void InsertImageInList(Image **images, Image *insert)
Definition: list.c:915
MagickExport const char * GetImageArtifact(const Image *image, const char *artifact)
Definition: artifact.c:273
static double StringToDouble(const char *magick_restrict string, char **magick_restrict sentinal)
MagickExport void DeleteImages(Image **images, const char *scenes, ExceptionInfo *exception)
Definition: list.c:370
MagickExport Image * SpliceImageIntoList(Image **images, const size_t length, const Image *splice)
Definition: list.c:1341
CompressionType compression
Definition: image.h:160
MagickExport Image * DuplicateImages(Image *images, const size_t number_duplicates, const char *scenes, ExceptionInfo *exception)
Definition: list.c:523
Definition: log.h:52
Definition: image.h:151
MagickExport Image * GetPreviousImageInList(const Image *images)
Definition: list.c:816
#define MagickCoreSignature
MagickExport Image * GetFirstImageInList(const Image *images)
Definition: list.c:574
MagickExport Image * RemoveImageFromList(Image **images)
Definition: list.c:1016
MagickBooleanType
Definition: magick-type.h:169
MagickExport Image * NewImageList(void)
Definition: list.c:951
size_t scene
Definition: image.h:240
MagickExport void ReplaceImageInListReturnLast(Image **images, Image *replace)
Definition: list.c:1237
MagickExport Image * SplitImageList(Image *images)
Definition: list.c:1392
MagickExport void * AcquireQuantumMemory(const size_t count, const size_t quantum)
Definition: memory.c:634
MagickExport Image * SyncNextImageInList(const Image *images)
Definition: list.c:1470
struct _Image * previous
Definition: image.h:348
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:1145
MagickExport MagickBooleanType LogMagickEvent(const LogEventType type, const char *module, const char *function, const size_t line, const char *format,...)
Definition: log.c:1660
size_t signature
Definition: image.h:354
struct _Image * next
Definition: image.h:348
MagickExport Image * GetLastImageInList(const Image *images)
Definition: list.c:750
MagickExport Image * DestroyImageList(Image *images)
Definition: list.c:475
MagickExport Image * RemoveLastImageFromList(Image **images)
Definition: list.c:1126
char filename[MagickPathExtent]
Definition: image.h:319
ElementInfo * next
Definition: linked-list.c:75
#define GetMagickModule()
Definition: log.h:28
MagickExport Image * CloneImageList(const Image *images, ExceptionInfo *exception)
Definition: list.c:128
MagickExport Image ** ImageListToArray(const Image *images, ExceptionInfo *exception)
Definition: list.c:857
MagickExport void ReplaceImageInList(Image **images, Image *replace)
Definition: list.c:1179
MagickExport ssize_t GetImageIndexInList(const Image *images)
Definition: list.c:670
MagickExport Image * GetNextImageInList(const Image *images)
Definition: list.c:784
MagickExport void AppendImageToList(Image **images, const Image *append)
Definition: list.c:80
BlobInfo * blob
Definition: image.h:328
MagickExport void SyncImageList(Image *images)
Definition: list.c:1424
MagickExport void * RelinquishMagickMemory(void *memory)
Definition: memory.c:1123
MagickExport BlobInfo * ReferenceBlob(BlobInfo *)
Definition: blob.c:4887
MagickExport void PrependImageToList(Image **images, Image *prepend)
Definition: list.c:980
#define MagickExport
MagickExport void DestroyBlob(Image *image)
Definition: blob.c:933
MagickExport void DeleteImageFromList(Image **images)
Definition: list.c:324
MagickExport size_t GetImageListLength(const Image *images)
Definition: list.c:709
MagickExport void ReverseImageList(Image **images)
Definition: list.c:1288
MagickExport Image * DestroyImage(Image *image)
Definition: image.c:1160
MagickExport Image * CloneImage(const Image *image, const size_t columns, const size_t rows, const MagickBooleanType detach, ExceptionInfo *exception)
Definition: image.c:775
MagickBooleanType debug
Definition: image.h:334