173b526fb4af0f60634f0078583d92b931d5c0eebnethercote/*
273b526fb4af0f60634f0078583d92b931d5c0eebnethercote%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
34de47b1c9bfe84ddd76a9e71e486c5085c51e3a8njn%                                                                             %
473b526fb4af0f60634f0078583d92b931d5c0eebnethercote%                                                                             %
573b526fb4af0f60634f0078583d92b931d5c0eebnethercote%                                                                             %
673b526fb4af0f60634f0078583d92b931d5c0eebnethercote%                            RRRR    GGGG  BBBB                               %
7b9c427c63a278cc612ae0ec573be7bb1abaa447fnjn%                            R   R  G      B   B                              %
8b9c427c63a278cc612ae0ec573be7bb1abaa447fnjn%                            RRRR   G  GG  BBBB                               %
973b526fb4af0f60634f0078583d92b931d5c0eebnethercote%                            R R    G   G  B   B                              %
104d474d086188fd1f29fa97dbd84d8ea2e589a9b8sewardj%                            R  R    GGG   BBBB                               %
1173b526fb4af0f60634f0078583d92b931d5c0eebnethercote%                                                                             %
1273b526fb4af0f60634f0078583d92b931d5c0eebnethercote%                                                                             %
1373b526fb4af0f60634f0078583d92b931d5c0eebnethercote%                     Read/Write Raw RGB Image Format                         %
1473b526fb4af0f60634f0078583d92b931d5c0eebnethercote%                                                                             %
1573b526fb4af0f60634f0078583d92b931d5c0eebnethercote%                              Software Design                                %
1673b526fb4af0f60634f0078583d92b931d5c0eebnethercote%                                   Cristy                                    %
1773b526fb4af0f60634f0078583d92b931d5c0eebnethercote%                                 July 1992                                   %
1873b526fb4af0f60634f0078583d92b931d5c0eebnethercote%                                                                             %
1973b526fb4af0f60634f0078583d92b931d5c0eebnethercote%                                                                             %
2073b526fb4af0f60634f0078583d92b931d5c0eebnethercote%  Copyright 1999-2016 ImageMagick Studio LLC, a non-profit organization      %
2173b526fb4af0f60634f0078583d92b931d5c0eebnethercote%  dedicated to making software imaging solutions freely available.           %
2273b526fb4af0f60634f0078583d92b931d5c0eebnethercote%                                                                             %
2373b526fb4af0f60634f0078583d92b931d5c0eebnethercote%  You may not use this file except in compliance with the License.  You may  %
2473b526fb4af0f60634f0078583d92b931d5c0eebnethercote%  obtain a copy of the License at                                            %
2573b526fb4af0f60634f0078583d92b931d5c0eebnethercote%                                                                             %
2673b526fb4af0f60634f0078583d92b931d5c0eebnethercote%    http://www.imagemagick.org/script/license.php                            %
2773b526fb4af0f60634f0078583d92b931d5c0eebnethercote%                                                                             %
2873b526fb4af0f60634f0078583d92b931d5c0eebnethercote%  Unless required by applicable law or agreed to in writing, software        %
2973b526fb4af0f60634f0078583d92b931d5c0eebnethercote%  distributed under the License is distributed on an "AS IS" BASIS,          %
3073b526fb4af0f60634f0078583d92b931d5c0eebnethercote%  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   %
3173b526fb4af0f60634f0078583d92b931d5c0eebnethercote%  See the License for the specific language governing permissions and        %
3273b526fb4af0f60634f0078583d92b931d5c0eebnethercote%  limitations under the License.                                             %
3373b526fb4af0f60634f0078583d92b931d5c0eebnethercote%                                                                             %
3473b526fb4af0f60634f0078583d92b931d5c0eebnethercote%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3573b526fb4af0f60634f0078583d92b931d5c0eebnethercote%
3673b526fb4af0f60634f0078583d92b931d5c0eebnethercote%
3773b526fb4af0f60634f0078583d92b931d5c0eebnethercote*/
3873b526fb4af0f60634f0078583d92b931d5c0eebnethercote
3973b526fb4af0f60634f0078583d92b931d5c0eebnethercote/*
4073b526fb4af0f60634f0078583d92b931d5c0eebnethercote  Include declarations.
4173b526fb4af0f60634f0078583d92b931d5c0eebnethercote*/
4273b526fb4af0f60634f0078583d92b931d5c0eebnethercote#include "MagickCore/studio.h"
4373b526fb4af0f60634f0078583d92b931d5c0eebnethercote#include "MagickCore/blob.h"
4473b526fb4af0f60634f0078583d92b931d5c0eebnethercote#include "MagickCore/blob-private.h"
4573b526fb4af0f60634f0078583d92b931d5c0eebnethercote#include "MagickCore/cache.h"
4673b526fb4af0f60634f0078583d92b931d5c0eebnethercote#include "MagickCore/channel.h"
47ac7924c7eedce947578c571ae419c4c84eaa5aefnjn#include "MagickCore/colorspace.h"
48edef146c47eda894495d2b3b71b32b10349f8d91sewardj#include "MagickCore/colorspace-private.h"
494de47b1c9bfe84ddd76a9e71e486c5085c51e3a8njn#include "MagickCore/constitute.h"
504de47b1c9bfe84ddd76a9e71e486c5085c51e3a8njn#include "MagickCore/exception.h"
51ac7924c7eedce947578c571ae419c4c84eaa5aefnjn#include "MagickCore/exception-private.h"
52ac7924c7eedce947578c571ae419c4c84eaa5aefnjn#include "MagickCore/image.h"
53ac7924c7eedce947578c571ae419c4c84eaa5aefnjn#include "MagickCore/image-private.h"
54ac7924c7eedce947578c571ae419c4c84eaa5aefnjn#include "MagickCore/list.h"
55ac7924c7eedce947578c571ae419c4c84eaa5aefnjn#include "MagickCore/magick.h"
5673b526fb4af0f60634f0078583d92b931d5c0eebnethercote#include "MagickCore/memory_.h"
5773b526fb4af0f60634f0078583d92b931d5c0eebnethercote#include "MagickCore/monitor.h"
5873b526fb4af0f60634f0078583d92b931d5c0eebnethercote#include "MagickCore/monitor-private.h"
5973b526fb4af0f60634f0078583d92b931d5c0eebnethercote#include "MagickCore/pixel-accessor.h"
604cfea4f9480393ed6799db463b2e0fb8865a1a2fsewardj#include "MagickCore/quantum-private.h"
614cfea4f9480393ed6799db463b2e0fb8865a1a2fsewardj#include "MagickCore/static.h"
624cfea4f9480393ed6799db463b2e0fb8865a1a2fsewardj#include "MagickCore/statistic.h"
634cfea4f9480393ed6799db463b2e0fb8865a1a2fsewardj#include "MagickCore/string_.h"
644cfea4f9480393ed6799db463b2e0fb8865a1a2fsewardj#include "MagickCore/module.h"
654cfea4f9480393ed6799db463b2e0fb8865a1a2fsewardj#include "MagickCore/utility.h"
664cfea4f9480393ed6799db463b2e0fb8865a1a2fsewardj
674cfea4f9480393ed6799db463b2e0fb8865a1a2fsewardj/*
684cfea4f9480393ed6799db463b2e0fb8865a1a2fsewardj  Forward declarations.
694cfea4f9480393ed6799db463b2e0fb8865a1a2fsewardj*/
704cfea4f9480393ed6799db463b2e0fb8865a1a2fsewardjstatic MagickBooleanType
714cfea4f9480393ed6799db463b2e0fb8865a1a2fsewardj  WriteRGBImage(const ImageInfo *,Image *,ExceptionInfo *);
724cfea4f9480393ed6799db463b2e0fb8865a1a2fsewardj
734cfea4f9480393ed6799db463b2e0fb8865a1a2fsewardj/*
744cfea4f9480393ed6799db463b2e0fb8865a1a2fsewardj%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
754de47b1c9bfe84ddd76a9e71e486c5085c51e3a8njn%                                                                             %
764de47b1c9bfe84ddd76a9e71e486c5085c51e3a8njn%                                                                             %
7773b526fb4af0f60634f0078583d92b931d5c0eebnethercote%                                                                             %
7873b526fb4af0f60634f0078583d92b931d5c0eebnethercote%   R e a d R G B I m a g e                                                   %
7973b526fb4af0f60634f0078583d92b931d5c0eebnethercote%                                                                             %
8073b526fb4af0f60634f0078583d92b931d5c0eebnethercote%                                                                             %
8173b526fb4af0f60634f0078583d92b931d5c0eebnethercote%                                                                             %
824de47b1c9bfe84ddd76a9e71e486c5085c51e3a8njn%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
834cfea4f9480393ed6799db463b2e0fb8865a1a2fsewardj%
844de47b1c9bfe84ddd76a9e71e486c5085c51e3a8njn%  ReadRGBImage() reads an image of raw RGB, RGBA, or RGBO samples and returns
854cfea4f9480393ed6799db463b2e0fb8865a1a2fsewardj%  it.  It allocates the memory necessary for the new Image structure and
8685665ca6fa29dd64754dabe50eb98f25896e752acerion%  returns a pointer to the new image.
874cfea4f9480393ed6799db463b2e0fb8865a1a2fsewardj%
882c48c7b0a453d32375a4df17e153011b797ef28csewardj%  The format of the ReadRGBImage method is:
894cfea4f9480393ed6799db463b2e0fb8865a1a2fsewardj%
904de47b1c9bfe84ddd76a9e71e486c5085c51e3a8njn%      Image *ReadRGBImage(const ImageInfo *image_info,
914de47b1c9bfe84ddd76a9e71e486c5085c51e3a8njn%        ExceptionInfo *exception)
924de47b1c9bfe84ddd76a9e71e486c5085c51e3a8njn%
9373b526fb4af0f60634f0078583d92b931d5c0eebnethercote%  A description of each parameter follows:
9473b526fb4af0f60634f0078583d92b931d5c0eebnethercote%
9573b526fb4af0f60634f0078583d92b931d5c0eebnethercote%    o image_info: the image info.
9673b526fb4af0f60634f0078583d92b931d5c0eebnethercote%
9773b526fb4af0f60634f0078583d92b931d5c0eebnethercote%    o exception: return any errors or warnings in this structure.
9873b526fb4af0f60634f0078583d92b931d5c0eebnethercote%
9973b526fb4af0f60634f0078583d92b931d5c0eebnethercote*/
10073b526fb4af0f60634f0078583d92b931d5c0eebnethercotestatic Image *ReadRGBImage(const ImageInfo *image_info,ExceptionInfo *exception)
10173b526fb4af0f60634f0078583d92b931d5c0eebnethercote{
10273b526fb4af0f60634f0078583d92b931d5c0eebnethercote  const unsigned char
10373b526fb4af0f60634f0078583d92b931d5c0eebnethercote    *pixels;
10473b526fb4af0f60634f0078583d92b931d5c0eebnethercote
10573b526fb4af0f60634f0078583d92b931d5c0eebnethercote  Image
106f1049bfd7145c4d8ee333bb2a714700e1ab3a049nethercote    *canvas_image,
107f1049bfd7145c4d8ee333bb2a714700e1ab3a049nethercote    *image;
108f1049bfd7145c4d8ee333bb2a714700e1ab3a049nethercote
109f1049bfd7145c4d8ee333bb2a714700e1ab3a049nethercote  MagickBooleanType
110f1049bfd7145c4d8ee333bb2a714700e1ab3a049nethercote    status;
111f1049bfd7145c4d8ee333bb2a714700e1ab3a049nethercote
112f1049bfd7145c4d8ee333bb2a714700e1ab3a049nethercote  MagickOffsetType
113f1049bfd7145c4d8ee333bb2a714700e1ab3a049nethercote    scene;
114f1049bfd7145c4d8ee333bb2a714700e1ab3a049nethercote
115f1049bfd7145c4d8ee333bb2a714700e1ab3a049nethercote  QuantumInfo
116f1049bfd7145c4d8ee333bb2a714700e1ab3a049nethercote    *quantum_info;
117f1049bfd7145c4d8ee333bb2a714700e1ab3a049nethercote
118f1049bfd7145c4d8ee333bb2a714700e1ab3a049nethercote  QuantumType
119f1049bfd7145c4d8ee333bb2a714700e1ab3a049nethercote    quantum_type;
120f1049bfd7145c4d8ee333bb2a714700e1ab3a049nethercote
121f1049bfd7145c4d8ee333bb2a714700e1ab3a049nethercote  register ssize_t
122f1049bfd7145c4d8ee333bb2a714700e1ab3a049nethercote    i;
123f1049bfd7145c4d8ee333bb2a714700e1ab3a049nethercote
124f1049bfd7145c4d8ee333bb2a714700e1ab3a049nethercote  size_t
12573b526fb4af0f60634f0078583d92b931d5c0eebnethercote    length;
126330abb517e58fd0ee96fda7fb8563e32e029a63enethercote
12773b526fb4af0f60634f0078583d92b931d5c0eebnethercote  ssize_t
12873b526fb4af0f60634f0078583d92b931d5c0eebnethercote    count,
12973b526fb4af0f60634f0078583d92b931d5c0eebnethercote    y;
13073b526fb4af0f60634f0078583d92b931d5c0eebnethercote
13173b526fb4af0f60634f0078583d92b931d5c0eebnethercote  /*
132f1049bfd7145c4d8ee333bb2a714700e1ab3a049nethercote    Open image file.
13373b526fb4af0f60634f0078583d92b931d5c0eebnethercote  */
13473b526fb4af0f60634f0078583d92b931d5c0eebnethercote  assert(image_info != (const ImageInfo *) NULL);
13573b526fb4af0f60634f0078583d92b931d5c0eebnethercote  assert(image_info->signature == MagickCoreSignature);
13673b526fb4af0f60634f0078583d92b931d5c0eebnethercote  if (image_info->debug != MagickFalse)
13773b526fb4af0f60634f0078583d92b931d5c0eebnethercote    (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
13873b526fb4af0f60634f0078583d92b931d5c0eebnethercote      image_info->filename);
13992b2fd542e89939b46edfa5c424af81f4a3bfe0cnethercote  assert(exception != (ExceptionInfo *) NULL);
140330abb517e58fd0ee96fda7fb8563e32e029a63enethercote  assert(exception->signature == MagickCoreSignature);
14173b526fb4af0f60634f0078583d92b931d5c0eebnethercote  image=AcquireImage(image_info,exception);
14273b526fb4af0f60634f0078583d92b931d5c0eebnethercote  if ((image->columns == 0) || (image->rows == 0))
14373b526fb4af0f60634f0078583d92b931d5c0eebnethercote    ThrowReaderException(OptionError,"MustSpecifyImageSize");
14473b526fb4af0f60634f0078583d92b931d5c0eebnethercote  if (image_info->interlace != PartitionInterlace)
14573b526fb4af0f60634f0078583d92b931d5c0eebnethercote    {
146c6851dde1b46166417a2bdb096c05818f5f07f09nethercote      status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
147c6851dde1b46166417a2bdb096c05818f5f07f09nethercote      if (status == MagickFalse)
148c6851dde1b46166417a2bdb096c05818f5f07f09nethercote        {
14973b526fb4af0f60634f0078583d92b931d5c0eebnethercote          image=DestroyImageList(image);
15073b526fb4af0f60634f0078583d92b931d5c0eebnethercote          return((Image *) NULL);
15173b526fb4af0f60634f0078583d92b931d5c0eebnethercote        }
15273b526fb4af0f60634f0078583d92b931d5c0eebnethercote      if (DiscardBlobBytes(image,image->offset) == MagickFalse)
15373b526fb4af0f60634f0078583d92b931d5c0eebnethercote        ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile",
15473b526fb4af0f60634f0078583d92b931d5c0eebnethercote          image->filename);
15573b526fb4af0f60634f0078583d92b931d5c0eebnethercote    }
1565b653bc2c60f6913e5bb6c2ebabfcf705a90c012nethercote  /*
1575b653bc2c60f6913e5bb6c2ebabfcf705a90c012nethercote    Create virtual canvas to support cropping (i.e. image.rgb[100x100+10+20]).
1587f7e4d1ac0c4ea8bf771e5490b69d0e4d619dfe9nethercote  */
1597f7e4d1ac0c4ea8bf771e5490b69d0e4d619dfe9nethercote  canvas_image=CloneImage(image,image->extract_info.width,1,MagickFalse,
16073b526fb4af0f60634f0078583d92b931d5c0eebnethercote    exception);
16173b526fb4af0f60634f0078583d92b931d5c0eebnethercote  (void) SetImageVirtualPixelMethod(canvas_image,BlackVirtualPixelMethod,
16273b526fb4af0f60634f0078583d92b931d5c0eebnethercote    exception);
16373b526fb4af0f60634f0078583d92b931d5c0eebnethercote  quantum_info=AcquireQuantumInfo(image_info,canvas_image);
1644de47b1c9bfe84ddd76a9e71e486c5085c51e3a8njn  if (quantum_info == (QuantumInfo *) NULL)
1654de47b1c9bfe84ddd76a9e71e486c5085c51e3a8njn    ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
1664de47b1c9bfe84ddd76a9e71e486c5085c51e3a8njn  quantum_type=RGBQuantum;
1674de47b1c9bfe84ddd76a9e71e486c5085c51e3a8njn  if (LocaleCompare(image_info->magick,"RGBA") == 0)
16885665ca6fa29dd64754dabe50eb98f25896e752acerion    {
16985665ca6fa29dd64754dabe50eb98f25896e752acerion      quantum_type=RGBAQuantum;
1702c48c7b0a453d32375a4df17e153011b797ef28csewardj      image->alpha_trait=BlendPixelTrait;
1712c48c7b0a453d32375a4df17e153011b797ef28csewardj      canvas_image->alpha_trait=BlendPixelTrait;
1724de47b1c9bfe84ddd76a9e71e486c5085c51e3a8njn    }
1734de47b1c9bfe84ddd76a9e71e486c5085c51e3a8njn  if (LocaleCompare(image_info->magick,"RGBO") == 0)
1744de47b1c9bfe84ddd76a9e71e486c5085c51e3a8njn    {
17573b526fb4af0f60634f0078583d92b931d5c0eebnethercote      quantum_type=RGBOQuantum;
17673b526fb4af0f60634f0078583d92b931d5c0eebnethercote      image->alpha_trait=BlendPixelTrait;
1777f4d7e42a880cd0872f93f5178a723beb56941a4tom      canvas_image->alpha_trait=BlendPixelTrait;
1787f4d7e42a880cd0872f93f5178a723beb56941a4tom    }
1797f4d7e42a880cd0872f93f5178a723beb56941a4tom  pixels=(const unsigned char *) NULL;
1807f4d7e42a880cd0872f93f5178a723beb56941a4tom  if (image_info->number_scenes != 0)
1817f4d7e42a880cd0872f93f5178a723beb56941a4tom    while (image->scene < image_info->scene)
1829b27b82dac450baac59c4f8d1cd3589bedead53csewardj    {
1839b27b82dac450baac59c4f8d1cd3589bedead53csewardj      /*
1847f4d7e42a880cd0872f93f5178a723beb56941a4tom        Skip to next image.
1857f4d7e42a880cd0872f93f5178a723beb56941a4tom      */
1867f4d7e42a880cd0872f93f5178a723beb56941a4tom      image->scene++;
18773b526fb4af0f60634f0078583d92b931d5c0eebnethercote      length=GetQuantumExtent(canvas_image,quantum_info,quantum_type);
18873b526fb4af0f60634f0078583d92b931d5c0eebnethercote      for (y=0; y < (ssize_t) image->rows; y++)
18973b526fb4af0f60634f0078583d92b931d5c0eebnethercote      {
19073b526fb4af0f60634f0078583d92b931d5c0eebnethercote        pixels=(const unsigned char *) ReadBlobStream(image,length,
19173b526fb4af0f60634f0078583d92b931d5c0eebnethercote          GetQuantumPixels(quantum_info),&count);
19273b526fb4af0f60634f0078583d92b931d5c0eebnethercote        if (count != (ssize_t) length)
19373b526fb4af0f60634f0078583d92b931d5c0eebnethercote          break;
19473b526fb4af0f60634f0078583d92b931d5c0eebnethercote      }
19573b526fb4af0f60634f0078583d92b931d5c0eebnethercote    }
19673b526fb4af0f60634f0078583d92b931d5c0eebnethercote  count=0;
19773b526fb4af0f60634f0078583d92b931d5c0eebnethercote  length=0;
19873b526fb4af0f60634f0078583d92b931d5c0eebnethercote  scene=0;
19973b526fb4af0f60634f0078583d92b931d5c0eebnethercote  do
20073b526fb4af0f60634f0078583d92b931d5c0eebnethercote  {
20173b526fb4af0f60634f0078583d92b931d5c0eebnethercote    /*
20273b526fb4af0f60634f0078583d92b931d5c0eebnethercote      Read pixels to virtual canvas image then push to image.
20373b526fb4af0f60634f0078583d92b931d5c0eebnethercote    */
20473b526fb4af0f60634f0078583d92b931d5c0eebnethercote    if ((image_info->ping != MagickFalse) && (image_info->number_scenes != 0))
20573b526fb4af0f60634f0078583d92b931d5c0eebnethercote      if (image->scene >= (image_info->scene+image_info->number_scenes-1))
20673b526fb4af0f60634f0078583d92b931d5c0eebnethercote        break;
20773b526fb4af0f60634f0078583d92b931d5c0eebnethercote    status=SetImageExtent(image,image->columns,image->rows,exception);
20873b526fb4af0f60634f0078583d92b931d5c0eebnethercote    if (status == MagickFalse)
20973b526fb4af0f60634f0078583d92b931d5c0eebnethercote      return(DestroyImageList(image));
21073b526fb4af0f60634f0078583d92b931d5c0eebnethercote    switch (image_info->interlace)
21173b526fb4af0f60634f0078583d92b931d5c0eebnethercote    {
21273b526fb4af0f60634f0078583d92b931d5c0eebnethercote      case NoInterlace:
21373b526fb4af0f60634f0078583d92b931d5c0eebnethercote      default:
21473b526fb4af0f60634f0078583d92b931d5c0eebnethercote      {
21573b526fb4af0f60634f0078583d92b931d5c0eebnethercote        /*
21673b526fb4af0f60634f0078583d92b931d5c0eebnethercote          No interlacing:  RGBRGBRGBRGBRGBRGB...
21785b1ac7d3ba74ad66e975a0bfd8b1cb9a9d06bb9bart        */
21885b1ac7d3ba74ad66e975a0bfd8b1cb9a9d06bb9bart        if (scene == 0)
21985b1ac7d3ba74ad66e975a0bfd8b1cb9a9d06bb9bart          {
22085b1ac7d3ba74ad66e975a0bfd8b1cb9a9d06bb9bart            length=GetQuantumExtent(canvas_image,quantum_info,quantum_type);
22185b1ac7d3ba74ad66e975a0bfd8b1cb9a9d06bb9bart            pixels=(const unsigned char *) ReadBlobStream(image,length,
22273b526fb4af0f60634f0078583d92b931d5c0eebnethercote              GetQuantumPixels(quantum_info),&count);
22373b526fb4af0f60634f0078583d92b931d5c0eebnethercote          }
22473b526fb4af0f60634f0078583d92b931d5c0eebnethercote        for (y=0; y < (ssize_t) image->extract_info.height; y++)
22573b526fb4af0f60634f0078583d92b931d5c0eebnethercote        {
22673b526fb4af0f60634f0078583d92b931d5c0eebnethercote          register const Quantum
22773b526fb4af0f60634f0078583d92b931d5c0eebnethercote            *magick_restrict p;
22873b526fb4af0f60634f0078583d92b931d5c0eebnethercote
22973b526fb4af0f60634f0078583d92b931d5c0eebnethercote          register Quantum
23073b526fb4af0f60634f0078583d92b931d5c0eebnethercote            *magick_restrict q;
23173b526fb4af0f60634f0078583d92b931d5c0eebnethercote
23273b526fb4af0f60634f0078583d92b931d5c0eebnethercote          register ssize_t
23373b526fb4af0f60634f0078583d92b931d5c0eebnethercote            x;
23473b526fb4af0f60634f0078583d92b931d5c0eebnethercote
23573b526fb4af0f60634f0078583d92b931d5c0eebnethercote          if (count != (ssize_t) length)
23673b526fb4af0f60634f0078583d92b931d5c0eebnethercote            {
23773b526fb4af0f60634f0078583d92b931d5c0eebnethercote              ThrowFileException(exception,CorruptImageError,
23873b526fb4af0f60634f0078583d92b931d5c0eebnethercote                "UnexpectedEndOfFile",image->filename);
23973b526fb4af0f60634f0078583d92b931d5c0eebnethercote              break;
24073b526fb4af0f60634f0078583d92b931d5c0eebnethercote            }
24173b526fb4af0f60634f0078583d92b931d5c0eebnethercote          q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1,
24273b526fb4af0f60634f0078583d92b931d5c0eebnethercote            exception);
24373b526fb4af0f60634f0078583d92b931d5c0eebnethercote          if (q == (Quantum *) NULL)
24473b526fb4af0f60634f0078583d92b931d5c0eebnethercote            break;
24573b526fb4af0f60634f0078583d92b931d5c0eebnethercote          length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
24673b526fb4af0f60634f0078583d92b931d5c0eebnethercote            quantum_info,quantum_type,pixels,exception);
24773b526fb4af0f60634f0078583d92b931d5c0eebnethercote          if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
24873b526fb4af0f60634f0078583d92b931d5c0eebnethercote            break;
24973b526fb4af0f60634f0078583d92b931d5c0eebnethercote          if (((y-image->extract_info.y) >= 0) &&
25073b526fb4af0f60634f0078583d92b931d5c0eebnethercote              ((y-image->extract_info.y) < (ssize_t) image->rows))
25173b526fb4af0f60634f0078583d92b931d5c0eebnethercote            {
25273b526fb4af0f60634f0078583d92b931d5c0eebnethercote              p=GetVirtualPixels(canvas_image,canvas_image->extract_info.x,0,
25373b526fb4af0f60634f0078583d92b931d5c0eebnethercote                canvas_image->columns,1,exception);
25473b526fb4af0f60634f0078583d92b931d5c0eebnethercote              q=QueueAuthenticPixels(image,0,y-image->extract_info.y,
25573b526fb4af0f60634f0078583d92b931d5c0eebnethercote                image->columns,1,exception);
25673b526fb4af0f60634f0078583d92b931d5c0eebnethercote              if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))
25773b526fb4af0f60634f0078583d92b931d5c0eebnethercote                break;
25873b526fb4af0f60634f0078583d92b931d5c0eebnethercote              for (x=0; x < (ssize_t) image->columns; x++)
25973b526fb4af0f60634f0078583d92b931d5c0eebnethercote              {
26073b526fb4af0f60634f0078583d92b931d5c0eebnethercote                SetPixelRed(image,GetPixelRed(canvas_image,p),q);
26173b526fb4af0f60634f0078583d92b931d5c0eebnethercote                SetPixelGreen(image,GetPixelGreen(canvas_image,p),q);
26273b526fb4af0f60634f0078583d92b931d5c0eebnethercote                SetPixelBlue(image,GetPixelBlue(canvas_image,p),q);
26373b526fb4af0f60634f0078583d92b931d5c0eebnethercote                SetPixelAlpha(image,OpaqueAlpha,q);
26473b526fb4af0f60634f0078583d92b931d5c0eebnethercote                if (image->alpha_trait != UndefinedPixelTrait)
26573b526fb4af0f60634f0078583d92b931d5c0eebnethercote                  SetPixelAlpha(image,GetPixelAlpha(canvas_image,p),q);
26673b526fb4af0f60634f0078583d92b931d5c0eebnethercote                p+=GetPixelChannels(canvas_image);
26773b526fb4af0f60634f0078583d92b931d5c0eebnethercote                q+=GetPixelChannels(image);
26873b526fb4af0f60634f0078583d92b931d5c0eebnethercote              }
26973b526fb4af0f60634f0078583d92b931d5c0eebnethercote              if (SyncAuthenticPixels(image,exception) == MagickFalse)
27073b526fb4af0f60634f0078583d92b931d5c0eebnethercote                break;
27173b526fb4af0f60634f0078583d92b931d5c0eebnethercote            }
27273b526fb4af0f60634f0078583d92b931d5c0eebnethercote          if (image->previous == (Image *) NULL)
27373b526fb4af0f60634f0078583d92b931d5c0eebnethercote            {
27473b526fb4af0f60634f0078583d92b931d5c0eebnethercote              status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,
27573b526fb4af0f60634f0078583d92b931d5c0eebnethercote                image->rows);
27673b526fb4af0f60634f0078583d92b931d5c0eebnethercote              if (status == MagickFalse)
27773b526fb4af0f60634f0078583d92b931d5c0eebnethercote                break;
27873b526fb4af0f60634f0078583d92b931d5c0eebnethercote            }
27973b526fb4af0f60634f0078583d92b931d5c0eebnethercote          pixels=(const unsigned char *) ReadBlobStream(image,length,
28073b526fb4af0f60634f0078583d92b931d5c0eebnethercote            GetQuantumPixels(quantum_info),&count);
28173b526fb4af0f60634f0078583d92b931d5c0eebnethercote        }
28273b526fb4af0f60634f0078583d92b931d5c0eebnethercote        break;
28373b526fb4af0f60634f0078583d92b931d5c0eebnethercote      }
28473b526fb4af0f60634f0078583d92b931d5c0eebnethercote      case LineInterlace:
28573b526fb4af0f60634f0078583d92b931d5c0eebnethercote      {
28673b526fb4af0f60634f0078583d92b931d5c0eebnethercote        static QuantumType
28773b526fb4af0f60634f0078583d92b931d5c0eebnethercote          quantum_types[4] =
28873b526fb4af0f60634f0078583d92b931d5c0eebnethercote          {
28973b526fb4af0f60634f0078583d92b931d5c0eebnethercote            RedQuantum,
29073b526fb4af0f60634f0078583d92b931d5c0eebnethercote            GreenQuantum,
29173b526fb4af0f60634f0078583d92b931d5c0eebnethercote            BlueQuantum,
29273b526fb4af0f60634f0078583d92b931d5c0eebnethercote            AlphaQuantum
29373b526fb4af0f60634f0078583d92b931d5c0eebnethercote          };
29473b526fb4af0f60634f0078583d92b931d5c0eebnethercote
29573b526fb4af0f60634f0078583d92b931d5c0eebnethercote        /*
29673b526fb4af0f60634f0078583d92b931d5c0eebnethercote          Line interlacing:  RRR...GGG...BBB...RRR...GGG...BBB...
29773b526fb4af0f60634f0078583d92b931d5c0eebnethercote        */
29873b526fb4af0f60634f0078583d92b931d5c0eebnethercote        if (LocaleCompare(image_info->magick,"RGBO") == 0)
29973b526fb4af0f60634f0078583d92b931d5c0eebnethercote          quantum_types[3]=OpacityQuantum;
30073b526fb4af0f60634f0078583d92b931d5c0eebnethercote        if (scene == 0)
30173b526fb4af0f60634f0078583d92b931d5c0eebnethercote          {
30273b526fb4af0f60634f0078583d92b931d5c0eebnethercote            length=GetQuantumExtent(canvas_image,quantum_info,RedQuantum);
30373b526fb4af0f60634f0078583d92b931d5c0eebnethercote            pixels=(const unsigned char *) ReadBlobStream(image,length,
30473b526fb4af0f60634f0078583d92b931d5c0eebnethercote              GetQuantumPixels(quantum_info),&count);
30573b526fb4af0f60634f0078583d92b931d5c0eebnethercote          }
30673b526fb4af0f60634f0078583d92b931d5c0eebnethercote        for (y=0; y < (ssize_t) image->extract_info.height; y++)
30773b526fb4af0f60634f0078583d92b931d5c0eebnethercote        {
30873b526fb4af0f60634f0078583d92b931d5c0eebnethercote          register const Quantum
30973b526fb4af0f60634f0078583d92b931d5c0eebnethercote            *magick_restrict p;
31073b526fb4af0f60634f0078583d92b931d5c0eebnethercote
31173b526fb4af0f60634f0078583d92b931d5c0eebnethercote          register Quantum
31273b526fb4af0f60634f0078583d92b931d5c0eebnethercote            *magick_restrict q;
313b5f6f51ebcac183818061bf53427a3e7808ef10dsewardj
31473b526fb4af0f60634f0078583d92b931d5c0eebnethercote          register ssize_t
31573b526fb4af0f60634f0078583d92b931d5c0eebnethercote            x;
31673b526fb4af0f60634f0078583d92b931d5c0eebnethercote
31773b526fb4af0f60634f0078583d92b931d5c0eebnethercote          if (count != (ssize_t) length)
318b5f6f51ebcac183818061bf53427a3e7808ef10dsewardj            {
319b5f6f51ebcac183818061bf53427a3e7808ef10dsewardj              ThrowFileException(exception,CorruptImageError,
32073b526fb4af0f60634f0078583d92b931d5c0eebnethercote                "UnexpectedEndOfFile",image->filename);
321b5f6f51ebcac183818061bf53427a3e7808ef10dsewardj              break;
322b5f6f51ebcac183818061bf53427a3e7808ef10dsewardj            }
32373b526fb4af0f60634f0078583d92b931d5c0eebnethercote          for (i=0; i < (ssize_t) (image->alpha_trait != UndefinedPixelTrait ? 4 : 3); i++)
32473b526fb4af0f60634f0078583d92b931d5c0eebnethercote          {
32573b526fb4af0f60634f0078583d92b931d5c0eebnethercote            quantum_type=quantum_types[i];
32673b526fb4af0f60634f0078583d92b931d5c0eebnethercote            q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1,
32773b526fb4af0f60634f0078583d92b931d5c0eebnethercote              exception);
32873b526fb4af0f60634f0078583d92b931d5c0eebnethercote            if (q == (Quantum *) NULL)
32973b526fb4af0f60634f0078583d92b931d5c0eebnethercote              break;
33073b526fb4af0f60634f0078583d92b931d5c0eebnethercote            length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
33173b526fb4af0f60634f0078583d92b931d5c0eebnethercote              quantum_info,quantum_type,pixels,exception);
332a39ebc8e9f7e1b2cdee6c263a3898677a3296e56tom            if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
333a39ebc8e9f7e1b2cdee6c263a3898677a3296e56tom              break;
33473b526fb4af0f60634f0078583d92b931d5c0eebnethercote            if (((y-image->extract_info.y) >= 0) &&
33573b526fb4af0f60634f0078583d92b931d5c0eebnethercote                ((y-image->extract_info.y) < (ssize_t) image->rows))
33673b526fb4af0f60634f0078583d92b931d5c0eebnethercote              {
33773b526fb4af0f60634f0078583d92b931d5c0eebnethercote                p=GetVirtualPixels(canvas_image,canvas_image->extract_info.x,
33873b526fb4af0f60634f0078583d92b931d5c0eebnethercote                  0,canvas_image->columns,1,exception);
33973b526fb4af0f60634f0078583d92b931d5c0eebnethercote                q=GetAuthenticPixels(image,0,y-image->extract_info.y,
34073b526fb4af0f60634f0078583d92b931d5c0eebnethercote                  image->columns,1,exception);
34173b526fb4af0f60634f0078583d92b931d5c0eebnethercote                if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))
34273b526fb4af0f60634f0078583d92b931d5c0eebnethercote                  break;
34373b526fb4af0f60634f0078583d92b931d5c0eebnethercote                for (x=0; x < (ssize_t) image->columns; x++)
34473b526fb4af0f60634f0078583d92b931d5c0eebnethercote                {
34573b526fb4af0f60634f0078583d92b931d5c0eebnethercote                  switch (quantum_type)
34673b526fb4af0f60634f0078583d92b931d5c0eebnethercote                  {
34773b526fb4af0f60634f0078583d92b931d5c0eebnethercote                    case RedQuantum:
34873b526fb4af0f60634f0078583d92b931d5c0eebnethercote                    {
34973b526fb4af0f60634f0078583d92b931d5c0eebnethercote                      SetPixelRed(image,GetPixelRed(canvas_image,p),q);
35073b526fb4af0f60634f0078583d92b931d5c0eebnethercote                      break;
35173b526fb4af0f60634f0078583d92b931d5c0eebnethercote                    }
35273b526fb4af0f60634f0078583d92b931d5c0eebnethercote                    case GreenQuantum:
35373b526fb4af0f60634f0078583d92b931d5c0eebnethercote                    {
35473b526fb4af0f60634f0078583d92b931d5c0eebnethercote                      SetPixelGreen(image,GetPixelGreen(canvas_image,p),q);
35573b526fb4af0f60634f0078583d92b931d5c0eebnethercote                      break;
35673b526fb4af0f60634f0078583d92b931d5c0eebnethercote                    }
35773b526fb4af0f60634f0078583d92b931d5c0eebnethercote                    case BlueQuantum:
35873b526fb4af0f60634f0078583d92b931d5c0eebnethercote                    {
35973b526fb4af0f60634f0078583d92b931d5c0eebnethercote                      SetPixelBlue(image,GetPixelBlue(canvas_image,p),q);
36073b526fb4af0f60634f0078583d92b931d5c0eebnethercote                      break;
36173b526fb4af0f60634f0078583d92b931d5c0eebnethercote                    }
36273b526fb4af0f60634f0078583d92b931d5c0eebnethercote                    case OpacityQuantum:
36373b526fb4af0f60634f0078583d92b931d5c0eebnethercote                    {
36473b526fb4af0f60634f0078583d92b931d5c0eebnethercote                      SetPixelAlpha(image,GetPixelAlpha(canvas_image,p),q);
36573b526fb4af0f60634f0078583d92b931d5c0eebnethercote                      break;
36673b526fb4af0f60634f0078583d92b931d5c0eebnethercote                    }
36773b526fb4af0f60634f0078583d92b931d5c0eebnethercote                    case AlphaQuantum:
36873b526fb4af0f60634f0078583d92b931d5c0eebnethercote                    {
36973b526fb4af0f60634f0078583d92b931d5c0eebnethercote                      SetPixelAlpha(image,GetPixelAlpha(canvas_image,p),q);
37073b526fb4af0f60634f0078583d92b931d5c0eebnethercote                      break;
37173b526fb4af0f60634f0078583d92b931d5c0eebnethercote                    }
37273b526fb4af0f60634f0078583d92b931d5c0eebnethercote                    default:
37373b526fb4af0f60634f0078583d92b931d5c0eebnethercote                      break;
37473b526fb4af0f60634f0078583d92b931d5c0eebnethercote                  }
37573b526fb4af0f60634f0078583d92b931d5c0eebnethercote                  p+=GetPixelChannels(canvas_image);
37673b526fb4af0f60634f0078583d92b931d5c0eebnethercote                  q+=GetPixelChannels(image);
37773b526fb4af0f60634f0078583d92b931d5c0eebnethercote                }
37873b526fb4af0f60634f0078583d92b931d5c0eebnethercote                if (SyncAuthenticPixels(image,exception) == MagickFalse)
37973b526fb4af0f60634f0078583d92b931d5c0eebnethercote                  break;
38073b526fb4af0f60634f0078583d92b931d5c0eebnethercote              }
38173b526fb4af0f60634f0078583d92b931d5c0eebnethercote            pixels=(const unsigned char *) ReadBlobStream(image,length,
38273b526fb4af0f60634f0078583d92b931d5c0eebnethercote              GetQuantumPixels(quantum_info),&count);
38373b526fb4af0f60634f0078583d92b931d5c0eebnethercote          }
38473b526fb4af0f60634f0078583d92b931d5c0eebnethercote          if (image->previous == (Image *) NULL)
38573b526fb4af0f60634f0078583d92b931d5c0eebnethercote            {
38673b526fb4af0f60634f0078583d92b931d5c0eebnethercote              status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,
38773b526fb4af0f60634f0078583d92b931d5c0eebnethercote                image->rows);
38873b526fb4af0f60634f0078583d92b931d5c0eebnethercote              if (status == MagickFalse)
38973b526fb4af0f60634f0078583d92b931d5c0eebnethercote                break;
39073b526fb4af0f60634f0078583d92b931d5c0eebnethercote            }
39173b526fb4af0f60634f0078583d92b931d5c0eebnethercote        }
39273b526fb4af0f60634f0078583d92b931d5c0eebnethercote        break;
39373b526fb4af0f60634f0078583d92b931d5c0eebnethercote      }
39473b526fb4af0f60634f0078583d92b931d5c0eebnethercote      case PlaneInterlace:
39573b526fb4af0f60634f0078583d92b931d5c0eebnethercote      {
39673b526fb4af0f60634f0078583d92b931d5c0eebnethercote        /*
39773b526fb4af0f60634f0078583d92b931d5c0eebnethercote          Plane interlacing:  RRRRRR...GGGGGG...BBBBBB...
39873b526fb4af0f60634f0078583d92b931d5c0eebnethercote        */
39973b526fb4af0f60634f0078583d92b931d5c0eebnethercote        if (scene == 0)
40073b526fb4af0f60634f0078583d92b931d5c0eebnethercote          {
40173b526fb4af0f60634f0078583d92b931d5c0eebnethercote            length=GetQuantumExtent(canvas_image,quantum_info,RedQuantum);
40273b526fb4af0f60634f0078583d92b931d5c0eebnethercote            pixels=(const unsigned char *) ReadBlobStream(image,length,
40373b526fb4af0f60634f0078583d92b931d5c0eebnethercote              GetQuantumPixels(quantum_info),&count);
40473b526fb4af0f60634f0078583d92b931d5c0eebnethercote          }
40573b526fb4af0f60634f0078583d92b931d5c0eebnethercote        for (y=0; y < (ssize_t) image->extract_info.height; y++)
40673b526fb4af0f60634f0078583d92b931d5c0eebnethercote        {
40773b526fb4af0f60634f0078583d92b931d5c0eebnethercote          register const Quantum
40873b526fb4af0f60634f0078583d92b931d5c0eebnethercote            *magick_restrict p;
40973b526fb4af0f60634f0078583d92b931d5c0eebnethercote
41073b526fb4af0f60634f0078583d92b931d5c0eebnethercote          register Quantum
41173b526fb4af0f60634f0078583d92b931d5c0eebnethercote            *magick_restrict q;
41273b526fb4af0f60634f0078583d92b931d5c0eebnethercote
41373b526fb4af0f60634f0078583d92b931d5c0eebnethercote          register ssize_t
41473b526fb4af0f60634f0078583d92b931d5c0eebnethercote            x;
41573b526fb4af0f60634f0078583d92b931d5c0eebnethercote
41673b526fb4af0f60634f0078583d92b931d5c0eebnethercote          if (count != (ssize_t) length)
41773b526fb4af0f60634f0078583d92b931d5c0eebnethercote            {
418148250b9e89daa1073929da9df5fe6c8896b159ctom              ThrowFileException(exception,CorruptImageError,
419148250b9e89daa1073929da9df5fe6c8896b159ctom                "UnexpectedEndOfFile",image->filename);
42073b526fb4af0f60634f0078583d92b931d5c0eebnethercote              break;
42173b526fb4af0f60634f0078583d92b931d5c0eebnethercote            }
42273b526fb4af0f60634f0078583d92b931d5c0eebnethercote          q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1,
42373b526fb4af0f60634f0078583d92b931d5c0eebnethercote            exception);
42473b526fb4af0f60634f0078583d92b931d5c0eebnethercote          if (q == (Quantum *) NULL)
42573b526fb4af0f60634f0078583d92b931d5c0eebnethercote            break;
42673b526fb4af0f60634f0078583d92b931d5c0eebnethercote          length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
427e7203a89c1e39fb1abcebebf515f62bc4c68b2c4tom            quantum_info,RedQuantum,pixels,exception);
428148250b9e89daa1073929da9df5fe6c8896b159ctom          if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
429148250b9e89daa1073929da9df5fe6c8896b159ctom            break;
430148250b9e89daa1073929da9df5fe6c8896b159ctom          if (((y-image->extract_info.y) >= 0) &&
431148250b9e89daa1073929da9df5fe6c8896b159ctom              ((y-image->extract_info.y) < (ssize_t) image->rows))
432148250b9e89daa1073929da9df5fe6c8896b159ctom            {
433148250b9e89daa1073929da9df5fe6c8896b159ctom              p=GetVirtualPixels(canvas_image,canvas_image->extract_info.x,0,
434148250b9e89daa1073929da9df5fe6c8896b159ctom                canvas_image->columns,1,exception);
435148250b9e89daa1073929da9df5fe6c8896b159ctom              q=GetAuthenticPixels(image,0,y-image->extract_info.y,
436148250b9e89daa1073929da9df5fe6c8896b159ctom                image->columns,1,exception);
437148250b9e89daa1073929da9df5fe6c8896b159ctom              if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))
438148250b9e89daa1073929da9df5fe6c8896b159ctom                break;
439148250b9e89daa1073929da9df5fe6c8896b159ctom              for (x=0; x < (ssize_t) image->columns; x++)
440148250b9e89daa1073929da9df5fe6c8896b159ctom              {
441148250b9e89daa1073929da9df5fe6c8896b159ctom                SetPixelRed(image,GetPixelRed(canvas_image,p),q);
442148250b9e89daa1073929da9df5fe6c8896b159ctom                p+=GetPixelChannels(canvas_image);
443148250b9e89daa1073929da9df5fe6c8896b159ctom                q+=GetPixelChannels(image);
444148250b9e89daa1073929da9df5fe6c8896b159ctom              }
445148250b9e89daa1073929da9df5fe6c8896b159ctom              if (SyncAuthenticPixels(image,exception) == MagickFalse)
446148250b9e89daa1073929da9df5fe6c8896b159ctom                break;
447148250b9e89daa1073929da9df5fe6c8896b159ctom            }
448148250b9e89daa1073929da9df5fe6c8896b159ctom          pixels=(const unsigned char *) ReadBlobStream(image,length,
449148250b9e89daa1073929da9df5fe6c8896b159ctom            GetQuantumPixels(quantum_info),&count);
450148250b9e89daa1073929da9df5fe6c8896b159ctom        }
451148250b9e89daa1073929da9df5fe6c8896b159ctom        if (image->previous == (Image *) NULL)
452148250b9e89daa1073929da9df5fe6c8896b159ctom          {
453148250b9e89daa1073929da9df5fe6c8896b159ctom            status=SetImageProgress(image,LoadImageTag,1,6);
454148250b9e89daa1073929da9df5fe6c8896b159ctom            if (status == MagickFalse)
455148250b9e89daa1073929da9df5fe6c8896b159ctom              break;
456148250b9e89daa1073929da9df5fe6c8896b159ctom          }
457148250b9e89daa1073929da9df5fe6c8896b159ctom        for (y=0; y < (ssize_t) image->extract_info.height; y++)
458148250b9e89daa1073929da9df5fe6c8896b159ctom        {
459148250b9e89daa1073929da9df5fe6c8896b159ctom          register const Quantum
460148250b9e89daa1073929da9df5fe6c8896b159ctom            *magick_restrict p;
461148250b9e89daa1073929da9df5fe6c8896b159ctom
462148250b9e89daa1073929da9df5fe6c8896b159ctom          register Quantum
463148250b9e89daa1073929da9df5fe6c8896b159ctom            *magick_restrict q;
464148250b9e89daa1073929da9df5fe6c8896b159ctom
46586df1559d94314c7385f79ec7f80a7063cb3e1e6sewardj          register ssize_t
46686df1559d94314c7385f79ec7f80a7063cb3e1e6sewardj            x;
46786df1559d94314c7385f79ec7f80a7063cb3e1e6sewardj
46886df1559d94314c7385f79ec7f80a7063cb3e1e6sewardj          if (count != (ssize_t) length)
46986df1559d94314c7385f79ec7f80a7063cb3e1e6sewardj            {
47086df1559d94314c7385f79ec7f80a7063cb3e1e6sewardj              ThrowFileException(exception,CorruptImageError,
471e7203a89c1e39fb1abcebebf515f62bc4c68b2c4tom                "UnexpectedEndOfFile",image->filename);
472e7203a89c1e39fb1abcebebf515f62bc4c68b2c4tom              break;
473e7203a89c1e39fb1abcebebf515f62bc4c68b2c4tom            }
474e7203a89c1e39fb1abcebebf515f62bc4c68b2c4tom          q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1,
475e7203a89c1e39fb1abcebebf515f62bc4c68b2c4tom            exception);
47673b526fb4af0f60634f0078583d92b931d5c0eebnethercote          if (q == (Quantum *) NULL)
47773b526fb4af0f60634f0078583d92b931d5c0eebnethercote            break;
478e7203a89c1e39fb1abcebebf515f62bc4c68b2c4tom          length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
479e7203a89c1e39fb1abcebebf515f62bc4c68b2c4tom            quantum_info,GreenQuantum,pixels,exception);
480e7203a89c1e39fb1abcebebf515f62bc4c68b2c4tom          if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
48173b526fb4af0f60634f0078583d92b931d5c0eebnethercote            break;
48273b526fb4af0f60634f0078583d92b931d5c0eebnethercote          if (((y-image->extract_info.y) >= 0) &&
48373b526fb4af0f60634f0078583d92b931d5c0eebnethercote              ((y-image->extract_info.y) < (ssize_t) image->rows))
48473b526fb4af0f60634f0078583d92b931d5c0eebnethercote            {
48573b526fb4af0f60634f0078583d92b931d5c0eebnethercote              p=GetVirtualPixels(canvas_image,canvas_image->extract_info.x,0,
48673b526fb4af0f60634f0078583d92b931d5c0eebnethercote                canvas_image->columns,1,exception);
48773b526fb4af0f60634f0078583d92b931d5c0eebnethercote              q=GetAuthenticPixels(image,0,y-image->extract_info.y,
48873b526fb4af0f60634f0078583d92b931d5c0eebnethercote                image->columns,1,exception);
48973b526fb4af0f60634f0078583d92b931d5c0eebnethercote              if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))
49073b526fb4af0f60634f0078583d92b931d5c0eebnethercote                break;
49173b526fb4af0f60634f0078583d92b931d5c0eebnethercote              for (x=0; x < (ssize_t) image->columns; x++)
49273b526fb4af0f60634f0078583d92b931d5c0eebnethercote              {
49373b526fb4af0f60634f0078583d92b931d5c0eebnethercote                SetPixelGreen(image,GetPixelGreen(canvas_image,p),q);
49473b526fb4af0f60634f0078583d92b931d5c0eebnethercote                p+=GetPixelChannels(canvas_image);
49573b526fb4af0f60634f0078583d92b931d5c0eebnethercote                q+=GetPixelChannels(image);
49673b526fb4af0f60634f0078583d92b931d5c0eebnethercote              }
49773b526fb4af0f60634f0078583d92b931d5c0eebnethercote              if (SyncAuthenticPixels(image,exception) == MagickFalse)
49873b526fb4af0f60634f0078583d92b931d5c0eebnethercote                break;
49973b526fb4af0f60634f0078583d92b931d5c0eebnethercote           }
50073b526fb4af0f60634f0078583d92b931d5c0eebnethercote          pixels=(const unsigned char *) ReadBlobStream(image,length,
50173b526fb4af0f60634f0078583d92b931d5c0eebnethercote            GetQuantumPixels(quantum_info),&count);
50273b526fb4af0f60634f0078583d92b931d5c0eebnethercote        }
50373b526fb4af0f60634f0078583d92b931d5c0eebnethercote        if (image->previous == (Image *) NULL)
50473b526fb4af0f60634f0078583d92b931d5c0eebnethercote          {
50573b526fb4af0f60634f0078583d92b931d5c0eebnethercote            status=SetImageProgress(image,LoadImageTag,2,6);
50673b526fb4af0f60634f0078583d92b931d5c0eebnethercote            if (status == MagickFalse)
50773b526fb4af0f60634f0078583d92b931d5c0eebnethercote              break;
50873b526fb4af0f60634f0078583d92b931d5c0eebnethercote          }
50973b526fb4af0f60634f0078583d92b931d5c0eebnethercote        for (y=0; y < (ssize_t) image->extract_info.height; y++)
51073b526fb4af0f60634f0078583d92b931d5c0eebnethercote        {
51173b526fb4af0f60634f0078583d92b931d5c0eebnethercote          register const Quantum
51273b526fb4af0f60634f0078583d92b931d5c0eebnethercote            *magick_restrict p;
51373b526fb4af0f60634f0078583d92b931d5c0eebnethercote
51473b526fb4af0f60634f0078583d92b931d5c0eebnethercote          register Quantum
51573b526fb4af0f60634f0078583d92b931d5c0eebnethercote            *magick_restrict q;
51673b526fb4af0f60634f0078583d92b931d5c0eebnethercote
51773b526fb4af0f60634f0078583d92b931d5c0eebnethercote          register ssize_t
51873b526fb4af0f60634f0078583d92b931d5c0eebnethercote            x;
51973b526fb4af0f60634f0078583d92b931d5c0eebnethercote
52073b526fb4af0f60634f0078583d92b931d5c0eebnethercote          if (count != (ssize_t) length)
52173b526fb4af0f60634f0078583d92b931d5c0eebnethercote            {
52273b526fb4af0f60634f0078583d92b931d5c0eebnethercote              ThrowFileException(exception,CorruptImageError,
52373b526fb4af0f60634f0078583d92b931d5c0eebnethercote                "UnexpectedEndOfFile",image->filename);
52473b526fb4af0f60634f0078583d92b931d5c0eebnethercote              break;
52573b526fb4af0f60634f0078583d92b931d5c0eebnethercote            }
52673b526fb4af0f60634f0078583d92b931d5c0eebnethercote          q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1,
52773b526fb4af0f60634f0078583d92b931d5c0eebnethercote            exception);
52873b526fb4af0f60634f0078583d92b931d5c0eebnethercote          if (q == (Quantum *) NULL)
529ca0518df66f8c3375a860f1a55a51f18e2a16c44njn            break;
530ca0518df66f8c3375a860f1a55a51f18e2a16c44njn          length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
531ca0518df66f8c3375a860f1a55a51f18e2a16c44njn            quantum_info,BlueQuantum,pixels,exception);
532ca0518df66f8c3375a860f1a55a51f18e2a16c44njn          if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
533ca0518df66f8c3375a860f1a55a51f18e2a16c44njn            break;
53473b526fb4af0f60634f0078583d92b931d5c0eebnethercote          if (((y-image->extract_info.y) >= 0) &&
53573b526fb4af0f60634f0078583d92b931d5c0eebnethercote              ((y-image->extract_info.y) < (ssize_t) image->rows))
53673b526fb4af0f60634f0078583d92b931d5c0eebnethercote            {
53773b526fb4af0f60634f0078583d92b931d5c0eebnethercote              p=GetVirtualPixels(canvas_image,canvas_image->extract_info.x,0,
53873b526fb4af0f60634f0078583d92b931d5c0eebnethercote                canvas_image->columns,1,exception);
53973b526fb4af0f60634f0078583d92b931d5c0eebnethercote              q=GetAuthenticPixels(image,0,y-image->extract_info.y,
54073b526fb4af0f60634f0078583d92b931d5c0eebnethercote                image->columns,1,exception);
54173b526fb4af0f60634f0078583d92b931d5c0eebnethercote              if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))
54273b526fb4af0f60634f0078583d92b931d5c0eebnethercote                break;
54373b526fb4af0f60634f0078583d92b931d5c0eebnethercote              for (x=0; x < (ssize_t) image->columns; x++)
54473b526fb4af0f60634f0078583d92b931d5c0eebnethercote              {
54573b526fb4af0f60634f0078583d92b931d5c0eebnethercote                SetPixelBlue(image,GetPixelBlue(canvas_image,p),q);
54673b526fb4af0f60634f0078583d92b931d5c0eebnethercote                p+=GetPixelChannels(canvas_image);
54773b526fb4af0f60634f0078583d92b931d5c0eebnethercote                q+=GetPixelChannels(image);
54873b526fb4af0f60634f0078583d92b931d5c0eebnethercote              }
54973b526fb4af0f60634f0078583d92b931d5c0eebnethercote              if (SyncAuthenticPixels(image,exception) == MagickFalse)
55073b526fb4af0f60634f0078583d92b931d5c0eebnethercote                break;
55173b526fb4af0f60634f0078583d92b931d5c0eebnethercote            }
55273b526fb4af0f60634f0078583d92b931d5c0eebnethercote          pixels=(const unsigned char *) ReadBlobStream(image,length,
55373b526fb4af0f60634f0078583d92b931d5c0eebnethercote            GetQuantumPixels(quantum_info),&count);
55473b526fb4af0f60634f0078583d92b931d5c0eebnethercote        }
55573b526fb4af0f60634f0078583d92b931d5c0eebnethercote        if (image->previous == (Image *) NULL)
55673b526fb4af0f60634f0078583d92b931d5c0eebnethercote          {
55773b526fb4af0f60634f0078583d92b931d5c0eebnethercote            status=SetImageProgress(image,LoadImageTag,3,6);
55873b526fb4af0f60634f0078583d92b931d5c0eebnethercote            if (status == MagickFalse)
55973b526fb4af0f60634f0078583d92b931d5c0eebnethercote              break;
56073b526fb4af0f60634f0078583d92b931d5c0eebnethercote          }
56173b526fb4af0f60634f0078583d92b931d5c0eebnethercote        if (image->previous == (Image *) NULL)
56273b526fb4af0f60634f0078583d92b931d5c0eebnethercote          {
56373b526fb4af0f60634f0078583d92b931d5c0eebnethercote            status=SetImageProgress(image,LoadImageTag,4,6);
56473b526fb4af0f60634f0078583d92b931d5c0eebnethercote            if (status == MagickFalse)
56573b526fb4af0f60634f0078583d92b931d5c0eebnethercote              break;
56673b526fb4af0f60634f0078583d92b931d5c0eebnethercote          }
56773b526fb4af0f60634f0078583d92b931d5c0eebnethercote        if (image->alpha_trait != UndefinedPixelTrait)
56873b526fb4af0f60634f0078583d92b931d5c0eebnethercote          {
56973b526fb4af0f60634f0078583d92b931d5c0eebnethercote            for (y=0; y < (ssize_t) image->extract_info.height; y++)
57073b526fb4af0f60634f0078583d92b931d5c0eebnethercote            {
57173b526fb4af0f60634f0078583d92b931d5c0eebnethercote              register const Quantum
57273b526fb4af0f60634f0078583d92b931d5c0eebnethercote                *magick_restrict p;
57373b526fb4af0f60634f0078583d92b931d5c0eebnethercote
57473b526fb4af0f60634f0078583d92b931d5c0eebnethercote              register Quantum
57573b526fb4af0f60634f0078583d92b931d5c0eebnethercote                *magick_restrict q;
57673b526fb4af0f60634f0078583d92b931d5c0eebnethercote
57773b526fb4af0f60634f0078583d92b931d5c0eebnethercote              register ssize_t
57873b526fb4af0f60634f0078583d92b931d5c0eebnethercote                x;
57973b526fb4af0f60634f0078583d92b931d5c0eebnethercote
58073b526fb4af0f60634f0078583d92b931d5c0eebnethercote              if (count != (ssize_t) length)
58173b526fb4af0f60634f0078583d92b931d5c0eebnethercote                {
58273b526fb4af0f60634f0078583d92b931d5c0eebnethercote                  ThrowFileException(exception,CorruptImageError,
58373b526fb4af0f60634f0078583d92b931d5c0eebnethercote                    "UnexpectedEndOfFile",image->filename);
58473b526fb4af0f60634f0078583d92b931d5c0eebnethercote                  break;
58573b526fb4af0f60634f0078583d92b931d5c0eebnethercote                }
58673b526fb4af0f60634f0078583d92b931d5c0eebnethercote              q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1,
58773b526fb4af0f60634f0078583d92b931d5c0eebnethercote                exception);
58873b526fb4af0f60634f0078583d92b931d5c0eebnethercote              if (q == (Quantum *) NULL)
58973b526fb4af0f60634f0078583d92b931d5c0eebnethercote                break;
59073b526fb4af0f60634f0078583d92b931d5c0eebnethercote              length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
59173b526fb4af0f60634f0078583d92b931d5c0eebnethercote                quantum_info,AlphaQuantum,pixels,exception);
59273b526fb4af0f60634f0078583d92b931d5c0eebnethercote              if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
59373b526fb4af0f60634f0078583d92b931d5c0eebnethercote                break;
59473b526fb4af0f60634f0078583d92b931d5c0eebnethercote              if (((y-image->extract_info.y) >= 0) &&
59573b526fb4af0f60634f0078583d92b931d5c0eebnethercote                  ((y-image->extract_info.y) < (ssize_t) image->rows))
59673b526fb4af0f60634f0078583d92b931d5c0eebnethercote                {
59773b526fb4af0f60634f0078583d92b931d5c0eebnethercote                  p=GetVirtualPixels(canvas_image,
59873b526fb4af0f60634f0078583d92b931d5c0eebnethercote                    canvas_image->extract_info.x,0,canvas_image->columns,1,
59973b526fb4af0f60634f0078583d92b931d5c0eebnethercote                    exception);
60073b526fb4af0f60634f0078583d92b931d5c0eebnethercote                  q=GetAuthenticPixels(image,0,y-image->extract_info.y,
60173b526fb4af0f60634f0078583d92b931d5c0eebnethercote                    image->columns,1,exception);
60273b526fb4af0f60634f0078583d92b931d5c0eebnethercote                  if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))
60373b526fb4af0f60634f0078583d92b931d5c0eebnethercote                    break;
60473b526fb4af0f60634f0078583d92b931d5c0eebnethercote                  for (x=0; x < (ssize_t) image->columns; x++)
60573b526fb4af0f60634f0078583d92b931d5c0eebnethercote                  {
60673b526fb4af0f60634f0078583d92b931d5c0eebnethercote                    SetPixelAlpha(image,GetPixelAlpha(canvas_image,p),q);
60773b526fb4af0f60634f0078583d92b931d5c0eebnethercote                    p+=GetPixelChannels(canvas_image);
60873b526fb4af0f60634f0078583d92b931d5c0eebnethercote                    q+=GetPixelChannels(image);
60973b526fb4af0f60634f0078583d92b931d5c0eebnethercote                  }
61073b526fb4af0f60634f0078583d92b931d5c0eebnethercote                  if (SyncAuthenticPixels(image,exception) == MagickFalse)
61173b526fb4af0f60634f0078583d92b931d5c0eebnethercote                    break;
61273b526fb4af0f60634f0078583d92b931d5c0eebnethercote                }
6131aa57373be5343c365ee6b480e205abc16008402tom              pixels=(const unsigned char *) ReadBlobStream(image,length,
6141aa57373be5343c365ee6b480e205abc16008402tom                GetQuantumPixels(quantum_info),&count);
61573b526fb4af0f60634f0078583d92b931d5c0eebnethercote            }
61673b526fb4af0f60634f0078583d92b931d5c0eebnethercote            if (image->previous == (Image *) NULL)
61773b526fb4af0f60634f0078583d92b931d5c0eebnethercote              {
61873b526fb4af0f60634f0078583d92b931d5c0eebnethercote                status=SetImageProgress(image,LoadImageTag,5,6);
61973b526fb4af0f60634f0078583d92b931d5c0eebnethercote                if (status == MagickFalse)
62073b526fb4af0f60634f0078583d92b931d5c0eebnethercote                  break;
62173b526fb4af0f60634f0078583d92b931d5c0eebnethercote              }
62273b526fb4af0f60634f0078583d92b931d5c0eebnethercote          }
62373b526fb4af0f60634f0078583d92b931d5c0eebnethercote        if (image->previous == (Image *) NULL)
62473b526fb4af0f60634f0078583d92b931d5c0eebnethercote          {
62573b526fb4af0f60634f0078583d92b931d5c0eebnethercote            status=SetImageProgress(image,LoadImageTag,6,6);
62673b526fb4af0f60634f0078583d92b931d5c0eebnethercote            if (status == MagickFalse)
62773b526fb4af0f60634f0078583d92b931d5c0eebnethercote              break;
62873b526fb4af0f60634f0078583d92b931d5c0eebnethercote          }
62973b526fb4af0f60634f0078583d92b931d5c0eebnethercote        break;
63073b526fb4af0f60634f0078583d92b931d5c0eebnethercote      }
63173b526fb4af0f60634f0078583d92b931d5c0eebnethercote      case PartitionInterlace:
63273b526fb4af0f60634f0078583d92b931d5c0eebnethercote      {
63373b526fb4af0f60634f0078583d92b931d5c0eebnethercote        /*
63473b526fb4af0f60634f0078583d92b931d5c0eebnethercote          Partition interlacing:  RRRRRR..., GGGGGG..., BBBBBB...
63573b526fb4af0f60634f0078583d92b931d5c0eebnethercote        */
63673b526fb4af0f60634f0078583d92b931d5c0eebnethercote        AppendImageFormat("R",image->filename);
63773b526fb4af0f60634f0078583d92b931d5c0eebnethercote        status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
63873b526fb4af0f60634f0078583d92b931d5c0eebnethercote        if (status == MagickFalse)
63973b526fb4af0f60634f0078583d92b931d5c0eebnethercote          {
64073b526fb4af0f60634f0078583d92b931d5c0eebnethercote            canvas_image=DestroyImageList(canvas_image);
64173b526fb4af0f60634f0078583d92b931d5c0eebnethercote            image=DestroyImageList(image);
64273b526fb4af0f60634f0078583d92b931d5c0eebnethercote            return((Image *) NULL);
64373b526fb4af0f60634f0078583d92b931d5c0eebnethercote          }
64473b526fb4af0f60634f0078583d92b931d5c0eebnethercote        if (DiscardBlobBytes(image,image->offset) == MagickFalse)
64573b526fb4af0f60634f0078583d92b931d5c0eebnethercote          ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile",
64673b526fb4af0f60634f0078583d92b931d5c0eebnethercote            image->filename);
64773b526fb4af0f60634f0078583d92b931d5c0eebnethercote        length=GetQuantumExtent(canvas_image,quantum_info,RedQuantum);
64873b526fb4af0f60634f0078583d92b931d5c0eebnethercote        for (i=0; i < (ssize_t) scene; i++)
64973b526fb4af0f60634f0078583d92b931d5c0eebnethercote          for (y=0; y < (ssize_t) image->extract_info.height; y++)
65073b526fb4af0f60634f0078583d92b931d5c0eebnethercote          {
65173b526fb4af0f60634f0078583d92b931d5c0eebnethercote            pixels=(const unsigned char *) ReadBlobStream(image,length,
65273b526fb4af0f60634f0078583d92b931d5c0eebnethercote              GetQuantumPixels(quantum_info),&count);
65373b526fb4af0f60634f0078583d92b931d5c0eebnethercote            if (count != (ssize_t) length)
65473b526fb4af0f60634f0078583d92b931d5c0eebnethercote              {
65573b526fb4af0f60634f0078583d92b931d5c0eebnethercote                ThrowFileException(exception,CorruptImageError,
65673b526fb4af0f60634f0078583d92b931d5c0eebnethercote                  "UnexpectedEndOfFile",image->filename);
65773b526fb4af0f60634f0078583d92b931d5c0eebnethercote                break;
65873b526fb4af0f60634f0078583d92b931d5c0eebnethercote              }
65973b526fb4af0f60634f0078583d92b931d5c0eebnethercote          }
66073b526fb4af0f60634f0078583d92b931d5c0eebnethercote        pixels=(const unsigned char *) ReadBlobStream(image,length,
66173b526fb4af0f60634f0078583d92b931d5c0eebnethercote          GetQuantumPixels(quantum_info),&count);
66273b526fb4af0f60634f0078583d92b931d5c0eebnethercote        for (y=0; y < (ssize_t) image->extract_info.height; y++)
66373b526fb4af0f60634f0078583d92b931d5c0eebnethercote        {
66473b526fb4af0f60634f0078583d92b931d5c0eebnethercote          register const Quantum
66573b526fb4af0f60634f0078583d92b931d5c0eebnethercote            *magick_restrict p;
66673b526fb4af0f60634f0078583d92b931d5c0eebnethercote
66773b526fb4af0f60634f0078583d92b931d5c0eebnethercote          register Quantum
66873b526fb4af0f60634f0078583d92b931d5c0eebnethercote            *magick_restrict q;
66973b526fb4af0f60634f0078583d92b931d5c0eebnethercote
67073b526fb4af0f60634f0078583d92b931d5c0eebnethercote          register ssize_t
67173b526fb4af0f60634f0078583d92b931d5c0eebnethercote            x;
67273b526fb4af0f60634f0078583d92b931d5c0eebnethercote
67373b526fb4af0f60634f0078583d92b931d5c0eebnethercote          if (count != (ssize_t) length)
67473b526fb4af0f60634f0078583d92b931d5c0eebnethercote            {
67573b526fb4af0f60634f0078583d92b931d5c0eebnethercote              ThrowFileException(exception,CorruptImageError,
67673b526fb4af0f60634f0078583d92b931d5c0eebnethercote                "UnexpectedEndOfFile",image->filename);
67773b526fb4af0f60634f0078583d92b931d5c0eebnethercote              break;
67873b526fb4af0f60634f0078583d92b931d5c0eebnethercote            }
67973b526fb4af0f60634f0078583d92b931d5c0eebnethercote          q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1,
68073b526fb4af0f60634f0078583d92b931d5c0eebnethercote            exception);
68173b526fb4af0f60634f0078583d92b931d5c0eebnethercote          if (q == (Quantum *) NULL)
68273b526fb4af0f60634f0078583d92b931d5c0eebnethercote            break;
68373b526fb4af0f60634f0078583d92b931d5c0eebnethercote          length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
68473b526fb4af0f60634f0078583d92b931d5c0eebnethercote            quantum_info,RedQuantum,pixels,exception);
68573b526fb4af0f60634f0078583d92b931d5c0eebnethercote          if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
68673b526fb4af0f60634f0078583d92b931d5c0eebnethercote            break;
68773b526fb4af0f60634f0078583d92b931d5c0eebnethercote          if (((y-image->extract_info.y) >= 0) &&
68873b526fb4af0f60634f0078583d92b931d5c0eebnethercote              ((y-image->extract_info.y) < (ssize_t) image->rows))
68973b526fb4af0f60634f0078583d92b931d5c0eebnethercote            {
69073b526fb4af0f60634f0078583d92b931d5c0eebnethercote              p=GetVirtualPixels(canvas_image,canvas_image->extract_info.x,0,
69173b526fb4af0f60634f0078583d92b931d5c0eebnethercote                canvas_image->columns,1,exception);
69273b526fb4af0f60634f0078583d92b931d5c0eebnethercote              q=GetAuthenticPixels(image,0,y-image->extract_info.y,
69373b526fb4af0f60634f0078583d92b931d5c0eebnethercote                image->columns,1,exception);
69473b526fb4af0f60634f0078583d92b931d5c0eebnethercote              if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))
69573b526fb4af0f60634f0078583d92b931d5c0eebnethercote                break;
69673b526fb4af0f60634f0078583d92b931d5c0eebnethercote              for (x=0; x < (ssize_t) image->columns; x++)
69773b526fb4af0f60634f0078583d92b931d5c0eebnethercote              {
69873b526fb4af0f60634f0078583d92b931d5c0eebnethercote                SetPixelRed(image,GetPixelRed(canvas_image,p),q);
69973b526fb4af0f60634f0078583d92b931d5c0eebnethercote                p+=GetPixelChannels(canvas_image);
70073b526fb4af0f60634f0078583d92b931d5c0eebnethercote                q+=GetPixelChannels(image);
70173b526fb4af0f60634f0078583d92b931d5c0eebnethercote              }
70273b526fb4af0f60634f0078583d92b931d5c0eebnethercote              if (SyncAuthenticPixels(image,exception) == MagickFalse)
70373b526fb4af0f60634f0078583d92b931d5c0eebnethercote                break;
70473b526fb4af0f60634f0078583d92b931d5c0eebnethercote            }
70573b526fb4af0f60634f0078583d92b931d5c0eebnethercote          pixels=(const unsigned char *) ReadBlobStream(image,length,
70673b526fb4af0f60634f0078583d92b931d5c0eebnethercote            GetQuantumPixels(quantum_info),&count);
70773b526fb4af0f60634f0078583d92b931d5c0eebnethercote        }
70873b526fb4af0f60634f0078583d92b931d5c0eebnethercote        if (image->previous == (Image *) NULL)
70973b526fb4af0f60634f0078583d92b931d5c0eebnethercote          {
71073b526fb4af0f60634f0078583d92b931d5c0eebnethercote            status=SetImageProgress(image,LoadImageTag,1,5);
71173b526fb4af0f60634f0078583d92b931d5c0eebnethercote            if (status == MagickFalse)
71273b526fb4af0f60634f0078583d92b931d5c0eebnethercote              break;
71373b526fb4af0f60634f0078583d92b931d5c0eebnethercote          }
71473b526fb4af0f60634f0078583d92b931d5c0eebnethercote        (void) CloseBlob(image);
71573b526fb4af0f60634f0078583d92b931d5c0eebnethercote        AppendImageFormat("G",image->filename);
71673b526fb4af0f60634f0078583d92b931d5c0eebnethercote        status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
71773b526fb4af0f60634f0078583d92b931d5c0eebnethercote        if (status == MagickFalse)
71873b526fb4af0f60634f0078583d92b931d5c0eebnethercote          {
71973b526fb4af0f60634f0078583d92b931d5c0eebnethercote            canvas_image=DestroyImageList(canvas_image);
72073b526fb4af0f60634f0078583d92b931d5c0eebnethercote            image=DestroyImageList(image);
72173b526fb4af0f60634f0078583d92b931d5c0eebnethercote            return((Image *) NULL);
72273b526fb4af0f60634f0078583d92b931d5c0eebnethercote          }
72373b526fb4af0f60634f0078583d92b931d5c0eebnethercote        length=GetQuantumExtent(canvas_image,quantum_info,GreenQuantum);
72473b526fb4af0f60634f0078583d92b931d5c0eebnethercote        for (i=0; i < (ssize_t) scene; i++)
72573b526fb4af0f60634f0078583d92b931d5c0eebnethercote          for (y=0; y < (ssize_t) image->extract_info.height; y++)
72673b526fb4af0f60634f0078583d92b931d5c0eebnethercote          {
72773b526fb4af0f60634f0078583d92b931d5c0eebnethercote            pixels=(const unsigned char *) ReadBlobStream(image,length,
72873b526fb4af0f60634f0078583d92b931d5c0eebnethercote              GetQuantumPixels(quantum_info),&count);
72973b526fb4af0f60634f0078583d92b931d5c0eebnethercote            if (count != (ssize_t) length)
73073b526fb4af0f60634f0078583d92b931d5c0eebnethercote              {
73173b526fb4af0f60634f0078583d92b931d5c0eebnethercote                ThrowFileException(exception,CorruptImageError,
73273b526fb4af0f60634f0078583d92b931d5c0eebnethercote                  "UnexpectedEndOfFile",image->filename);
73373b526fb4af0f60634f0078583d92b931d5c0eebnethercote                break;
73473b526fb4af0f60634f0078583d92b931d5c0eebnethercote              }
73573b526fb4af0f60634f0078583d92b931d5c0eebnethercote          }
73673b526fb4af0f60634f0078583d92b931d5c0eebnethercote        pixels=(const unsigned char *) ReadBlobStream(image,length,
73773b526fb4af0f60634f0078583d92b931d5c0eebnethercote          GetQuantumPixels(quantum_info),&count);
73873b526fb4af0f60634f0078583d92b931d5c0eebnethercote        for (y=0; y < (ssize_t) image->extract_info.height; y++)
73973b526fb4af0f60634f0078583d92b931d5c0eebnethercote        {
74073b526fb4af0f60634f0078583d92b931d5c0eebnethercote          register const Quantum
74173b526fb4af0f60634f0078583d92b931d5c0eebnethercote            *magick_restrict p;
74273b526fb4af0f60634f0078583d92b931d5c0eebnethercote
74373b526fb4af0f60634f0078583d92b931d5c0eebnethercote          register Quantum
74473b526fb4af0f60634f0078583d92b931d5c0eebnethercote            *magick_restrict q;
74573b526fb4af0f60634f0078583d92b931d5c0eebnethercote
74673b526fb4af0f60634f0078583d92b931d5c0eebnethercote          register ssize_t
74773b526fb4af0f60634f0078583d92b931d5c0eebnethercote            x;
74873b526fb4af0f60634f0078583d92b931d5c0eebnethercote
74973b526fb4af0f60634f0078583d92b931d5c0eebnethercote          if (count != (ssize_t) length)
75073b526fb4af0f60634f0078583d92b931d5c0eebnethercote            {
75173b526fb4af0f60634f0078583d92b931d5c0eebnethercote              ThrowFileException(exception,CorruptImageError,
75273b526fb4af0f60634f0078583d92b931d5c0eebnethercote                "UnexpectedEndOfFile",image->filename);
75373b526fb4af0f60634f0078583d92b931d5c0eebnethercote              break;
75473b526fb4af0f60634f0078583d92b931d5c0eebnethercote            }
75573b526fb4af0f60634f0078583d92b931d5c0eebnethercote          q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1,
75673b526fb4af0f60634f0078583d92b931d5c0eebnethercote            exception);
75773b526fb4af0f60634f0078583d92b931d5c0eebnethercote          if (q == (Quantum *) NULL)
75873b526fb4af0f60634f0078583d92b931d5c0eebnethercote            break;
75973b526fb4af0f60634f0078583d92b931d5c0eebnethercote          length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
76073b526fb4af0f60634f0078583d92b931d5c0eebnethercote            quantum_info,GreenQuantum,pixels,exception);
76173b526fb4af0f60634f0078583d92b931d5c0eebnethercote          if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
76273b526fb4af0f60634f0078583d92b931d5c0eebnethercote            break;
76373b526fb4af0f60634f0078583d92b931d5c0eebnethercote          if (((y-image->extract_info.y) >= 0) &&
76473b526fb4af0f60634f0078583d92b931d5c0eebnethercote              ((y-image->extract_info.y) < (ssize_t) image->rows))
76573b526fb4af0f60634f0078583d92b931d5c0eebnethercote            {
76673b526fb4af0f60634f0078583d92b931d5c0eebnethercote              p=GetVirtualPixels(canvas_image,canvas_image->extract_info.x,0,
76773b526fb4af0f60634f0078583d92b931d5c0eebnethercote                canvas_image->columns,1,exception);
76873b526fb4af0f60634f0078583d92b931d5c0eebnethercote              q=GetAuthenticPixels(image,0,y-image->extract_info.y,
76973b526fb4af0f60634f0078583d92b931d5c0eebnethercote                image->columns,1,exception);
77073b526fb4af0f60634f0078583d92b931d5c0eebnethercote              if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))
77173b526fb4af0f60634f0078583d92b931d5c0eebnethercote                break;
77273b526fb4af0f60634f0078583d92b931d5c0eebnethercote              for (x=0; x < (ssize_t) image->columns; x++)
77373b526fb4af0f60634f0078583d92b931d5c0eebnethercote              {
77473b526fb4af0f60634f0078583d92b931d5c0eebnethercote                SetPixelGreen(image,GetPixelGreen(canvas_image,p),q);
77573b526fb4af0f60634f0078583d92b931d5c0eebnethercote                p+=GetPixelChannels(canvas_image);
77673b526fb4af0f60634f0078583d92b931d5c0eebnethercote                q+=GetPixelChannels(image);
77773b526fb4af0f60634f0078583d92b931d5c0eebnethercote              }
77873b526fb4af0f60634f0078583d92b931d5c0eebnethercote              if (SyncAuthenticPixels(image,exception) == MagickFalse)
77973b526fb4af0f60634f0078583d92b931d5c0eebnethercote                break;
78073b526fb4af0f60634f0078583d92b931d5c0eebnethercote           }
78173b526fb4af0f60634f0078583d92b931d5c0eebnethercote          pixels=(const unsigned char *) ReadBlobStream(image,length,
78273b526fb4af0f60634f0078583d92b931d5c0eebnethercote            GetQuantumPixels(quantum_info),&count);
78373b526fb4af0f60634f0078583d92b931d5c0eebnethercote        }
78473b526fb4af0f60634f0078583d92b931d5c0eebnethercote        if (image->previous == (Image *) NULL)
78573b526fb4af0f60634f0078583d92b931d5c0eebnethercote          {
78673b526fb4af0f60634f0078583d92b931d5c0eebnethercote            status=SetImageProgress(image,LoadImageTag,2,5);
78773b526fb4af0f60634f0078583d92b931d5c0eebnethercote            if (status == MagickFalse)
78873b526fb4af0f60634f0078583d92b931d5c0eebnethercote              break;
78973b526fb4af0f60634f0078583d92b931d5c0eebnethercote          }
79073b526fb4af0f60634f0078583d92b931d5c0eebnethercote        (void) CloseBlob(image);
79173b526fb4af0f60634f0078583d92b931d5c0eebnethercote        AppendImageFormat("B",image->filename);
79273b526fb4af0f60634f0078583d92b931d5c0eebnethercote        status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
79373b526fb4af0f60634f0078583d92b931d5c0eebnethercote        if (status == MagickFalse)
79473b526fb4af0f60634f0078583d92b931d5c0eebnethercote          {
79573b526fb4af0f60634f0078583d92b931d5c0eebnethercote            canvas_image=DestroyImageList(canvas_image);
79673b526fb4af0f60634f0078583d92b931d5c0eebnethercote            image=DestroyImageList(image);
79773b526fb4af0f60634f0078583d92b931d5c0eebnethercote            return((Image *) NULL);
79873b526fb4af0f60634f0078583d92b931d5c0eebnethercote          }
79973b526fb4af0f60634f0078583d92b931d5c0eebnethercote        length=GetQuantumExtent(canvas_image,quantum_info,BlueQuantum);
8001aa57373be5343c365ee6b480e205abc16008402tom        for (i=0; i < (ssize_t) scene; i++)
8011aa57373be5343c365ee6b480e205abc16008402tom          for (y=0; y < (ssize_t) image->extract_info.height; y++)
8021aa57373be5343c365ee6b480e205abc16008402tom          {
8031aa57373be5343c365ee6b480e205abc16008402tom            pixels=(const unsigned char *) ReadBlobStream(image,length,
8041aa57373be5343c365ee6b480e205abc16008402tom              GetQuantumPixels(quantum_info),&count);
8051aa57373be5343c365ee6b480e205abc16008402tom            if (count != (ssize_t) length)
8061aa57373be5343c365ee6b480e205abc16008402tom              {
8071aa57373be5343c365ee6b480e205abc16008402tom                ThrowFileException(exception,CorruptImageError,
8081aa57373be5343c365ee6b480e205abc16008402tom                  "UnexpectedEndOfFile",image->filename);
8091aa57373be5343c365ee6b480e205abc16008402tom                break;
8101aa57373be5343c365ee6b480e205abc16008402tom              }
8111aa57373be5343c365ee6b480e205abc16008402tom          }
8121aa57373be5343c365ee6b480e205abc16008402tom        pixels=(const unsigned char *) ReadBlobStream(image,length,
8131aa57373be5343c365ee6b480e205abc16008402tom          GetQuantumPixels(quantum_info),&count);
8141aa57373be5343c365ee6b480e205abc16008402tom        for (y=0; y < (ssize_t) image->extract_info.height; y++)
8151aa57373be5343c365ee6b480e205abc16008402tom        {
8161aa57373be5343c365ee6b480e205abc16008402tom          register const Quantum
8171aa57373be5343c365ee6b480e205abc16008402tom            *magick_restrict p;
8181aa57373be5343c365ee6b480e205abc16008402tom
8191aa57373be5343c365ee6b480e205abc16008402tom          register Quantum
8201aa57373be5343c365ee6b480e205abc16008402tom            *magick_restrict q;
8211aa57373be5343c365ee6b480e205abc16008402tom
8221aa57373be5343c365ee6b480e205abc16008402tom          register ssize_t
8231aa57373be5343c365ee6b480e205abc16008402tom            x;
8241aa57373be5343c365ee6b480e205abc16008402tom
8251aa57373be5343c365ee6b480e205abc16008402tom          if (count != (ssize_t) length)
8261aa57373be5343c365ee6b480e205abc16008402tom            {
8271aa57373be5343c365ee6b480e205abc16008402tom              ThrowFileException(exception,CorruptImageError,
8281aa57373be5343c365ee6b480e205abc16008402tom                "UnexpectedEndOfFile",image->filename);
8291aa57373be5343c365ee6b480e205abc16008402tom              break;
8301aa57373be5343c365ee6b480e205abc16008402tom            }
8311aa57373be5343c365ee6b480e205abc16008402tom          q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1,
8321aa57373be5343c365ee6b480e205abc16008402tom            exception);
8331aa57373be5343c365ee6b480e205abc16008402tom          if (q == (Quantum *) NULL)
8341aa57373be5343c365ee6b480e205abc16008402tom            break;
8351aa57373be5343c365ee6b480e205abc16008402tom          length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
8361aa57373be5343c365ee6b480e205abc16008402tom            quantum_info,BlueQuantum,pixels,exception);
8371aa57373be5343c365ee6b480e205abc16008402tom          if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
8381aa57373be5343c365ee6b480e205abc16008402tom            break;
8391aa57373be5343c365ee6b480e205abc16008402tom          if (((y-image->extract_info.y) >= 0) &&
8401aa57373be5343c365ee6b480e205abc16008402tom              ((y-image->extract_info.y) < (ssize_t) image->rows))
8411aa57373be5343c365ee6b480e205abc16008402tom            {
8421aa57373be5343c365ee6b480e205abc16008402tom              p=GetVirtualPixels(canvas_image,canvas_image->extract_info.x,0,
8431aa57373be5343c365ee6b480e205abc16008402tom                canvas_image->columns,1,exception);
8441aa57373be5343c365ee6b480e205abc16008402tom              q=GetAuthenticPixels(image,0,y-image->extract_info.y,
8451aa57373be5343c365ee6b480e205abc16008402tom                image->columns,1,exception);
8461aa57373be5343c365ee6b480e205abc16008402tom              if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))
8471aa57373be5343c365ee6b480e205abc16008402tom                break;
8481aa57373be5343c365ee6b480e205abc16008402tom              for (x=0; x < (ssize_t) image->columns; x++)
8491aa57373be5343c365ee6b480e205abc16008402tom              {
8501aa57373be5343c365ee6b480e205abc16008402tom                SetPixelBlue(image,GetPixelBlue(canvas_image,p),q);
8511aa57373be5343c365ee6b480e205abc16008402tom                p+=GetPixelChannels(canvas_image);
8521aa57373be5343c365ee6b480e205abc16008402tom                q+=GetPixelChannels(image);
8531aa57373be5343c365ee6b480e205abc16008402tom              }
8541aa57373be5343c365ee6b480e205abc16008402tom              if (SyncAuthenticPixels(image,exception) == MagickFalse)
8551aa57373be5343c365ee6b480e205abc16008402tom                break;
8561aa57373be5343c365ee6b480e205abc16008402tom           }
8571aa57373be5343c365ee6b480e205abc16008402tom          pixels=(const unsigned char *) ReadBlobStream(image,length,
8581aa57373be5343c365ee6b480e205abc16008402tom            GetQuantumPixels(quantum_info),&count);
8591aa57373be5343c365ee6b480e205abc16008402tom        }
8601aa57373be5343c365ee6b480e205abc16008402tom        if (image->previous == (Image *) NULL)
8611aa57373be5343c365ee6b480e205abc16008402tom          {
8621aa57373be5343c365ee6b480e205abc16008402tom            status=SetImageProgress(image,LoadImageTag,3,5);
8631aa57373be5343c365ee6b480e205abc16008402tom            if (status == MagickFalse)
8641aa57373be5343c365ee6b480e205abc16008402tom              break;
8651aa57373be5343c365ee6b480e205abc16008402tom          }
8661aa57373be5343c365ee6b480e205abc16008402tom        if (image->alpha_trait != UndefinedPixelTrait)
86773b526fb4af0f60634f0078583d92b931d5c0eebnethercote          {
86873b526fb4af0f60634f0078583d92b931d5c0eebnethercote            (void) CloseBlob(image);
86973b526fb4af0f60634f0078583d92b931d5c0eebnethercote            AppendImageFormat("A",image->filename);
87073b526fb4af0f60634f0078583d92b931d5c0eebnethercote            status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
87173b526fb4af0f60634f0078583d92b931d5c0eebnethercote            if (status == MagickFalse)
87273b526fb4af0f60634f0078583d92b931d5c0eebnethercote              {
87373b526fb4af0f60634f0078583d92b931d5c0eebnethercote                canvas_image=DestroyImageList(canvas_image);
87473b526fb4af0f60634f0078583d92b931d5c0eebnethercote                image=DestroyImageList(image);
87573b526fb4af0f60634f0078583d92b931d5c0eebnethercote                return((Image *) NULL);
87673b526fb4af0f60634f0078583d92b931d5c0eebnethercote              }
87773b526fb4af0f60634f0078583d92b931d5c0eebnethercote            length=GetQuantumExtent(canvas_image,quantum_info,AlphaQuantum);
87873b526fb4af0f60634f0078583d92b931d5c0eebnethercote            for (i=0; i < (ssize_t) scene; i++)
87973b526fb4af0f60634f0078583d92b931d5c0eebnethercote              for (y=0; y < (ssize_t) image->extract_info.height; y++)
88073b526fb4af0f60634f0078583d92b931d5c0eebnethercote              {
88173b526fb4af0f60634f0078583d92b931d5c0eebnethercote                pixels=(const unsigned char *) ReadBlobStream(image,length,
88273b526fb4af0f60634f0078583d92b931d5c0eebnethercote                  GetQuantumPixels(quantum_info),&count);
88373b526fb4af0f60634f0078583d92b931d5c0eebnethercote                if (count != (ssize_t) length)
88473b526fb4af0f60634f0078583d92b931d5c0eebnethercote                  {
88573b526fb4af0f60634f0078583d92b931d5c0eebnethercote                    ThrowFileException(exception,CorruptImageError,
88673b526fb4af0f60634f0078583d92b931d5c0eebnethercote                      "UnexpectedEndOfFile",image->filename);
88773b526fb4af0f60634f0078583d92b931d5c0eebnethercote                    break;
88873b526fb4af0f60634f0078583d92b931d5c0eebnethercote                  }
88973b526fb4af0f60634f0078583d92b931d5c0eebnethercote              }
89073b526fb4af0f60634f0078583d92b931d5c0eebnethercote            pixels=(const unsigned char *) ReadBlobStream(image,length,
89173b526fb4af0f60634f0078583d92b931d5c0eebnethercote              GetQuantumPixels(quantum_info),&count);
89273b526fb4af0f60634f0078583d92b931d5c0eebnethercote            for (y=0; y < (ssize_t) image->extract_info.height; y++)
89373b526fb4af0f60634f0078583d92b931d5c0eebnethercote            {
89473b526fb4af0f60634f0078583d92b931d5c0eebnethercote              register const Quantum
89573b526fb4af0f60634f0078583d92b931d5c0eebnethercote                *magick_restrict p;
89673b526fb4af0f60634f0078583d92b931d5c0eebnethercote
89773b526fb4af0f60634f0078583d92b931d5c0eebnethercote              register Quantum
89873b526fb4af0f60634f0078583d92b931d5c0eebnethercote                *magick_restrict q;
89973b526fb4af0f60634f0078583d92b931d5c0eebnethercote
90073b526fb4af0f60634f0078583d92b931d5c0eebnethercote              register ssize_t
90173b526fb4af0f60634f0078583d92b931d5c0eebnethercote                x;
90273b526fb4af0f60634f0078583d92b931d5c0eebnethercote
90373b526fb4af0f60634f0078583d92b931d5c0eebnethercote              if (count != (ssize_t) length)
90473b526fb4af0f60634f0078583d92b931d5c0eebnethercote                {
90573b526fb4af0f60634f0078583d92b931d5c0eebnethercote                  ThrowFileException(exception,CorruptImageError,
90673b526fb4af0f60634f0078583d92b931d5c0eebnethercote                    "UnexpectedEndOfFile",image->filename);
90773b526fb4af0f60634f0078583d92b931d5c0eebnethercote                  break;
90873b526fb4af0f60634f0078583d92b931d5c0eebnethercote                }
90973b526fb4af0f60634f0078583d92b931d5c0eebnethercote              q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1,
91073b526fb4af0f60634f0078583d92b931d5c0eebnethercote                exception);
91173b526fb4af0f60634f0078583d92b931d5c0eebnethercote              if (q == (Quantum *) NULL)
91273b526fb4af0f60634f0078583d92b931d5c0eebnethercote                break;
91373b526fb4af0f60634f0078583d92b931d5c0eebnethercote              length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
91473b526fb4af0f60634f0078583d92b931d5c0eebnethercote                quantum_info,BlueQuantum,pixels,exception);
91573b526fb4af0f60634f0078583d92b931d5c0eebnethercote              if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
91673b526fb4af0f60634f0078583d92b931d5c0eebnethercote                break;
91773b526fb4af0f60634f0078583d92b931d5c0eebnethercote              if (((y-image->extract_info.y) >= 0) &&
91873b526fb4af0f60634f0078583d92b931d5c0eebnethercote                  ((y-image->extract_info.y) < (ssize_t) image->rows))
91973b526fb4af0f60634f0078583d92b931d5c0eebnethercote                {
92073b526fb4af0f60634f0078583d92b931d5c0eebnethercote                  p=GetVirtualPixels(canvas_image,canvas_image->extract_info.x,
92173b526fb4af0f60634f0078583d92b931d5c0eebnethercote                    0,canvas_image->columns,1,exception);
92273b526fb4af0f60634f0078583d92b931d5c0eebnethercote                  q=GetAuthenticPixels(image,0,y-image->extract_info.y,
92373b526fb4af0f60634f0078583d92b931d5c0eebnethercote                    image->columns,1,exception);
92473b526fb4af0f60634f0078583d92b931d5c0eebnethercote                  if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))
92573b526fb4af0f60634f0078583d92b931d5c0eebnethercote                    break;
92673b526fb4af0f60634f0078583d92b931d5c0eebnethercote                  for (x=0; x < (ssize_t) image->columns; x++)
92773b526fb4af0f60634f0078583d92b931d5c0eebnethercote                  {
92873b526fb4af0f60634f0078583d92b931d5c0eebnethercote                    SetPixelAlpha(image,GetPixelAlpha(canvas_image,p),q);
92973b526fb4af0f60634f0078583d92b931d5c0eebnethercote                    p+=GetPixelChannels(canvas_image);
93073b526fb4af0f60634f0078583d92b931d5c0eebnethercote                    q+=GetPixelChannels(image);
93173b526fb4af0f60634f0078583d92b931d5c0eebnethercote                  }
93273b526fb4af0f60634f0078583d92b931d5c0eebnethercote                  if (SyncAuthenticPixels(image,exception) == MagickFalse)
93373b526fb4af0f60634f0078583d92b931d5c0eebnethercote                    break;
93473b526fb4af0f60634f0078583d92b931d5c0eebnethercote               }
93573b526fb4af0f60634f0078583d92b931d5c0eebnethercote              pixels=(const unsigned char *) ReadBlobStream(image,length,
93673b526fb4af0f60634f0078583d92b931d5c0eebnethercote                GetQuantumPixels(quantum_info),&count);
93773b526fb4af0f60634f0078583d92b931d5c0eebnethercote            }
93873b526fb4af0f60634f0078583d92b931d5c0eebnethercote            if (image->previous == (Image *) NULL)
93973b526fb4af0f60634f0078583d92b931d5c0eebnethercote              {
94073b526fb4af0f60634f0078583d92b931d5c0eebnethercote                status=SetImageProgress(image,LoadImageTag,4,5);
94173b526fb4af0f60634f0078583d92b931d5c0eebnethercote                if (status == MagickFalse)
94240e735834f172bd304ead1fa7e5e31f9e455dc24njn                  break;
94373b526fb4af0f60634f0078583d92b931d5c0eebnethercote              }
94473b526fb4af0f60634f0078583d92b931d5c0eebnethercote          }
94540e735834f172bd304ead1fa7e5e31f9e455dc24njn        (void) CloseBlob(image);
94640e735834f172bd304ead1fa7e5e31f9e455dc24njn        if (image->previous == (Image *) NULL)
94740e735834f172bd304ead1fa7e5e31f9e455dc24njn          {
94840e735834f172bd304ead1fa7e5e31f9e455dc24njn            status=SetImageProgress(image,LoadImageTag,5,5);
94940e735834f172bd304ead1fa7e5e31f9e455dc24njn            if (status == MagickFalse)
95073b526fb4af0f60634f0078583d92b931d5c0eebnethercote              break;
95173b526fb4af0f60634f0078583d92b931d5c0eebnethercote          }
95273b526fb4af0f60634f0078583d92b931d5c0eebnethercote        break;
95373b526fb4af0f60634f0078583d92b931d5c0eebnethercote      }
95473b526fb4af0f60634f0078583d92b931d5c0eebnethercote    }
95573b526fb4af0f60634f0078583d92b931d5c0eebnethercote    SetQuantumImageType(image,quantum_type);
95640e735834f172bd304ead1fa7e5e31f9e455dc24njn    /*
95773b526fb4af0f60634f0078583d92b931d5c0eebnethercote      Proceed to next image.
95873b526fb4af0f60634f0078583d92b931d5c0eebnethercote    */
95973b526fb4af0f60634f0078583d92b931d5c0eebnethercote    if (image_info->number_scenes != 0)
96073b526fb4af0f60634f0078583d92b931d5c0eebnethercote      if (image->scene >= (image_info->scene+image_info->number_scenes-1))
96173b526fb4af0f60634f0078583d92b931d5c0eebnethercote        break;
96273b526fb4af0f60634f0078583d92b931d5c0eebnethercote    if (count == (ssize_t) length)
96373b526fb4af0f60634f0078583d92b931d5c0eebnethercote      {
96473b526fb4af0f60634f0078583d92b931d5c0eebnethercote        /*
96573b526fb4af0f60634f0078583d92b931d5c0eebnethercote          Allocate next image structure.
96673b526fb4af0f60634f0078583d92b931d5c0eebnethercote        */
96773b526fb4af0f60634f0078583d92b931d5c0eebnethercote        AcquireNextImage(image_info,image,exception);
96873b526fb4af0f60634f0078583d92b931d5c0eebnethercote        if (GetNextImageInList(image) == (Image *) NULL)
96973b526fb4af0f60634f0078583d92b931d5c0eebnethercote          {
97073b526fb4af0f60634f0078583d92b931d5c0eebnethercote            image=DestroyImageList(image);
97173b526fb4af0f60634f0078583d92b931d5c0eebnethercote            return((Image *) NULL);
97273b526fb4af0f60634f0078583d92b931d5c0eebnethercote          }
97373b526fb4af0f60634f0078583d92b931d5c0eebnethercote        image=SyncNextImageInList(image);
97473b526fb4af0f60634f0078583d92b931d5c0eebnethercote        status=SetImageProgress(image,LoadImagesTag,TellBlob(image),
97573b526fb4af0f60634f0078583d92b931d5c0eebnethercote          GetBlobSize(image));
97673b526fb4af0f60634f0078583d92b931d5c0eebnethercote        if (status == MagickFalse)
97773b526fb4af0f60634f0078583d92b931d5c0eebnethercote          break;
97873b526fb4af0f60634f0078583d92b931d5c0eebnethercote      }
97973b526fb4af0f60634f0078583d92b931d5c0eebnethercote    scene++;
98073b526fb4af0f60634f0078583d92b931d5c0eebnethercote  } while (count == (ssize_t) length);
98173b526fb4af0f60634f0078583d92b931d5c0eebnethercote  quantum_info=DestroyQuantumInfo(quantum_info);
98273b526fb4af0f60634f0078583d92b931d5c0eebnethercote  canvas_image=DestroyImage(canvas_image);
98373b526fb4af0f60634f0078583d92b931d5c0eebnethercote  (void) CloseBlob(image);
98473b526fb4af0f60634f0078583d92b931d5c0eebnethercote  return(GetFirstImageInList(image));
98573b526fb4af0f60634f0078583d92b931d5c0eebnethercote}
98673b526fb4af0f60634f0078583d92b931d5c0eebnethercote
98773b526fb4af0f60634f0078583d92b931d5c0eebnethercote/*
98873b526fb4af0f60634f0078583d92b931d5c0eebnethercote%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
98973b526fb4af0f60634f0078583d92b931d5c0eebnethercote%                                                                             %
99073b526fb4af0f60634f0078583d92b931d5c0eebnethercote%                                                                             %
99173b526fb4af0f60634f0078583d92b931d5c0eebnethercote%                                                                             %
99273b526fb4af0f60634f0078583d92b931d5c0eebnethercote%   R e g i s t e r R G B I m a g e                                           %
99373b526fb4af0f60634f0078583d92b931d5c0eebnethercote%                                                                             %
99473b526fb4af0f60634f0078583d92b931d5c0eebnethercote%                                                                             %
99573b526fb4af0f60634f0078583d92b931d5c0eebnethercote%                                                                             %
99673b526fb4af0f60634f0078583d92b931d5c0eebnethercote%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
99773b526fb4af0f60634f0078583d92b931d5c0eebnethercote%
99873b526fb4af0f60634f0078583d92b931d5c0eebnethercote%  RegisterRGBImage() adds attributes for the RGB image format to
99973b526fb4af0f60634f0078583d92b931d5c0eebnethercote%  the list of supported formats.  The attributes include the image format
100073b526fb4af0f60634f0078583d92b931d5c0eebnethercote%  tag, a method to read and/or write the format, whether the format
100173b526fb4af0f60634f0078583d92b931d5c0eebnethercote%  supports the saving of more than one frame to the same file or blob,
100273b526fb4af0f60634f0078583d92b931d5c0eebnethercote%  whether the format supports native in-memory I/O, and a brief
100373b526fb4af0f60634f0078583d92b931d5c0eebnethercote%  description of the format.
100473b526fb4af0f60634f0078583d92b931d5c0eebnethercote%
100573b526fb4af0f60634f0078583d92b931d5c0eebnethercote%  The format of the RegisterRGBImage method is:
100673b526fb4af0f60634f0078583d92b931d5c0eebnethercote%
100773b526fb4af0f60634f0078583d92b931d5c0eebnethercote%      size_t RegisterRGBImage(void)
100873b526fb4af0f60634f0078583d92b931d5c0eebnethercote%
100973b526fb4af0f60634f0078583d92b931d5c0eebnethercote*/
101073b526fb4af0f60634f0078583d92b931d5c0eebnethercoteModuleExport size_t RegisterRGBImage(void)
101173b526fb4af0f60634f0078583d92b931d5c0eebnethercote{
101273b526fb4af0f60634f0078583d92b931d5c0eebnethercote  MagickInfo
101373b526fb4af0f60634f0078583d92b931d5c0eebnethercote    *entry;
101473b526fb4af0f60634f0078583d92b931d5c0eebnethercote
101573b526fb4af0f60634f0078583d92b931d5c0eebnethercote  entry=AcquireMagickInfo("RGB","RGB",
101673b526fb4af0f60634f0078583d92b931d5c0eebnethercote    "Raw red, green, and blue samples");
101773b526fb4af0f60634f0078583d92b931d5c0eebnethercote  entry->decoder=(DecodeImageHandler *) ReadRGBImage;
101873b526fb4af0f60634f0078583d92b931d5c0eebnethercote  entry->encoder=(EncodeImageHandler *) WriteRGBImage;
101973b526fb4af0f60634f0078583d92b931d5c0eebnethercote  entry->flags|=CoderRawSupportFlag;
102073b526fb4af0f60634f0078583d92b931d5c0eebnethercote  entry->flags|=CoderEndianSupportFlag;
102173b526fb4af0f60634f0078583d92b931d5c0eebnethercote  (void) RegisterMagickInfo(entry);
102273b526fb4af0f60634f0078583d92b931d5c0eebnethercote  entry=AcquireMagickInfo("RGB","RGBA",
102373b526fb4af0f60634f0078583d92b931d5c0eebnethercote    "Raw red, green, blue, and alpha samples");
102473b526fb4af0f60634f0078583d92b931d5c0eebnethercote  entry->decoder=(DecodeImageHandler *) ReadRGBImage;
102573b526fb4af0f60634f0078583d92b931d5c0eebnethercote  entry->encoder=(EncodeImageHandler *) WriteRGBImage;
102673b526fb4af0f60634f0078583d92b931d5c0eebnethercote  entry->flags|=CoderRawSupportFlag;
102773b526fb4af0f60634f0078583d92b931d5c0eebnethercote  entry->flags|=CoderEndianSupportFlag;
102873b526fb4af0f60634f0078583d92b931d5c0eebnethercote  (void) RegisterMagickInfo(entry);
102973b526fb4af0f60634f0078583d92b931d5c0eebnethercote  entry=AcquireMagickInfo("RGB","RGBO",
103073b526fb4af0f60634f0078583d92b931d5c0eebnethercote    "Raw red, green, blue, and opacity samples");
103173b526fb4af0f60634f0078583d92b931d5c0eebnethercote  entry->decoder=(DecodeImageHandler *) ReadRGBImage;
103273b526fb4af0f60634f0078583d92b931d5c0eebnethercote  entry->encoder=(EncodeImageHandler *) WriteRGBImage;
103373b526fb4af0f60634f0078583d92b931d5c0eebnethercote  entry->flags|=CoderRawSupportFlag;
103473b526fb4af0f60634f0078583d92b931d5c0eebnethercote  entry->flags|=CoderEndianSupportFlag;
103573b526fb4af0f60634f0078583d92b931d5c0eebnethercote  (void) RegisterMagickInfo(entry);
103673b526fb4af0f60634f0078583d92b931d5c0eebnethercote  return(MagickImageCoderSignature);
103773b526fb4af0f60634f0078583d92b931d5c0eebnethercote}
103873b526fb4af0f60634f0078583d92b931d5c0eebnethercote
103973b526fb4af0f60634f0078583d92b931d5c0eebnethercote/*
104073b526fb4af0f60634f0078583d92b931d5c0eebnethercote%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
104173b526fb4af0f60634f0078583d92b931d5c0eebnethercote%                                                                             %
104273b526fb4af0f60634f0078583d92b931d5c0eebnethercote%                                                                             %
104373b526fb4af0f60634f0078583d92b931d5c0eebnethercote%                                                                             %
104473b526fb4af0f60634f0078583d92b931d5c0eebnethercote%   U n r e g i s t e r R G B I m a g e                                       %
104573b526fb4af0f60634f0078583d92b931d5c0eebnethercote%                                                                             %
104673b526fb4af0f60634f0078583d92b931d5c0eebnethercote%                                                                             %
104773b526fb4af0f60634f0078583d92b931d5c0eebnethercote%                                                                             %
104873b526fb4af0f60634f0078583d92b931d5c0eebnethercote%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
104973b526fb4af0f60634f0078583d92b931d5c0eebnethercote%
105073b526fb4af0f60634f0078583d92b931d5c0eebnethercote%  UnregisterRGBImage() removes format registrations made by the RGB module
105173b526fb4af0f60634f0078583d92b931d5c0eebnethercote%  from the list of supported formats.
105273b526fb4af0f60634f0078583d92b931d5c0eebnethercote%
105373b526fb4af0f60634f0078583d92b931d5c0eebnethercote%  The format of the UnregisterRGBImage method is:
105473b526fb4af0f60634f0078583d92b931d5c0eebnethercote%
105573b526fb4af0f60634f0078583d92b931d5c0eebnethercote%      UnregisterRGBImage(void)
105673b526fb4af0f60634f0078583d92b931d5c0eebnethercote%
105773b526fb4af0f60634f0078583d92b931d5c0eebnethercote*/
105873b526fb4af0f60634f0078583d92b931d5c0eebnethercoteModuleExport void UnregisterRGBImage(void)
105973b526fb4af0f60634f0078583d92b931d5c0eebnethercote{
106073b526fb4af0f60634f0078583d92b931d5c0eebnethercote  (void) UnregisterMagickInfo("RGBO");
106173b526fb4af0f60634f0078583d92b931d5c0eebnethercote  (void) UnregisterMagickInfo("RGBA");
106273b526fb4af0f60634f0078583d92b931d5c0eebnethercote  (void) UnregisterMagickInfo("RGB");
106373b526fb4af0f60634f0078583d92b931d5c0eebnethercote}
106473b526fb4af0f60634f0078583d92b931d5c0eebnethercote
106573b526fb4af0f60634f0078583d92b931d5c0eebnethercote/*
106673b526fb4af0f60634f0078583d92b931d5c0eebnethercote%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
106773b526fb4af0f60634f0078583d92b931d5c0eebnethercote%                                                                             %
106873b526fb4af0f60634f0078583d92b931d5c0eebnethercote%                                                                             %
106973b526fb4af0f60634f0078583d92b931d5c0eebnethercote%                                                                             %
107073b526fb4af0f60634f0078583d92b931d5c0eebnethercote%   W r i t e R G B I m a g e                                                 %
107173b526fb4af0f60634f0078583d92b931d5c0eebnethercote%                                                                             %
107273b526fb4af0f60634f0078583d92b931d5c0eebnethercote%                                                                             %
107373b526fb4af0f60634f0078583d92b931d5c0eebnethercote%                                                                             %
107473b526fb4af0f60634f0078583d92b931d5c0eebnethercote%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
107573b526fb4af0f60634f0078583d92b931d5c0eebnethercote%
107673b526fb4af0f60634f0078583d92b931d5c0eebnethercote%  WriteRGBImage() writes an image to a file in the RGB, RGBA, or RGBO
107773b526fb4af0f60634f0078583d92b931d5c0eebnethercote%  rasterfile format.
107873b526fb4af0f60634f0078583d92b931d5c0eebnethercote%
107973b526fb4af0f60634f0078583d92b931d5c0eebnethercote%  The format of the WriteRGBImage method is:
108073b526fb4af0f60634f0078583d92b931d5c0eebnethercote%
108173b526fb4af0f60634f0078583d92b931d5c0eebnethercote%      MagickBooleanType WriteRGBImage(const ImageInfo *image_info,
108273b526fb4af0f60634f0078583d92b931d5c0eebnethercote%        Image *image,ExceptionInfo *exception)
108373b526fb4af0f60634f0078583d92b931d5c0eebnethercote%
108473b526fb4af0f60634f0078583d92b931d5c0eebnethercote%  A description of each parameter follows.
108573b526fb4af0f60634f0078583d92b931d5c0eebnethercote%
108673b526fb4af0f60634f0078583d92b931d5c0eebnethercote%    o image_info: the image info.
108773b526fb4af0f60634f0078583d92b931d5c0eebnethercote%
108873b526fb4af0f60634f0078583d92b931d5c0eebnethercote%    o image:  The image.
108973b526fb4af0f60634f0078583d92b931d5c0eebnethercote%
109073b526fb4af0f60634f0078583d92b931d5c0eebnethercote%    o exception: return any errors or warnings in this structure.
109173b526fb4af0f60634f0078583d92b931d5c0eebnethercote%
109273b526fb4af0f60634f0078583d92b931d5c0eebnethercote*/
109373b526fb4af0f60634f0078583d92b931d5c0eebnethercotestatic MagickBooleanType WriteRGBImage(const ImageInfo *image_info,
109473b526fb4af0f60634f0078583d92b931d5c0eebnethercote  Image *image,ExceptionInfo *exception)
109573b526fb4af0f60634f0078583d92b931d5c0eebnethercote{
109673b526fb4af0f60634f0078583d92b931d5c0eebnethercote  MagickBooleanType
109773b526fb4af0f60634f0078583d92b931d5c0eebnethercote    status;
109873b526fb4af0f60634f0078583d92b931d5c0eebnethercote
109973b526fb4af0f60634f0078583d92b931d5c0eebnethercote  MagickOffsetType
110073b526fb4af0f60634f0078583d92b931d5c0eebnethercote    scene;
110173b526fb4af0f60634f0078583d92b931d5c0eebnethercote
110273b526fb4af0f60634f0078583d92b931d5c0eebnethercote  QuantumInfo
110373b526fb4af0f60634f0078583d92b931d5c0eebnethercote    *quantum_info;
110473b526fb4af0f60634f0078583d92b931d5c0eebnethercote
110573b526fb4af0f60634f0078583d92b931d5c0eebnethercote  QuantumType
110673b526fb4af0f60634f0078583d92b931d5c0eebnethercote    quantum_type;
110773b526fb4af0f60634f0078583d92b931d5c0eebnethercote
110873b526fb4af0f60634f0078583d92b931d5c0eebnethercote  size_t
110973b526fb4af0f60634f0078583d92b931d5c0eebnethercote    length;
111073b526fb4af0f60634f0078583d92b931d5c0eebnethercote
111173b526fb4af0f60634f0078583d92b931d5c0eebnethercote  ssize_t
111273b526fb4af0f60634f0078583d92b931d5c0eebnethercote    count,
111373b526fb4af0f60634f0078583d92b931d5c0eebnethercote    y;
111445f4e7c91119c7d01a59f5e827c67841632c9314sewardj
111573b526fb4af0f60634f0078583d92b931d5c0eebnethercote  unsigned char
111673b526fb4af0f60634f0078583d92b931d5c0eebnethercote    *pixels;
111745f4e7c91119c7d01a59f5e827c67841632c9314sewardj
111873b526fb4af0f60634f0078583d92b931d5c0eebnethercote  /*
111998e68a4db8df087243c5f095cddb7b34adb2d19bsewardj    Allocate memory for pixels.
1120b5f6f51ebcac183818061bf53427a3e7808ef10dsewardj  */
1121b5f6f51ebcac183818061bf53427a3e7808ef10dsewardj  assert(image_info != (const ImageInfo *) NULL);
112273b526fb4af0f60634f0078583d92b931d5c0eebnethercote  assert(image_info->signature == MagickCoreSignature);
112373b526fb4af0f60634f0078583d92b931d5c0eebnethercote  assert(image != (Image *) NULL);
112473b526fb4af0f60634f0078583d92b931d5c0eebnethercote  assert(image->signature == MagickCoreSignature);
112573b526fb4af0f60634f0078583d92b931d5c0eebnethercote  if (image->debug != MagickFalse)
112673b526fb4af0f60634f0078583d92b931d5c0eebnethercote    (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
112773b526fb4af0f60634f0078583d92b931d5c0eebnethercote  if (image_info->interlace != PartitionInterlace)
112873b526fb4af0f60634f0078583d92b931d5c0eebnethercote    {
112973b526fb4af0f60634f0078583d92b931d5c0eebnethercote      /*
113073b526fb4af0f60634f0078583d92b931d5c0eebnethercote        Open output image file.
113173b526fb4af0f60634f0078583d92b931d5c0eebnethercote      */
113273b526fb4af0f60634f0078583d92b931d5c0eebnethercote      status=OpenBlob(image_info,image,WriteBinaryBlobMode,exception);
113373b526fb4af0f60634f0078583d92b931d5c0eebnethercote      if (status == MagickFalse)
1134af8a6a8cabe15435a526c6d9435fe83992b671abtom        return(status);
113573b526fb4af0f60634f0078583d92b931d5c0eebnethercote    }
113673b526fb4af0f60634f0078583d92b931d5c0eebnethercote  quantum_type=RGBQuantum;
113773b526fb4af0f60634f0078583d92b931d5c0eebnethercote  if (LocaleCompare(image_info->magick,"RGBA") == 0)
113873b526fb4af0f60634f0078583d92b931d5c0eebnethercote    quantum_type=RGBAQuantum;
113973b526fb4af0f60634f0078583d92b931d5c0eebnethercote  if (LocaleCompare(image_info->magick,"RGBO") == 0)
114073b526fb4af0f60634f0078583d92b931d5c0eebnethercote    quantum_type=RGBOQuantum;
114173b526fb4af0f60634f0078583d92b931d5c0eebnethercote  scene=0;
114273b526fb4af0f60634f0078583d92b931d5c0eebnethercote  do
114373b526fb4af0f60634f0078583d92b931d5c0eebnethercote  {
114473b526fb4af0f60634f0078583d92b931d5c0eebnethercote    /*
114573b526fb4af0f60634f0078583d92b931d5c0eebnethercote      Convert MIFF to RGB raster pixels.
114673b526fb4af0f60634f0078583d92b931d5c0eebnethercote    */
114773b526fb4af0f60634f0078583d92b931d5c0eebnethercote    (void) TransformImageColorspace(image,sRGBColorspace,exception);
114873b526fb4af0f60634f0078583d92b931d5c0eebnethercote    if ((LocaleCompare(image_info->magick,"RGBA") == 0) &&
114973b526fb4af0f60634f0078583d92b931d5c0eebnethercote        (image->alpha_trait == UndefinedPixelTrait))
115073b526fb4af0f60634f0078583d92b931d5c0eebnethercote      (void) SetImageAlphaChannel(image,OpaqueAlphaChannel,exception);
115173b526fb4af0f60634f0078583d92b931d5c0eebnethercote    quantum_info=AcquireQuantumInfo(image_info,image);
115273b526fb4af0f60634f0078583d92b931d5c0eebnethercote    if (quantum_info == (QuantumInfo *) NULL)
1153b5f6f51ebcac183818061bf53427a3e7808ef10dsewardj      ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
115473b526fb4af0f60634f0078583d92b931d5c0eebnethercote    pixels=(unsigned char *) GetQuantumPixels(quantum_info);
115573b526fb4af0f60634f0078583d92b931d5c0eebnethercote    switch (image_info->interlace)
115673b526fb4af0f60634f0078583d92b931d5c0eebnethercote    {
1157b5f6f51ebcac183818061bf53427a3e7808ef10dsewardj      case NoInterlace:
115873b526fb4af0f60634f0078583d92b931d5c0eebnethercote      default:
115973b526fb4af0f60634f0078583d92b931d5c0eebnethercote      {
1160b5f6f51ebcac183818061bf53427a3e7808ef10dsewardj        /*
1161497c69e7365352c91422a41583cf3bb5cacc1de1sewardj          No interlacing:  RGBRGBRGBRGBRGBRGB...
116273b526fb4af0f60634f0078583d92b931d5c0eebnethercote        */
116305b1f9a0d68e6d2c497ed4b671b8ff65e4ddbab9tom        for (y=0; y < (ssize_t) image->rows; y++)
116405b1f9a0d68e6d2c497ed4b671b8ff65e4ddbab9tom        {
116505b1f9a0d68e6d2c497ed4b671b8ff65e4ddbab9tom          register const Quantum
116605b1f9a0d68e6d2c497ed4b671b8ff65e4ddbab9tom            *magick_restrict p;
116705b1f9a0d68e6d2c497ed4b671b8ff65e4ddbab9tom
116805b1f9a0d68e6d2c497ed4b671b8ff65e4ddbab9tom          p=GetVirtualPixels(image,0,y,image->columns,1,exception);
116905b1f9a0d68e6d2c497ed4b671b8ff65e4ddbab9tom          if (p == (const Quantum *) NULL)
117005b1f9a0d68e6d2c497ed4b671b8ff65e4ddbab9tom            break;
117105b1f9a0d68e6d2c497ed4b671b8ff65e4ddbab9tom          length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
117205b1f9a0d68e6d2c497ed4b671b8ff65e4ddbab9tom            quantum_type,pixels,exception);
117305b1f9a0d68e6d2c497ed4b671b8ff65e4ddbab9tom          count=WriteBlob(image,length,pixels);
117405b1f9a0d68e6d2c497ed4b671b8ff65e4ddbab9tom          if (count != (ssize_t) length)
117505b1f9a0d68e6d2c497ed4b671b8ff65e4ddbab9tom            break;
117605b1f9a0d68e6d2c497ed4b671b8ff65e4ddbab9tom          if (image->previous == (Image *) NULL)
117705b1f9a0d68e6d2c497ed4b671b8ff65e4ddbab9tom            {
117805b1f9a0d68e6d2c497ed4b671b8ff65e4ddbab9tom              status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,
117905b1f9a0d68e6d2c497ed4b671b8ff65e4ddbab9tom                image->rows);
118005b1f9a0d68e6d2c497ed4b671b8ff65e4ddbab9tom              if (status == MagickFalse)
118105b1f9a0d68e6d2c497ed4b671b8ff65e4ddbab9tom                break;
118205b1f9a0d68e6d2c497ed4b671b8ff65e4ddbab9tom            }
118305b1f9a0d68e6d2c497ed4b671b8ff65e4ddbab9tom        }
118405b1f9a0d68e6d2c497ed4b671b8ff65e4ddbab9tom        break;
118505b1f9a0d68e6d2c497ed4b671b8ff65e4ddbab9tom      }
118605b1f9a0d68e6d2c497ed4b671b8ff65e4ddbab9tom      case LineInterlace:
118705b1f9a0d68e6d2c497ed4b671b8ff65e4ddbab9tom      {
118805b1f9a0d68e6d2c497ed4b671b8ff65e4ddbab9tom        /*
118905b1f9a0d68e6d2c497ed4b671b8ff65e4ddbab9tom          Line interlacing:  RRR...GGG...BBB...RRR...GGG...BBB...
119005b1f9a0d68e6d2c497ed4b671b8ff65e4ddbab9tom        */
119105b1f9a0d68e6d2c497ed4b671b8ff65e4ddbab9tom        for (y=0; y < (ssize_t) image->rows; y++)
119205b1f9a0d68e6d2c497ed4b671b8ff65e4ddbab9tom        {
119305b1f9a0d68e6d2c497ed4b671b8ff65e4ddbab9tom          register const Quantum
119473b526fb4af0f60634f0078583d92b931d5c0eebnethercote            *magick_restrict p;
119573b526fb4af0f60634f0078583d92b931d5c0eebnethercote
119673b526fb4af0f60634f0078583d92b931d5c0eebnethercote          p=GetVirtualPixels(image,0,y,image->columns,1,exception);
119773b526fb4af0f60634f0078583d92b931d5c0eebnethercote          if (p == (const Quantum *) NULL)
119873b526fb4af0f60634f0078583d92b931d5c0eebnethercote            break;
119973b526fb4af0f60634f0078583d92b931d5c0eebnethercote          length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
120073b526fb4af0f60634f0078583d92b931d5c0eebnethercote            RedQuantum,pixels,exception);
120173b526fb4af0f60634f0078583d92b931d5c0eebnethercote          count=WriteBlob(image,length,pixels);
120273b526fb4af0f60634f0078583d92b931d5c0eebnethercote          if (count != (ssize_t) length)
120373b526fb4af0f60634f0078583d92b931d5c0eebnethercote            break;
120409b8480025cb3149879465b769058cb197bb9003njn          length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
120509b8480025cb3149879465b769058cb197bb9003njn            GreenQuantum,pixels,exception);
120609b8480025cb3149879465b769058cb197bb9003njn          count=WriteBlob(image,length,pixels);
120709b8480025cb3149879465b769058cb197bb9003njn          if (count != (ssize_t) length)
120809b8480025cb3149879465b769058cb197bb9003njn            break;
120909b8480025cb3149879465b769058cb197bb9003njn          length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
121009b8480025cb3149879465b769058cb197bb9003njn            BlueQuantum,pixels,exception);
121109b8480025cb3149879465b769058cb197bb9003njn          count=WriteBlob(image,length,pixels);
121209b8480025cb3149879465b769058cb197bb9003njn          if (count != (ssize_t) length)
121309b8480025cb3149879465b769058cb197bb9003njn            break;
121409b8480025cb3149879465b769058cb197bb9003njn          if (quantum_type == RGBAQuantum)
121509b8480025cb3149879465b769058cb197bb9003njn            {
121609b8480025cb3149879465b769058cb197bb9003njn              length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
121709b8480025cb3149879465b769058cb197bb9003njn                AlphaQuantum,pixels,exception);
121809b8480025cb3149879465b769058cb197bb9003njn              count=WriteBlob(image,length,pixels);
121909b8480025cb3149879465b769058cb197bb9003njn              if (count != (ssize_t) length)
122009b8480025cb3149879465b769058cb197bb9003njn                break;
122109b8480025cb3149879465b769058cb197bb9003njn            }
122209b8480025cb3149879465b769058cb197bb9003njn          if (quantum_type == RGBOQuantum)
122309b8480025cb3149879465b769058cb197bb9003njn            {
122445f4e7c91119c7d01a59f5e827c67841632c9314sewardj              length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
122573b526fb4af0f60634f0078583d92b931d5c0eebnethercote                OpacityQuantum,pixels,exception);
122673b526fb4af0f60634f0078583d92b931d5c0eebnethercote              count=WriteBlob(image,length,pixels);
122745f4e7c91119c7d01a59f5e827c67841632c9314sewardj              if (count != (ssize_t) length)
122845f4e7c91119c7d01a59f5e827c67841632c9314sewardj                break;
122945f4e7c91119c7d01a59f5e827c67841632c9314sewardj            }
123045f4e7c91119c7d01a59f5e827c67841632c9314sewardj          if (image->previous == (Image *) NULL)
123145f4e7c91119c7d01a59f5e827c67841632c9314sewardj            {
123245f4e7c91119c7d01a59f5e827c67841632c9314sewardj              status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,
123345f4e7c91119c7d01a59f5e827c67841632c9314sewardj                image->rows);
123445f4e7c91119c7d01a59f5e827c67841632c9314sewardj              if (status == MagickFalse)
123545f4e7c91119c7d01a59f5e827c67841632c9314sewardj                break;
123645f4e7c91119c7d01a59f5e827c67841632c9314sewardj            }
123745f4e7c91119c7d01a59f5e827c67841632c9314sewardj        }
123873b526fb4af0f60634f0078583d92b931d5c0eebnethercote        break;
123973b526fb4af0f60634f0078583d92b931d5c0eebnethercote      }
124073b526fb4af0f60634f0078583d92b931d5c0eebnethercote      case PlaneInterlace:
124173b526fb4af0f60634f0078583d92b931d5c0eebnethercote      {
124273b526fb4af0f60634f0078583d92b931d5c0eebnethercote        /*
124373b526fb4af0f60634f0078583d92b931d5c0eebnethercote          Plane interlacing:  RRRRRR...GGGGGG...BBBBBB...
124473b526fb4af0f60634f0078583d92b931d5c0eebnethercote        */
124573b526fb4af0f60634f0078583d92b931d5c0eebnethercote        for (y=0; y < (ssize_t) image->rows; y++)
124673b526fb4af0f60634f0078583d92b931d5c0eebnethercote        {
124773b526fb4af0f60634f0078583d92b931d5c0eebnethercote          register const Quantum
124873b526fb4af0f60634f0078583d92b931d5c0eebnethercote            *magick_restrict p;
124973b526fb4af0f60634f0078583d92b931d5c0eebnethercote
125073b526fb4af0f60634f0078583d92b931d5c0eebnethercote          p=GetVirtualPixels(image,0,y,image->columns,1,exception);
1251cfb8ad53df2d8d59757bc9477da105fc7fbb1843njn          if (p == (const Quantum *) NULL)
1252cfb8ad53df2d8d59757bc9477da105fc7fbb1843njn            break;
1253cfb8ad53df2d8d59757bc9477da105fc7fbb1843njn          length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
1254cfb8ad53df2d8d59757bc9477da105fc7fbb1843njn            RedQuantum,pixels,exception);
1255cfb8ad53df2d8d59757bc9477da105fc7fbb1843njn          count=WriteBlob(image,length,pixels);
1256cfb8ad53df2d8d59757bc9477da105fc7fbb1843njn          if (count != (ssize_t) length)
1257cfb8ad53df2d8d59757bc9477da105fc7fbb1843njn            break;
1258cfb8ad53df2d8d59757bc9477da105fc7fbb1843njn        }
1259cfb8ad53df2d8d59757bc9477da105fc7fbb1843njn        if (image->previous == (Image *) NULL)
126073b526fb4af0f60634f0078583d92b931d5c0eebnethercote          {
126173b526fb4af0f60634f0078583d92b931d5c0eebnethercote            status=SetImageProgress(image,SaveImageTag,1,6);
126273b526fb4af0f60634f0078583d92b931d5c0eebnethercote            if (status == MagickFalse)
126373b526fb4af0f60634f0078583d92b931d5c0eebnethercote              break;
126473b526fb4af0f60634f0078583d92b931d5c0eebnethercote          }
126573b526fb4af0f60634f0078583d92b931d5c0eebnethercote        for (y=0; y < (ssize_t) image->rows; y++)
126673b526fb4af0f60634f0078583d92b931d5c0eebnethercote        {
126773b526fb4af0f60634f0078583d92b931d5c0eebnethercote          register const Quantum
126873b526fb4af0f60634f0078583d92b931d5c0eebnethercote            *magick_restrict p;
126973b526fb4af0f60634f0078583d92b931d5c0eebnethercote
127073b526fb4af0f60634f0078583d92b931d5c0eebnethercote          p=GetVirtualPixels(image,0,y,image->columns,1,exception);
127173b526fb4af0f60634f0078583d92b931d5c0eebnethercote          if (p == (const Quantum *) NULL)
127273b526fb4af0f60634f0078583d92b931d5c0eebnethercote            break;
127373b526fb4af0f60634f0078583d92b931d5c0eebnethercote          length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
127473b526fb4af0f60634f0078583d92b931d5c0eebnethercote            GreenQuantum,pixels,exception);
127573b526fb4af0f60634f0078583d92b931d5c0eebnethercote          count=WriteBlob(image,length,pixels);
127673b526fb4af0f60634f0078583d92b931d5c0eebnethercote          if (count != (ssize_t) length)
127773b526fb4af0f60634f0078583d92b931d5c0eebnethercote            break;
127873b526fb4af0f60634f0078583d92b931d5c0eebnethercote        }
127973b526fb4af0f60634f0078583d92b931d5c0eebnethercote        if (image->previous == (Image *) NULL)
128073b526fb4af0f60634f0078583d92b931d5c0eebnethercote          {
128173b526fb4af0f60634f0078583d92b931d5c0eebnethercote            status=SetImageProgress(image,SaveImageTag,2,6);
128273b526fb4af0f60634f0078583d92b931d5c0eebnethercote            if (status == MagickFalse)
128373b526fb4af0f60634f0078583d92b931d5c0eebnethercote              break;
128473b526fb4af0f60634f0078583d92b931d5c0eebnethercote          }
128573b526fb4af0f60634f0078583d92b931d5c0eebnethercote        for (y=0; y < (ssize_t) image->rows; y++)
128673b526fb4af0f60634f0078583d92b931d5c0eebnethercote        {
128773b526fb4af0f60634f0078583d92b931d5c0eebnethercote          register const Quantum
128873b526fb4af0f60634f0078583d92b931d5c0eebnethercote            *magick_restrict p;
128973b526fb4af0f60634f0078583d92b931d5c0eebnethercote
129073b526fb4af0f60634f0078583d92b931d5c0eebnethercote          p=GetVirtualPixels(image,0,y,image->columns,1,exception);
129173b526fb4af0f60634f0078583d92b931d5c0eebnethercote          if (p == (const Quantum *) NULL)
129273b526fb4af0f60634f0078583d92b931d5c0eebnethercote            break;
129373b526fb4af0f60634f0078583d92b931d5c0eebnethercote          length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
129473b526fb4af0f60634f0078583d92b931d5c0eebnethercote            BlueQuantum,pixels,exception);
129585665ca6fa29dd64754dabe50eb98f25896e752acerion          count=WriteBlob(image,length,pixels);
129673b526fb4af0f60634f0078583d92b931d5c0eebnethercote          if (count != (ssize_t) length)
129785665ca6fa29dd64754dabe50eb98f25896e752acerion            break;
129873b526fb4af0f60634f0078583d92b931d5c0eebnethercote        }
129973b526fb4af0f60634f0078583d92b931d5c0eebnethercote        if (image->previous == (Image *) NULL)
130073b526fb4af0f60634f0078583d92b931d5c0eebnethercote          {
130173b526fb4af0f60634f0078583d92b931d5c0eebnethercote            status=SetImageProgress(image,SaveImageTag,3,6);
130273b526fb4af0f60634f0078583d92b931d5c0eebnethercote            if (status == MagickFalse)
130373b526fb4af0f60634f0078583d92b931d5c0eebnethercote              break;
130473b526fb4af0f60634f0078583d92b931d5c0eebnethercote          }
130573b526fb4af0f60634f0078583d92b931d5c0eebnethercote        if (quantum_type == RGBAQuantum)
130673b526fb4af0f60634f0078583d92b931d5c0eebnethercote          {
130773b526fb4af0f60634f0078583d92b931d5c0eebnethercote            for (y=0; y < (ssize_t) image->rows; y++)
130873b526fb4af0f60634f0078583d92b931d5c0eebnethercote            {
130973b526fb4af0f60634f0078583d92b931d5c0eebnethercote              register const Quantum
131073b526fb4af0f60634f0078583d92b931d5c0eebnethercote                *magick_restrict p;
131173b526fb4af0f60634f0078583d92b931d5c0eebnethercote
131273b526fb4af0f60634f0078583d92b931d5c0eebnethercote              p=GetVirtualPixels(image,0,y,image->columns,1,exception);
131373b526fb4af0f60634f0078583d92b931d5c0eebnethercote              if (p == (const Quantum *) NULL)
131473b526fb4af0f60634f0078583d92b931d5c0eebnethercote                break;
131573b526fb4af0f60634f0078583d92b931d5c0eebnethercote              length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
131673b526fb4af0f60634f0078583d92b931d5c0eebnethercote                AlphaQuantum,pixels,exception);
131773b526fb4af0f60634f0078583d92b931d5c0eebnethercote              count=WriteBlob(image,length,pixels);
131873b526fb4af0f60634f0078583d92b931d5c0eebnethercote              if (count != (ssize_t) length)
131973b526fb4af0f60634f0078583d92b931d5c0eebnethercote              break;
132073b526fb4af0f60634f0078583d92b931d5c0eebnethercote            }
132173b526fb4af0f60634f0078583d92b931d5c0eebnethercote            if (image->previous == (Image *) NULL)
132273b526fb4af0f60634f0078583d92b931d5c0eebnethercote              {
132373b526fb4af0f60634f0078583d92b931d5c0eebnethercote                status=SetImageProgress(image,SaveImageTag,5,6);
132473b526fb4af0f60634f0078583d92b931d5c0eebnethercote                if (status == MagickFalse)
132573b526fb4af0f60634f0078583d92b931d5c0eebnethercote                  break;
132673b526fb4af0f60634f0078583d92b931d5c0eebnethercote              }
132773b526fb4af0f60634f0078583d92b931d5c0eebnethercote          }
132873b526fb4af0f60634f0078583d92b931d5c0eebnethercote        if (image_info->interlace == PartitionInterlace)
132973b526fb4af0f60634f0078583d92b931d5c0eebnethercote          (void) CopyMagickString(image->filename,image_info->filename,
133073b526fb4af0f60634f0078583d92b931d5c0eebnethercote            MagickPathExtent);
133173b526fb4af0f60634f0078583d92b931d5c0eebnethercote        if (image->previous == (Image *) NULL)
133273b526fb4af0f60634f0078583d92b931d5c0eebnethercote          {
133373b526fb4af0f60634f0078583d92b931d5c0eebnethercote            status=SetImageProgress(image,SaveImageTag,6,6);
133473b526fb4af0f60634f0078583d92b931d5c0eebnethercote            if (status == MagickFalse)
133573b526fb4af0f60634f0078583d92b931d5c0eebnethercote              break;
133673b526fb4af0f60634f0078583d92b931d5c0eebnethercote          }
133773b526fb4af0f60634f0078583d92b931d5c0eebnethercote        break;
133873b526fb4af0f60634f0078583d92b931d5c0eebnethercote      }
133973b526fb4af0f60634f0078583d92b931d5c0eebnethercote      case PartitionInterlace:
134073b526fb4af0f60634f0078583d92b931d5c0eebnethercote      {
134173b526fb4af0f60634f0078583d92b931d5c0eebnethercote        /*
134273b526fb4af0f60634f0078583d92b931d5c0eebnethercote          Partition interlacing:  RRRRRR..., GGGGGG..., BBBBBB...
134373b526fb4af0f60634f0078583d92b931d5c0eebnethercote        */
134473b526fb4af0f60634f0078583d92b931d5c0eebnethercote        AppendImageFormat("R",image->filename);
134573b526fb4af0f60634f0078583d92b931d5c0eebnethercote        status=OpenBlob(image_info,image,scene == 0 ? WriteBinaryBlobMode :
134673b526fb4af0f60634f0078583d92b931d5c0eebnethercote          AppendBinaryBlobMode,exception);
134773b526fb4af0f60634f0078583d92b931d5c0eebnethercote        if (status == MagickFalse)
134873b526fb4af0f60634f0078583d92b931d5c0eebnethercote          return(status);
134973b526fb4af0f60634f0078583d92b931d5c0eebnethercote        for (y=0; y < (ssize_t) image->rows; y++)
135073b526fb4af0f60634f0078583d92b931d5c0eebnethercote        {
135173b526fb4af0f60634f0078583d92b931d5c0eebnethercote          register const Quantum
135273b526fb4af0f60634f0078583d92b931d5c0eebnethercote            *magick_restrict p;
135373b526fb4af0f60634f0078583d92b931d5c0eebnethercote
135473b526fb4af0f60634f0078583d92b931d5c0eebnethercote          p=GetVirtualPixels(image,0,y,image->columns,1,exception);
135573b526fb4af0f60634f0078583d92b931d5c0eebnethercote          if (p == (const Quantum *) NULL)
135673b526fb4af0f60634f0078583d92b931d5c0eebnethercote            break;
135773b526fb4af0f60634f0078583d92b931d5c0eebnethercote          length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
135873b526fb4af0f60634f0078583d92b931d5c0eebnethercote            RedQuantum,pixels,exception);
135973b526fb4af0f60634f0078583d92b931d5c0eebnethercote          count=WriteBlob(image,length,pixels);
136073b526fb4af0f60634f0078583d92b931d5c0eebnethercote          if (count != (ssize_t) length)
136173b526fb4af0f60634f0078583d92b931d5c0eebnethercote            break;
136273b526fb4af0f60634f0078583d92b931d5c0eebnethercote        }
136373b526fb4af0f60634f0078583d92b931d5c0eebnethercote        if (image->previous == (Image *) NULL)
136473b526fb4af0f60634f0078583d92b931d5c0eebnethercote          {
136573b526fb4af0f60634f0078583d92b931d5c0eebnethercote            status=SetImageProgress(image,SaveImageTag,1,6);
136673b526fb4af0f60634f0078583d92b931d5c0eebnethercote            if (status == MagickFalse)
136773b526fb4af0f60634f0078583d92b931d5c0eebnethercote              break;
136873b526fb4af0f60634f0078583d92b931d5c0eebnethercote          }
136973b526fb4af0f60634f0078583d92b931d5c0eebnethercote        (void) CloseBlob(image);
137073b526fb4af0f60634f0078583d92b931d5c0eebnethercote        AppendImageFormat("G",image->filename);
137173b526fb4af0f60634f0078583d92b931d5c0eebnethercote        status=OpenBlob(image_info,image,scene == 0 ? WriteBinaryBlobMode :
137273b526fb4af0f60634f0078583d92b931d5c0eebnethercote          AppendBinaryBlobMode,exception);
137373b526fb4af0f60634f0078583d92b931d5c0eebnethercote        if (status == MagickFalse)
137473b526fb4af0f60634f0078583d92b931d5c0eebnethercote          return(status);
137573b526fb4af0f60634f0078583d92b931d5c0eebnethercote        for (y=0; y < (ssize_t) image->rows; y++)
137673b526fb4af0f60634f0078583d92b931d5c0eebnethercote        {
137773b526fb4af0f60634f0078583d92b931d5c0eebnethercote          register const Quantum
137873b526fb4af0f60634f0078583d92b931d5c0eebnethercote            *magick_restrict p;
137973b526fb4af0f60634f0078583d92b931d5c0eebnethercote
138073b526fb4af0f60634f0078583d92b931d5c0eebnethercote          p=GetVirtualPixels(image,0,y,image->columns,1,exception);
138173b526fb4af0f60634f0078583d92b931d5c0eebnethercote          if (p == (const Quantum *) NULL)
138273b526fb4af0f60634f0078583d92b931d5c0eebnethercote            break;
138373b526fb4af0f60634f0078583d92b931d5c0eebnethercote          length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
138473b526fb4af0f60634f0078583d92b931d5c0eebnethercote            GreenQuantum,pixels,exception);
138573b526fb4af0f60634f0078583d92b931d5c0eebnethercote          count=WriteBlob(image,length,pixels);
138673b526fb4af0f60634f0078583d92b931d5c0eebnethercote          if (count != (ssize_t) length)
138773b526fb4af0f60634f0078583d92b931d5c0eebnethercote            break;
138873b526fb4af0f60634f0078583d92b931d5c0eebnethercote        }
138973b526fb4af0f60634f0078583d92b931d5c0eebnethercote        if (image->previous == (Image *) NULL)
139073b526fb4af0f60634f0078583d92b931d5c0eebnethercote          {
139173b526fb4af0f60634f0078583d92b931d5c0eebnethercote            status=SetImageProgress(image,SaveImageTag,2,6);
139273b526fb4af0f60634f0078583d92b931d5c0eebnethercote            if (status == MagickFalse)
139373b526fb4af0f60634f0078583d92b931d5c0eebnethercote              break;
139473b526fb4af0f60634f0078583d92b931d5c0eebnethercote          }
139573b526fb4af0f60634f0078583d92b931d5c0eebnethercote        (void) CloseBlob(image);
139673b526fb4af0f60634f0078583d92b931d5c0eebnethercote        AppendImageFormat("B",image->filename);
1397f61fea0d88fc6cc2a6c4ff78c49aa0343529ee20tom        status=OpenBlob(image_info,image,scene == 0 ? WriteBinaryBlobMode :
1398f61fea0d88fc6cc2a6c4ff78c49aa0343529ee20tom          AppendBinaryBlobMode,exception);
139973b526fb4af0f60634f0078583d92b931d5c0eebnethercote        if (status == MagickFalse)
140073b526fb4af0f60634f0078583d92b931d5c0eebnethercote          return(status);
140173b526fb4af0f60634f0078583d92b931d5c0eebnethercote        for (y=0; y < (ssize_t) image->rows; y++)
140273b526fb4af0f60634f0078583d92b931d5c0eebnethercote        {
140373b526fb4af0f60634f0078583d92b931d5c0eebnethercote          register const Quantum
140473b526fb4af0f60634f0078583d92b931d5c0eebnethercote            *magick_restrict p;
140573b526fb4af0f60634f0078583d92b931d5c0eebnethercote
140673b526fb4af0f60634f0078583d92b931d5c0eebnethercote          p=GetVirtualPixels(image,0,y,image->columns,1,exception);
140773b526fb4af0f60634f0078583d92b931d5c0eebnethercote          if (p == (const Quantum *) NULL)
140873b526fb4af0f60634f0078583d92b931d5c0eebnethercote            break;
140973b526fb4af0f60634f0078583d92b931d5c0eebnethercote          length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
141073b526fb4af0f60634f0078583d92b931d5c0eebnethercote            BlueQuantum,pixels,exception);
141173b526fb4af0f60634f0078583d92b931d5c0eebnethercote          count=WriteBlob(image,length,pixels);
141273b526fb4af0f60634f0078583d92b931d5c0eebnethercote          if (count != (ssize_t) length)
141373b526fb4af0f60634f0078583d92b931d5c0eebnethercote            break;
141473b526fb4af0f60634f0078583d92b931d5c0eebnethercote        }
141573b526fb4af0f60634f0078583d92b931d5c0eebnethercote        if (image->previous == (Image *) NULL)
141673b526fb4af0f60634f0078583d92b931d5c0eebnethercote          {
141773b526fb4af0f60634f0078583d92b931d5c0eebnethercote            status=SetImageProgress(image,SaveImageTag,3,6);
141873b526fb4af0f60634f0078583d92b931d5c0eebnethercote            if (status == MagickFalse)
141973b526fb4af0f60634f0078583d92b931d5c0eebnethercote              break;
142073b526fb4af0f60634f0078583d92b931d5c0eebnethercote          }
142173b526fb4af0f60634f0078583d92b931d5c0eebnethercote        if (quantum_type == RGBAQuantum)
142273b526fb4af0f60634f0078583d92b931d5c0eebnethercote          {
142373b526fb4af0f60634f0078583d92b931d5c0eebnethercote            (void) CloseBlob(image);
142473b526fb4af0f60634f0078583d92b931d5c0eebnethercote            AppendImageFormat("A",image->filename);
142573b526fb4af0f60634f0078583d92b931d5c0eebnethercote            status=OpenBlob(image_info,image,scene == 0 ? WriteBinaryBlobMode :
142673b526fb4af0f60634f0078583d92b931d5c0eebnethercote              AppendBinaryBlobMode,exception);
142773b526fb4af0f60634f0078583d92b931d5c0eebnethercote            if (status == MagickFalse)
142873b526fb4af0f60634f0078583d92b931d5c0eebnethercote              return(status);
142973b526fb4af0f60634f0078583d92b931d5c0eebnethercote            for (y=0; y < (ssize_t) image->rows; y++)
143073b526fb4af0f60634f0078583d92b931d5c0eebnethercote            {
143173b526fb4af0f60634f0078583d92b931d5c0eebnethercote              register const Quantum
143273b526fb4af0f60634f0078583d92b931d5c0eebnethercote                *magick_restrict p;
143373b526fb4af0f60634f0078583d92b931d5c0eebnethercote
143473b526fb4af0f60634f0078583d92b931d5c0eebnethercote              p=GetVirtualPixels(image,0,y,image->columns,1,exception);
143573b526fb4af0f60634f0078583d92b931d5c0eebnethercote              if (p == (const Quantum *) NULL)
143673b526fb4af0f60634f0078583d92b931d5c0eebnethercote                break;
143773b526fb4af0f60634f0078583d92b931d5c0eebnethercote              length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info,
143873b526fb4af0f60634f0078583d92b931d5c0eebnethercote                AlphaQuantum,pixels,exception);
143973b526fb4af0f60634f0078583d92b931d5c0eebnethercote              count=WriteBlob(image,length,pixels);
144073b526fb4af0f60634f0078583d92b931d5c0eebnethercote              if (count != (ssize_t) length)
144173b526fb4af0f60634f0078583d92b931d5c0eebnethercote                break;
144273b526fb4af0f60634f0078583d92b931d5c0eebnethercote            }
144373b526fb4af0f60634f0078583d92b931d5c0eebnethercote            if (image->previous == (Image *) NULL)
144473b526fb4af0f60634f0078583d92b931d5c0eebnethercote              {
144573b526fb4af0f60634f0078583d92b931d5c0eebnethercote                status=SetImageProgress(image,SaveImageTag,5,6);
144673b526fb4af0f60634f0078583d92b931d5c0eebnethercote                if (status == MagickFalse)
144773b526fb4af0f60634f0078583d92b931d5c0eebnethercote                  break;
144873b526fb4af0f60634f0078583d92b931d5c0eebnethercote              }
144973b526fb4af0f60634f0078583d92b931d5c0eebnethercote          }
145073b526fb4af0f60634f0078583d92b931d5c0eebnethercote        (void) CloseBlob(image);
145173b526fb4af0f60634f0078583d92b931d5c0eebnethercote        (void) CopyMagickString(image->filename,image_info->filename,
145273b526fb4af0f60634f0078583d92b931d5c0eebnethercote          MagickPathExtent);
145373b526fb4af0f60634f0078583d92b931d5c0eebnethercote        if (image->previous == (Image *) NULL)
145495a9786cd29c06af2c1cda9ac20e5b0ea488faa4nethercote          {
145595a9786cd29c06af2c1cda9ac20e5b0ea488faa4nethercote            status=SetImageProgress(image,SaveImageTag,6,6);
145695a9786cd29c06af2c1cda9ac20e5b0ea488faa4nethercote            if (status == MagickFalse)
145795a9786cd29c06af2c1cda9ac20e5b0ea488faa4nethercote              break;
145873b526fb4af0f60634f0078583d92b931d5c0eebnethercote          }
145973b526fb4af0f60634f0078583d92b931d5c0eebnethercote        break;
146073b526fb4af0f60634f0078583d92b931d5c0eebnethercote      }
146173b526fb4af0f60634f0078583d92b931d5c0eebnethercote    }
146273b526fb4af0f60634f0078583d92b931d5c0eebnethercote    quantum_info=DestroyQuantumInfo(quantum_info);
146373b526fb4af0f60634f0078583d92b931d5c0eebnethercote    if (GetNextImageInList(image) == (Image *) NULL)
146473b526fb4af0f60634f0078583d92b931d5c0eebnethercote      break;
146573b526fb4af0f60634f0078583d92b931d5c0eebnethercote    image=SyncNextImageInList(image);
146673b526fb4af0f60634f0078583d92b931d5c0eebnethercote    status=SetImageProgress(image,SaveImagesTag,scene++,
146773b526fb4af0f60634f0078583d92b931d5c0eebnethercote      GetImageListLength(image));
146873b526fb4af0f60634f0078583d92b931d5c0eebnethercote    if (status == MagickFalse)
146973b526fb4af0f60634f0078583d92b931d5c0eebnethercote      break;
147073b526fb4af0f60634f0078583d92b931d5c0eebnethercote  } while (image_info->adjoin != MagickFalse);
147173b526fb4af0f60634f0078583d92b931d5c0eebnethercote  (void) CloseBlob(image);
147273b526fb4af0f60634f0078583d92b931d5c0eebnethercote  return(MagickTrue);
147373b526fb4af0f60634f0078583d92b931d5c0eebnethercote}
147473b526fb4af0f60634f0078583d92b931d5c0eebnethercote