2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13 % Read/Write Truevision Targa Image Format %
20 % Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization %
21 % dedicated to making software imaging solutions freely available. %
23 % You may not use this file except in compliance with the License. You may %
24 % obtain a copy of the License at %
26 % http://www.imagemagick.org/script/license.php %
28 % Unless required by applicable law or agreed to in writing, software %
29 % distributed under the License is distributed on an "AS IS" BASIS, %
30 % WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. %
31 % See the License for the specific language governing permissions and %
32 % limitations under the License. %
34 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
42 #include "MagickCore/studio.h"
43 #include "MagickCore/attribute.h"
44 #include "MagickCore/blob.h"
45 #include "MagickCore/blob-private.h"
46 #include "MagickCore/cache.h"
47 #include "MagickCore/color-private.h"
48 #include "MagickCore/colormap.h"
49 #include "MagickCore/colormap-private.h"
50 #include "MagickCore/colorspace.h"
51 #include "MagickCore/colorspace-private.h"
52 #include "MagickCore/exception.h"
53 #include "MagickCore/exception-private.h"
54 #include "MagickCore/image.h"
55 #include "MagickCore/image-private.h"
56 #include "MagickCore/list.h"
57 #include "MagickCore/magick.h"
58 #include "MagickCore/memory_.h"
59 #include "MagickCore/monitor.h"
60 #include "MagickCore/monitor-private.h"
61 #include "MagickCore/pixel-accessor.h"
62 #include "MagickCore/property.h"
63 #include "MagickCore/quantum-private.h"
64 #include "MagickCore/static.h"
65 #include "MagickCore/string_.h"
66 #include "MagickCore/module.h"
71 static MagickBooleanType
72 WriteTGAImage(const ImageInfo *,Image *,ExceptionInfo *);
75 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
79 % R e a d T G A I m a g e %
83 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
85 % ReadTGAImage() reads a Truevision TGA image file and returns it.
86 % It allocates the memory necessary for the new Image structure and returns
87 % a pointer to the new image.
89 % The format of the ReadTGAImage method is:
91 % Image *ReadTGAImage(const ImageInfo *image_info,ExceptionInfo *exception)
93 % A description of each parameter follows:
95 % o image_info: the image info.
97 % o exception: return any errors or warnings in this structure.
100 static Image *ReadTGAImage(const ImageInfo *image_info,ExceptionInfo *exception)
102 #define TGAColormap 1
104 #define TGAMonochrome 3
105 #define TGARLEColormap 9
107 #define TGARLEMonochrome 11
109 typedef struct _TGAInfo
179 assert(image_info != (const ImageInfo *) NULL);
180 assert(image_info->signature == MagickSignature);
181 if (image_info->debug != MagickFalse)
182 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
183 image_info->filename);
184 assert(exception != (ExceptionInfo *) NULL);
185 assert(exception->signature == MagickSignature);
186 image=AcquireImage(image_info,exception);
187 status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
188 if (status == MagickFalse)
190 image=DestroyImageList(image);
191 return((Image *) NULL);
194 Read TGA header information.
196 count=ReadBlob(image,1,&tga_info.id_length);
197 tga_info.colormap_type=(unsigned char) ReadBlobByte(image);
198 tga_info.image_type=(unsigned char) ReadBlobByte(image);
200 ((tga_info.image_type != TGAColormap) &&
201 (tga_info.image_type != TGARGB) &&
202 (tga_info.image_type != TGAMonochrome) &&
203 (tga_info.image_type != TGARLEColormap) &&
204 (tga_info.image_type != TGARLERGB) &&
205 (tga_info.image_type != TGARLEMonochrome)) ||
206 (((tga_info.image_type == TGAColormap) ||
207 (tga_info.image_type == TGARLEColormap)) &&
208 (tga_info.colormap_type == 0)))
209 ThrowReaderException(CorruptImageError,"ImproperImageHeader");
210 tga_info.colormap_index=ReadBlobLSBShort(image);
211 tga_info.colormap_length=ReadBlobLSBShort(image);
212 tga_info.colormap_size=(unsigned char) ReadBlobByte(image);
213 tga_info.x_origin=ReadBlobLSBShort(image);
214 tga_info.y_origin=ReadBlobLSBShort(image);
215 tga_info.width=(unsigned short) ReadBlobLSBShort(image);
216 tga_info.height=(unsigned short) ReadBlobLSBShort(image);
217 tga_info.bits_per_pixel=(unsigned char) ReadBlobByte(image);
218 tga_info.attributes=(unsigned char) ReadBlobByte(image);
219 if (EOFBlob(image) != MagickFalse)
220 ThrowReaderException(CorruptImageError,"UnableToReadImageData");
221 if ((((tga_info.bits_per_pixel <= 1) || (tga_info.bits_per_pixel >= 17)) &&
222 (tga_info.bits_per_pixel != 24) && (tga_info.bits_per_pixel != 32)))
223 ThrowReaderException(CorruptImageError,"ImproperImageHeader");
225 Initialize image structure.
227 image->columns=tga_info.width;
228 image->rows=tga_info.height;
229 alpha_bits=(tga_info.attributes & 0x0FU);
230 image->alpha_trait=(alpha_bits > 0) || (tga_info.bits_per_pixel == 32) ?
231 BlendPixelTrait : UndefinedPixelTrait;
232 if ((tga_info.image_type != TGAColormap) &&
233 (tga_info.image_type != TGARLEColormap))
234 image->depth=(size_t) ((tga_info.bits_per_pixel <= 8) ? 8 :
235 (tga_info.bits_per_pixel <= 16) ? 5 :
236 (tga_info.bits_per_pixel == 24) ? 8 :
237 (tga_info.bits_per_pixel == 32) ? 8 : 8);
239 image->depth=(size_t) ((tga_info.colormap_size <= 8) ? 8 :
240 (tga_info.colormap_size <= 16) ? 5 :
241 (tga_info.colormap_size == 24) ? 8 :
242 (tga_info.colormap_size == 32) ? 8 : 8);
243 if ((tga_info.image_type == TGAColormap) ||
244 (tga_info.image_type == TGAMonochrome) ||
245 (tga_info.image_type == TGARLEColormap) ||
246 (tga_info.image_type == TGARLEMonochrome))
247 image->storage_class=PseudoClass;
248 image->compression=NoCompression;
249 if ((tga_info.image_type == TGARLEColormap) ||
250 (tga_info.image_type == TGARLEMonochrome))
251 image->compression=RLECompression;
252 if (image->storage_class == PseudoClass)
254 if (tga_info.colormap_type != 0)
255 image->colors=tga_info.colormap_length;
262 image->colors=one << tga_info.bits_per_pixel;
263 if (AcquireImageColormap(image,image->colors,exception) == MagickFalse)
264 ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
267 if (tga_info.id_length != 0)
278 length=(size_t) tga_info.id_length;
279 comment=(char *) NULL;
280 if (~length >= (MaxTextExtent-1))
281 comment=(char *) AcquireQuantumMemory(length+MaxTextExtent,
283 if (comment == (char *) NULL)
284 ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
285 count=ReadBlob(image,tga_info.id_length,(unsigned char *) comment);
286 comment[tga_info.id_length]='\0';
287 (void) SetImageProperty(image,"comment",comment,exception);
288 comment=DestroyString(comment);
290 (void) ResetMagickMemory(&pixel,0,sizeof(pixel));
291 pixel.alpha=(MagickRealType) OpaqueAlpha;
292 if (tga_info.colormap_type != 0)
295 Read TGA raster colormap.
297 if (AcquireImageColormap(image,image->colors,exception) == MagickFalse)
298 ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
299 for (i=0; i < (ssize_t) image->colors; i++)
301 switch (tga_info.colormap_size)
309 pixel.red=(MagickRealType) ScaleCharToQuantum((unsigned char)
310 ReadBlobByte(image));
311 pixel.green=pixel.red;
312 pixel.blue=pixel.red;
322 5 bits each of red green and blue.
324 j=(unsigned char) ReadBlobByte(image);
325 k=(unsigned char) ReadBlobByte(image);
326 range=GetQuantumRange(5UL);
327 pixel.red=(MagickRealType) ScaleAnyToQuantum(1UL*(k & 0x7c) >> 2,
329 pixel.green=(MagickRealType) ScaleAnyToQuantum((1UL*(k & 0x03)
330 << 3)+(1UL*(j & 0xe0) >> 5),range);
331 pixel.blue=(MagickRealType) ScaleAnyToQuantum(1UL*(j & 0x1f),range);
338 8 bits each of blue, green and red.
340 pixel.blue=(MagickRealType) ScaleCharToQuantum((unsigned char)
341 ReadBlobByte(image));
342 pixel.green=(MagickRealType) ScaleCharToQuantum((unsigned char)
343 ReadBlobByte(image));
344 pixel.red=(MagickRealType) ScaleCharToQuantum((unsigned char)
345 ReadBlobByte(image));
349 image->colormap[i]=pixel;
353 Convert TGA pixels to pixel packets.
362 for (y=0; y < (ssize_t) image->rows; y++)
365 if (((unsigned char) (tga_info.attributes & 0x20) >> 5) == 0)
366 real=image->rows-real-1;
367 q=QueueAuthenticPixels(image,0,(ssize_t) real,image->columns,1,exception);
368 if (q == (Quantum *) NULL)
370 for (x=0; x < (ssize_t) image->columns; x++)
372 if ((tga_info.image_type == TGARLEColormap) ||
373 (tga_info.image_type == TGARLERGB) ||
374 (tga_info.image_type == TGARLEMonochrome))
383 count=ReadBlob(image,1,&runlength);
385 ThrowReaderException(CorruptImageError,"UnableToReadImageData");
386 flag=runlength & 0x80;
392 if (skip == MagickFalse)
393 switch (tga_info.bits_per_pixel)
401 index=(Quantum) ReadBlobByte(image);
402 if (tga_info.colormap_type != 0)
403 pixel=image->colormap[(ssize_t) ConstrainColormapIndex(image,
404 1UL*index,exception)];
407 pixel.red=(MagickRealType) ScaleCharToQuantum((unsigned char)
409 pixel.green=(MagickRealType) ScaleCharToQuantum((unsigned char)
411 pixel.blue=(MagickRealType) ScaleCharToQuantum((unsigned char)
425 if (ReadBlob(image,2,pixels) != 2)
426 ThrowReaderException(CorruptImageError,"UnableToReadImageData");
429 range=GetQuantumRange(5UL);
430 pixel.red=(MagickRealType) ScaleAnyToQuantum(1UL*(k & 0x7c) >> 2,
432 pixel.green=(MagickRealType) ScaleAnyToQuantum((1UL*(k & 0x03)
433 << 3)+(1UL*(j & 0xe0) >> 5),range);
434 pixel.blue=(MagickRealType) ScaleAnyToQuantum(1UL*(j & 0x1f),range);
435 if (image->alpha_trait == BlendPixelTrait)
436 pixel.alpha=(MagickRealType) ((k & 0x80) == 0 ? (Quantum)
437 OpaqueAlpha : (Quantum) TransparentAlpha);
438 if (image->storage_class == PseudoClass)
439 index=ConstrainColormapIndex(image,((size_t) k << 8)+j,exception);
447 if (ReadBlob(image,3,pixels) != 3)
448 ThrowReaderException(CorruptImageError,"UnableToReadImageData");
449 pixel.blue=(MagickRealType) ScaleCharToQuantum(pixels[0]);
450 pixel.green=(MagickRealType) ScaleCharToQuantum(pixels[1]);
451 pixel.red=(MagickRealType) ScaleCharToQuantum(pixels[2]);
459 if (ReadBlob(image,4,pixels) != 4)
460 ThrowReaderException(CorruptImageError,"UnableToReadImageData");
461 pixel.blue=(MagickRealType) ScaleCharToQuantum(pixels[0]);
462 pixel.green=(MagickRealType) ScaleCharToQuantum(pixels[1]);
463 pixel.red=(MagickRealType) ScaleCharToQuantum(pixels[2]);
464 pixel.alpha=(MagickRealType) ScaleCharToQuantum(pixels[3]);
468 if (status == MagickFalse)
469 ThrowReaderException(CorruptImageError,"UnableToReadImageData");
470 if (image->storage_class == PseudoClass)
471 SetPixelIndex(image,index,q);
472 SetPixelRed(image,ClampToQuantum(pixel.red),q);
473 SetPixelGreen(image,ClampToQuantum(pixel.green),q);
474 SetPixelBlue(image,ClampToQuantum(pixel.blue),q);
475 if (image->alpha_trait == BlendPixelTrait)
476 SetPixelAlpha(image,ClampToQuantum(pixel.alpha),q);
477 q+=GetPixelChannels(image);
479 if (((unsigned char) (tga_info.attributes & 0xc0) >> 6) == 4)
482 if (((unsigned char) (tga_info.attributes & 0xc0) >> 6) == 2)
486 if (offset >= image->rows)
491 if (SyncAuthenticPixels(image,exception) == MagickFalse)
493 if (image->previous == (Image *) NULL)
495 status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,
497 if (status == MagickFalse)
501 if (EOFBlob(image) != MagickFalse)
502 ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile",
504 (void) CloseBlob(image);
505 return(GetFirstImageInList(image));
509 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
513 % R e g i s t e r T G A I m a g e %
517 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
519 % RegisterTGAImage() adds properties for the TGA image format to
520 % the list of supported formats. The properties include the image format
521 % tag, a method to read and/or write the format, whether the format
522 % supports the saving of more than one frame to the same file or blob,
523 % whether the format supports native in-memory I/O, and a brief
524 % description of the format.
526 % The format of the RegisterTGAImage method is:
528 % size_t RegisterTGAImage(void)
531 ModuleExport size_t RegisterTGAImage(void)
536 entry=SetMagickInfo("ICB");
537 entry->decoder=(DecodeImageHandler *) ReadTGAImage;
538 entry->encoder=(EncodeImageHandler *) WriteTGAImage;
539 entry->adjoin=MagickFalse;
540 entry->description=ConstantString("Truevision Targa image");
541 entry->module=ConstantString("TGA");
542 (void) RegisterMagickInfo(entry);
543 entry=SetMagickInfo("TGA");
544 entry->decoder=(DecodeImageHandler *) ReadTGAImage;
545 entry->encoder=(EncodeImageHandler *) WriteTGAImage;
546 entry->adjoin=MagickFalse;
547 entry->description=ConstantString("Truevision Targa image");
548 entry->module=ConstantString("TGA");
549 (void) RegisterMagickInfo(entry);
550 entry=SetMagickInfo("VDA");
551 entry->decoder=(DecodeImageHandler *) ReadTGAImage;
552 entry->encoder=(EncodeImageHandler *) WriteTGAImage;
553 entry->adjoin=MagickFalse;
554 entry->description=ConstantString("Truevision Targa image");
555 entry->module=ConstantString("TGA");
556 (void) RegisterMagickInfo(entry);
557 entry=SetMagickInfo("VST");
558 entry->decoder=(DecodeImageHandler *) ReadTGAImage;
559 entry->encoder=(EncodeImageHandler *) WriteTGAImage;
560 entry->adjoin=MagickFalse;
561 entry->description=ConstantString("Truevision Targa image");
562 entry->module=ConstantString("TGA");
563 (void) RegisterMagickInfo(entry);
564 return(MagickImageCoderSignature);
568 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
572 % U n r e g i s t e r T G A I m a g e %
576 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
578 % UnregisterTGAImage() removes format registrations made by the
579 % TGA module from the list of supported formats.
581 % The format of the UnregisterTGAImage method is:
583 % UnregisterTGAImage(void)
586 ModuleExport void UnregisterTGAImage(void)
588 (void) UnregisterMagickInfo("ICB");
589 (void) UnregisterMagickInfo("TGA");
590 (void) UnregisterMagickInfo("VDA");
591 (void) UnregisterMagickInfo("VST");
595 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
599 % W r i t e T G A I m a g e %
603 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
605 % WriteTGAImage() writes a image in the Truevision Targa rasterfile
608 % The format of the WriteTGAImage method is:
610 % MagickBooleanType WriteTGAImage(const ImageInfo *image_info,
611 % Image *image,ExceptionInfo *exception)
613 % A description of each parameter follows.
615 % o image_info: the image info.
617 % o image: The image.
621 static inline size_t MagickMin(const size_t x,const size_t y)
628 static MagickBooleanType WriteTGAImage(const ImageInfo *image_info,Image *image,
629 ExceptionInfo *exception)
631 #define TargaColormap 1
633 #define TargaMonochrome 3
634 #define TargaRLEColormap 9
635 #define TargaRLERGB 10
636 #define TargaRLEMonochrome 11
638 typedef struct _TargaInfo
669 register const Quantum
678 register unsigned char
692 Open output image file.
694 assert(image_info != (const ImageInfo *) NULL);
695 assert(image_info->signature == MagickSignature);
696 assert(image != (Image *) NULL);
697 assert(image->signature == MagickSignature);
698 if (image->debug != MagickFalse)
699 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
700 assert(exception != (ExceptionInfo *) NULL);
701 assert(exception->signature == MagickSignature);
702 status=OpenBlob(image_info,image,WriteBinaryBlobMode,exception);
703 if (status == MagickFalse)
706 Initialize TGA raster file header.
708 if ((image->columns > 65535L) || (image->rows > 65535L))
709 ThrowWriterException(ImageError,"WidthOrHeightExceedsLimit");
710 if (IssRGBCompatibleColorspace(image->colorspace) == MagickFalse)
711 (void) TransformImageColorspace(image,sRGBColorspace,exception);
712 targa_info.id_length=0;
713 value=GetImageProperty(image,"comment",exception);
714 if (value != (const char *) NULL)
715 targa_info.id_length=(unsigned char) MagickMin(strlen(value),255);
716 targa_info.colormap_type=0;
717 targa_info.colormap_index=0;
718 targa_info.colormap_length=0;
719 targa_info.colormap_size=0;
720 targa_info.x_origin=0;
721 targa_info.y_origin=0;
722 targa_info.width=(unsigned short) image->columns;
723 targa_info.height=(unsigned short) image->rows;
724 targa_info.bits_per_pixel=8;
725 targa_info.attributes=0;
726 if ((image_info->type != TrueColorType) &&
727 (image_info->type != TrueColorMatteType) &&
728 (image_info->type != PaletteType) &&
729 (image->alpha_trait != BlendPixelTrait) &&
730 (IsImageGray(image,exception) != MagickFalse))
731 targa_info.image_type=TargaMonochrome;
733 if ((image->storage_class == DirectClass) || (image->colors > 256))
736 Full color TGA raster.
738 targa_info.image_type=TargaRGB;
739 targa_info.bits_per_pixel=24;
740 if (image->alpha_trait == BlendPixelTrait)
742 targa_info.bits_per_pixel=32;
743 targa_info.attributes=8; /* # of alpha bits */
749 Colormapped TGA raster.
751 targa_info.image_type=TargaColormap;
752 targa_info.colormap_type=1;
753 targa_info.colormap_length=(unsigned short) image->colors;
754 targa_info.colormap_size=24;
759 (void) WriteBlobByte(image,targa_info.id_length);
760 (void) WriteBlobByte(image,targa_info.colormap_type);
761 (void) WriteBlobByte(image,targa_info.image_type);
762 (void) WriteBlobLSBShort(image,targa_info.colormap_index);
763 (void) WriteBlobLSBShort(image,targa_info.colormap_length);
764 (void) WriteBlobByte(image,targa_info.colormap_size);
765 (void) WriteBlobLSBShort(image,targa_info.x_origin);
766 (void) WriteBlobLSBShort(image,targa_info.y_origin);
767 (void) WriteBlobLSBShort(image,targa_info.width);
768 (void) WriteBlobLSBShort(image,targa_info.height);
769 (void) WriteBlobByte(image,targa_info.bits_per_pixel);
770 (void) WriteBlobByte(image,targa_info.attributes);
771 if (targa_info.id_length != 0)
772 (void) WriteBlob(image,targa_info.id_length,(unsigned char *)
774 if (targa_info.image_type == TargaColormap)
780 Dump colormap to file (blue, green, red byte order).
782 targa_colormap=(unsigned char *) AcquireQuantumMemory((size_t)
783 targa_info.colormap_length,3UL*sizeof(*targa_colormap));
784 if (targa_colormap == (unsigned char *) NULL)
785 ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
787 for (i=0; i < (ssize_t) image->colors; i++)
789 *q++=ScaleQuantumToChar(ClampToQuantum(image->colormap[i].blue));
790 *q++=ScaleQuantumToChar(ClampToQuantum(image->colormap[i].green));
791 *q++=ScaleQuantumToChar(ClampToQuantum(image->colormap[i].red));
793 (void) WriteBlob(image,(size_t) (3*targa_info.colormap_length),
795 targa_colormap=(unsigned char *) RelinquishMagickMemory(targa_colormap);
798 Convert MIFF to TGA raster pixels.
800 count=(ssize_t) (targa_info.bits_per_pixel*targa_info.width)/8;
801 targa_pixels=(unsigned char *) AcquireQuantumMemory((size_t) count,
802 sizeof(*targa_pixels));
803 if (targa_pixels == (unsigned char *) NULL)
804 ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
805 for (y=(ssize_t) (image->rows-1); y >= 0; y--)
807 p=GetVirtualPixels(image,0,y,image->columns,1,exception);
808 if (p == (const Quantum *) NULL)
811 for (x=0; x < (ssize_t) image->columns; x++)
813 if (targa_info.image_type == TargaColormap)
814 *q++=(unsigned char) GetPixelIndex(image,p);
816 if (targa_info.image_type == TargaMonochrome)
817 *q++=(unsigned char) ScaleQuantumToChar((ClampToQuantum(
818 GetPixelIntensity(image,p))));
821 *q++=ScaleQuantumToChar(GetPixelBlue(image,p));
822 *q++=ScaleQuantumToChar(GetPixelGreen(image,p));
823 *q++=ScaleQuantumToChar(GetPixelRed(image,p));
824 if (image->alpha_trait == BlendPixelTrait)
825 *q++=(unsigned char) ScaleQuantumToChar(GetPixelAlpha(image,p));
827 p+=GetPixelChannels(image);
829 (void) WriteBlob(image,(size_t) (q-targa_pixels),targa_pixels);
830 if (image->previous == (Image *) NULL)
832 status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,
834 if (status == MagickFalse)
838 targa_pixels=(unsigned char *) RelinquishMagickMemory(targa_pixels);
839 (void) CloseBlob(image);