Lines Matching full:image

13 %               Read/Write PBMPlus Portable Anymap Image Format               %
53 #include "MagickCore/image.h"
54 #include "MagickCore/image-private.h"
85 WritePNMImage(const ImageInfo *,Image *,ExceptionInfo *);
98 % IsPNM() returns MagickTrue if the image format type, identified by the
107 % o magick: compare image format pattern against these bytes.
136 % ReadPNMImage() reads a Portable Anymap image file and returns it.
137 % It allocates the memory necessary for the new Image structure and returns
138 % a pointer to the new image.
142 % Image *ReadPNMImage(const ImageInfo *image_info,ExceptionInfo *exception)
146 % o image_info: the image info.
152 static int PNMComment(Image *image,CommentInfo *comment_info, in PNMComment() argument
178 c=ReadBlobByte(image); in PNMComment()
188 static unsigned int PNMInteger(Image *image,CommentInfo *comment_info, in PNMInteger() argument
202 c=ReadBlobByte(image); in PNMInteger()
206 c=PNMComment(image,comment_info,exception); in PNMInteger()
222 c=ReadBlobByte(image); in PNMInteger()
227 c=PNMComment(image,comment_info,exception); in PNMInteger()
231 static char *PNMString(Image *image,char *string,const size_t extent) in PNMString() argument
241 c=ReadBlobByte(image); in PNMString()
256 static Image *ReadPNMImage(const ImageInfo *image_info,ExceptionInfo *exception) in ReadPNMImage()
277 Image in ReadPNMImage()
278 *image; in ReadPNMImage() local
306 Open image file. in ReadPNMImage()
315 image=AcquireImage(image_info,exception); in ReadPNMImage()
316 status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception); in ReadPNMImage()
319 image=DestroyImageList(image); in ReadPNMImage()
320 return((Image *) NULL); in ReadPNMImage()
323 Read PNM image. in ReadPNMImage()
325 count=ReadBlob(image,1,(unsigned char *) &format); in ReadPNMImage()
329 Initialize image structure. in ReadPNMImage()
338 format=(char) ReadBlobByte(image); in ReadPNMImage()
344 if (ReadBlobByte(image) == '4') in ReadPNMImage()
345 image->alpha_trait=BlendPixelTrait; in ReadPNMImage()
346 image->columns=(size_t) PNMInteger(image,&comment_info,10,exception); in ReadPNMImage()
347 image->rows=(size_t) PNMInteger(image,&comment_info,10,exception); in ReadPNMImage()
354 if (PNMString(image,scale,sizeof(scale)) != (char *) NULL) in ReadPNMImage()
362 max_value=(QuantumAny) PNMInteger(image,&comment_info,10, in ReadPNMImage()
381 for (c=ReadBlobByte(image); c != EOF; c=ReadBlobByte(image)) in ReadPNMImage()
384 c=ReadBlobByte(image); in ReadPNMImage()
390 c=PNMComment(image,&comment_info,exception); in ReadPNMImage()
391 c=ReadBlobByte(image); in ReadPNMImage()
393 c=ReadBlobByte(image); in ReadPNMImage()
400 c=ReadBlobByte(image); in ReadPNMImage()
406 c=ReadBlobByte(image); in ReadPNMImage()
412 c=ReadBlobByte(image); in ReadPNMImage()
422 image->rows=StringToUnsignedLong(value); in ReadPNMImage()
430 (void) SetImageColorspace(image,GRAYColorspace,exception); in ReadPNMImage()
435 (void) SetImageColorspace(image,GRAYColorspace,exception); in ReadPNMImage()
436 image->alpha_trait=BlendPixelTrait; in ReadPNMImage()
442 (void) SetImageColorspace(image,GRAYColorspace,exception); in ReadPNMImage()
446 (void) SetImageColorspace(image,GRAYColorspace,exception); in ReadPNMImage()
447 image->alpha_trait=BlendPixelTrait; in ReadPNMImage()
452 image->alpha_trait=BlendPixelTrait; in ReadPNMImage()
457 (void) SetImageColorspace(image,CMYKColorspace,exception); in ReadPNMImage()
462 (void) SetImageColorspace(image,CMYKColorspace,exception); in ReadPNMImage()
463 image->alpha_trait=BlendPixelTrait; in ReadPNMImage()
468 image->columns=StringToUnsignedLong(value); in ReadPNMImage()
473 if ((image->columns == 0) || (image->rows == 0)) in ReadPNMImage()
478 image->depth=depth; in ReadPNMImage()
480 if (image->scene >= (image_info->scene+image_info->number_scenes-1)) in ReadPNMImage()
482 if ((MagickSizeType) (image->columns*image->rows/8) > GetBlobSize(image)) in ReadPNMImage()
484 status=SetImageExtent(image,image->columns,image->rows,exception); in ReadPNMImage()
488 return(DestroyImageList(image)); in ReadPNMImage()
490 (void) ResetImagePixels(image,exception); in ReadPNMImage()
501 Convert PBM image to pixel packets. in ReadPNMImage()
503 (void) SetImageColorspace(image,GRAYColorspace,exception); in ReadPNMImage()
504 for (y=0; y < (ssize_t) image->rows; y++) in ReadPNMImage()
512 q=QueueAuthenticPixels(image,0,y,image->columns,1,exception); in ReadPNMImage()
515 for (x=0; x < (ssize_t) image->columns; x++) in ReadPNMImage()
517 SetPixelGray(image,PNMInteger(image,&comment_info,2,exception) == in ReadPNMImage()
519 if (EOFBlob(image) != MagickFalse) in ReadPNMImage()
521 q+=GetPixelChannels(image); in ReadPNMImage()
523 if (SyncAuthenticPixels(image,exception) == MagickFalse) in ReadPNMImage()
525 if (image->previous == (Image *) NULL) in ReadPNMImage()
527 status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y, in ReadPNMImage()
528 image->rows); in ReadPNMImage()
532 if (EOFBlob(image) != MagickFalse) in ReadPNMImage()
535 image->type=BilevelType; in ReadPNMImage()
544 Convert PGM image to pixel packets. in ReadPNMImage()
546 (void) SetImageColorspace(image,GRAYColorspace,exception); in ReadPNMImage()
547 for (y=0; y < (ssize_t) image->rows; y++) in ReadPNMImage()
555 q=QueueAuthenticPixels(image,0,y,image->columns,1,exception); in ReadPNMImage()
558 for (x=0; x < (ssize_t) image->columns; x++) in ReadPNMImage()
560 intensity=ScaleAnyToQuantum(PNMInteger(image,&comment_info,10, in ReadPNMImage()
562 if (EOFBlob(image) != MagickFalse) in ReadPNMImage()
564 SetPixelGray(image,intensity,q); in ReadPNMImage()
565 q+=GetPixelChannels(image); in ReadPNMImage()
567 if (SyncAuthenticPixels(image,exception) == MagickFalse) in ReadPNMImage()
569 if (image->previous == (Image *) NULL) in ReadPNMImage()
571 status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y, in ReadPNMImage()
572 image->rows); in ReadPNMImage()
576 if (EOFBlob(image) != MagickFalse) in ReadPNMImage()
579 image->type=GrayscaleType; in ReadPNMImage()
585 Convert PNM image to pixel packets. in ReadPNMImage()
587 for (y=0; y < (ssize_t) image->rows; y++) in ReadPNMImage()
595 q=QueueAuthenticPixels(image,0,y,image->columns,1,exception); in ReadPNMImage()
598 for (x=0; x < (ssize_t) image->columns; x++) in ReadPNMImage()
603 pixel=ScaleAnyToQuantum(PNMInteger(image,&comment_info,10, in ReadPNMImage()
605 if (EOFBlob(image) != MagickFalse) in ReadPNMImage()
607 SetPixelRed(image,pixel,q); in ReadPNMImage()
608 pixel=ScaleAnyToQuantum(PNMInteger(image,&comment_info,10, in ReadPNMImage()
610 SetPixelGreen(image,pixel,q); in ReadPNMImage()
611 pixel=ScaleAnyToQuantum(PNMInteger(image,&comment_info,10, in ReadPNMImage()
613 SetPixelBlue(image,pixel,q); in ReadPNMImage()
614 q+=GetPixelChannels(image); in ReadPNMImage()
616 if (SyncAuthenticPixels(image,exception) == MagickFalse) in ReadPNMImage()
618 if (image->previous == (Image *) NULL) in ReadPNMImage()
620 status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y, in ReadPNMImage()
621 image->rows); in ReadPNMImage()
625 if (EOFBlob(image) != MagickFalse) in ReadPNMImage()
633 Convert PBM raw image to pixel packets. in ReadPNMImage()
635 (void) SetImageColorspace(image,GRAYColorspace,exception); in ReadPNMImage()
637 if (image->storage_class == PseudoClass) in ReadPNMImage()
639 quantum_info=AcquireQuantumInfo(image_info,image); in ReadPNMImage()
643 extent=GetQuantumExtent(image,quantum_info,quantum_type); in ReadPNMImage()
645 for (y=0; y < (ssize_t) image->rows; y++) in ReadPNMImage()
659 stream=ReadBlobStream(image,extent,pixels,&count); in ReadPNMImage()
662 if ((image->progress_monitor != (MagickProgressMonitor) NULL) && in ReadPNMImage()
663 (image->previous == (Image *) NULL)) in ReadPNMImage()
668 proceed=SetImageProgress(image,LoadImageTag,(MagickOffsetType) in ReadPNMImage()
669 row,image->rows); in ReadPNMImage()
674 q=QueueAuthenticPixels(image,0,offset,image->columns,1,exception); in ReadPNMImage()
677 length=ImportQuantumPixels(image,(CacheView *) NULL,quantum_info, in ReadPNMImage()
681 sync=SyncAuthenticPixels(image,exception); in ReadPNMImage()
686 SetQuantumImageType(image,quantum_type); in ReadPNMImage()
692 Convert PGM raw image to pixel packets. in ReadPNMImage()
694 (void) SetImageColorspace(image,GRAYColorspace,exception); in ReadPNMImage()
696 extent=(image->depth <= 8 ? 1 : image->depth <= 16 ? 2 : 4)* in ReadPNMImage()
697 image->columns; in ReadPNMImage()
698 quantum_info=AcquireQuantumInfo(image_info,image); in ReadPNMImage()
702 for (y=0; y < (ssize_t) image->rows; y++) in ReadPNMImage()
719 stream=ReadBlobStream(image,extent,pixels,&count); in ReadPNMImage()
722 if ((image->progress_monitor != (MagickProgressMonitor) NULL) && in ReadPNMImage()
723 (image->previous == (Image *) NULL)) in ReadPNMImage()
728 proceed=SetImageProgress(image,LoadImageTag,(MagickOffsetType) in ReadPNMImage()
729 row,image->rows); in ReadPNMImage()
734 q=QueueAuthenticPixels(image,0,offset,image->columns,1,exception); in ReadPNMImage()
738 switch (image->depth) in ReadPNMImage()
744 (void) ImportQuantumPixels(image,(CacheView *) NULL,quantum_info, in ReadPNMImage()
750 if (image->depth <= 8) in ReadPNMImage()
755 for (x=0; x < (ssize_t) image->columns; x++) in ReadPNMImage()
758 SetPixelGray(image,ScaleAnyToQuantum(pixel,max_value),q); in ReadPNMImage()
759 q+=GetPixelChannels(image); in ReadPNMImage()
762 else if (image->depth <= 16) in ReadPNMImage()
767 for (x=0; x < (ssize_t) image->columns; x++) in ReadPNMImage()
770 SetPixelGray(image,ScaleAnyToQuantum(pixel,max_value),q); in ReadPNMImage()
771 q+=GetPixelChannels(image); in ReadPNMImage()
779 for (x=0; x < (ssize_t) image->columns; x++) in ReadPNMImage()
782 SetPixelGray(image,ScaleAnyToQuantum(pixel,max_value),q); in ReadPNMImage()
783 q+=GetPixelChannels(image); in ReadPNMImage()
789 sync=SyncAuthenticPixels(image,exception); in ReadPNMImage()
794 SetQuantumImageType(image,quantum_type); in ReadPNMImage()
800 Convert PNM raster image to pixel packets. in ReadPNMImage()
803 extent=3*(image->depth <= 8 ? 1 : image->depth <= 16 ? 2 : 4)* in ReadPNMImage()
804 image->columns; in ReadPNMImage()
805 quantum_info=AcquireQuantumInfo(image_info,image); in ReadPNMImage()
808 (void) SetQuantumEndian(image,quantum_info,MSBEndian); in ReadPNMImage()
810 for (y=0; y < (ssize_t) image->rows; y++) in ReadPNMImage()
827 stream=ReadBlobStream(image,extent,pixels,&count); in ReadPNMImage()
830 if ((image->progress_monitor != (MagickProgressMonitor) NULL) && in ReadPNMImage()
831 (image->previous == (Image *) NULL)) in ReadPNMImage()
836 proceed=SetImageProgress(image,LoadImageTag,(MagickOffsetType) in ReadPNMImage()
837 row,image->rows); in ReadPNMImage()
842 q=QueueAuthenticPixels(image,0,offset,image->columns,1,exception); in ReadPNMImage()
846 switch (image->depth) in ReadPNMImage()
850 for (x=0; x < (ssize_t) image->columns; x++) in ReadPNMImage()
852 SetPixelRed(image,ScaleCharToQuantum(*p++),q); in ReadPNMImage()
853 SetPixelGreen(image,ScaleCharToQuantum(*p++),q); in ReadPNMImage()
854 SetPixelBlue(image,ScaleCharToQuantum(*p++),q); in ReadPNMImage()
855 SetPixelAlpha(image,OpaqueAlpha,q); in ReadPNMImage()
856 q+=GetPixelChannels(image); in ReadPNMImage()
865 for (x=0; x < (ssize_t) image->columns; x++) in ReadPNMImage()
868 SetPixelRed(image,ScaleShortToQuantum(pixel),q); in ReadPNMImage()
870 SetPixelGreen(image,ScaleShortToQuantum(pixel),q); in ReadPNMImage()
872 SetPixelBlue(image,ScaleShortToQuantum(pixel),q); in ReadPNMImage()
873 SetPixelAlpha(image,OpaqueAlpha,q); in ReadPNMImage()
874 q+=GetPixelChannels(image); in ReadPNMImage()
883 for (x=0; x < (ssize_t) image->columns; x++) in ReadPNMImage()
886 SetPixelRed(image,ScaleLongToQuantum(pixel),q); in ReadPNMImage()
888 SetPixelGreen(image,ScaleLongToQuantum(pixel),q); in ReadPNMImage()
890 SetPixelBlue(image,ScaleLongToQuantum(pixel),q); in ReadPNMImage()
891 SetPixelAlpha(image,OpaqueAlpha,q); in ReadPNMImage()
892 q+=GetPixelChannels(image); in ReadPNMImage()
898 if (image->depth <= 8) in ReadPNMImage()
903 for (x=0; x < (ssize_t) image->columns; x++) in ReadPNMImage()
906 SetPixelRed(image,ScaleAnyToQuantum(pixel,max_value),q); in ReadPNMImage()
908 SetPixelGreen(image,ScaleAnyToQuantum(pixel,max_value),q); in ReadPNMImage()
910 SetPixelBlue(image,ScaleAnyToQuantum(pixel,max_value),q); in ReadPNMImage()
911 SetPixelAlpha(image,OpaqueAlpha,q); in ReadPNMImage()
912 q+=GetPixelChannels(image); in ReadPNMImage()
915 else if (image->depth <= 16) in ReadPNMImage()
920 for (x=0; x < (ssize_t) image->columns; x++) in ReadPNMImage()
923 SetPixelRed(image,ScaleAnyToQuantum(pixel,max_value),q); in ReadPNMImage()
925 SetPixelGreen(image,ScaleAnyToQuantum(pixel,max_value),q); in ReadPNMImage()
927 SetPixelBlue(image,ScaleAnyToQuantum(pixel,max_value),q); in ReadPNMImage()
928 SetPixelAlpha(image,OpaqueAlpha,q); in ReadPNMImage()
929 q+=GetPixelChannels(image); in ReadPNMImage()
937 for (x=0; x < (ssize_t) image->columns; x++) in ReadPNMImage()
940 SetPixelRed(image,ScaleAnyToQuantum(pixel,max_value),q); in ReadPNMImage()
942 SetPixelGreen(image,ScaleAnyToQuantum(pixel,max_value),q); in ReadPNMImage()
944 SetPixelBlue(image,ScaleAnyToQuantum(pixel,max_value),q); in ReadPNMImage()
945 SetPixelAlpha(image,OpaqueAlpha,q); in ReadPNMImage()
946 q+=GetPixelChannels(image); in ReadPNMImage()
952 sync=SyncAuthenticPixels(image,exception); in ReadPNMImage()
965 Convert PAM raster image to pixel packets. in ReadPNMImage()
987 if (image->alpha_trait != UndefinedPixelTrait) in ReadPNMImage()
989 extent=channels*(image->depth <= 8 ? 1 : image->depth <= 16 ? 2 : 4)* in ReadPNMImage()
990 image->columns; in ReadPNMImage()
991 quantum_info=AcquireQuantumInfo(image_info,image); in ReadPNMImage()
995 for (y=0; y < (ssize_t) image->rows; y++) in ReadPNMImage()
1012 stream=ReadBlobStream(image,extent,pixels,&count); in ReadPNMImage()
1015 if ((image->progress_monitor != (MagickProgressMonitor) NULL) && in ReadPNMImage()
1016 (image->previous == (Image *) NULL)) in ReadPNMImage()
1021 proceed=SetImageProgress(image,LoadImageTag,(MagickOffsetType) in ReadPNMImage()
1022 row,image->rows); in ReadPNMImage()
1027 q=QueueAuthenticPixels(image,0,offset,image->columns,1,exception); in ReadPNMImage()
1031 switch (image->depth) in ReadPNMImage()
1037 (void) ImportQuantumPixels(image,(CacheView *) NULL,quantum_info, in ReadPNMImage()
1048 if (image->depth <= 8) in ReadPNMImage()
1053 for (x=0; x < (ssize_t) image->columns; x++) in ReadPNMImage()
1056 SetPixelGray(image,ScaleAnyToQuantum(pixel,max_value), in ReadPNMImage()
1058 SetPixelAlpha(image,OpaqueAlpha,q); in ReadPNMImage()
1059 if (image->alpha_trait != UndefinedPixelTrait) in ReadPNMImage()
1062 if (image->depth != 1) in ReadPNMImage()
1063 SetPixelAlpha(image,ScaleAnyToQuantum(pixel, in ReadPNMImage()
1066 SetPixelAlpha(image,QuantumRange- in ReadPNMImage()
1069 q+=GetPixelChannels(image); in ReadPNMImage()
1072 else if (image->depth <= 16) in ReadPNMImage()
1077 for (x=0; x < (ssize_t) image->columns; x++) in ReadPNMImage()
1080 SetPixelGray(image,ScaleAnyToQuantum(pixel,max_value), in ReadPNMImage()
1082 SetPixelAlpha(image,OpaqueAlpha,q); in ReadPNMImage()
1083 if (image->alpha_trait != UndefinedPixelTrait) in ReadPNMImage()
1086 SetPixelAlpha(image,ScaleAnyToQuantum(pixel, in ReadPNMImage()
1089 q+=GetPixelChannels(image); in ReadPNMImage()
1097 for (x=0; x < (ssize_t) image->columns; x++) in ReadPNMImage()
1100 SetPixelGray(image,ScaleAnyToQuantum(pixel,max_value), in ReadPNMImage()
1102 SetPixelAlpha(image,OpaqueAlpha,q); in ReadPNMImage()
1103 if (image->alpha_trait != UndefinedPixelTrait) in ReadPNMImage()
1106 SetPixelAlpha(image,ScaleAnyToQuantum(pixel, in ReadPNMImage()
1109 q+=GetPixelChannels(image); in ReadPNMImage()
1117 if (image->depth <= 8) in ReadPNMImage()
1122 for (x=0; x < (ssize_t) image->columns; x++) in ReadPNMImage()
1125 SetPixelRed(image,ScaleAnyToQuantum(pixel,max_value),q); in ReadPNMImage()
1127 SetPixelGreen(image,ScaleAnyToQuantum(pixel,max_value), in ReadPNMImage()
1130 SetPixelBlue(image,ScaleAnyToQuantum(pixel,max_value), in ReadPNMImage()
1133 SetPixelBlack(image,ScaleAnyToQuantum(pixel,max_value), in ReadPNMImage()
1135 SetPixelAlpha(image,OpaqueAlpha,q); in ReadPNMImage()
1136 if (image->alpha_trait != UndefinedPixelTrait) in ReadPNMImage()
1139 SetPixelAlpha(image,ScaleAnyToQuantum(pixel, in ReadPNMImage()
1142 q+=GetPixelChannels(image); in ReadPNMImage()
1145 else if (image->depth <= 16) in ReadPNMImage()
1150 for (x=0; x < (ssize_t) image->columns; x++) in ReadPNMImage()
1153 SetPixelRed(image,ScaleAnyToQuantum(pixel,max_value),q); in ReadPNMImage()
1155 SetPixelGreen(image,ScaleAnyToQuantum(pixel,max_value), in ReadPNMImage()
1158 SetPixelBlue(image,ScaleAnyToQuantum(pixel,max_value), in ReadPNMImage()
1161 SetPixelBlack(image,ScaleAnyToQuantum(pixel,max_value), in ReadPNMImage()
1163 SetPixelAlpha(image,OpaqueAlpha,q); in ReadPNMImage()
1164 if (image->alpha_trait != UndefinedPixelTrait) in ReadPNMImage()
1167 SetPixelAlpha(image,ScaleAnyToQuantum(pixel, in ReadPNMImage()
1170 q+=GetPixelChannels(image); in ReadPNMImage()
1178 for (x=0; x < (ssize_t) image->columns; x++) in ReadPNMImage()
1181 SetPixelRed(image,ScaleAnyToQuantum(pixel,max_value), in ReadPNMImage()
1184 SetPixelGreen(image,ScaleAnyToQuantum(pixel,max_value), in ReadPNMImage()
1187 SetPixelBlue(image,ScaleAnyToQuantum(pixel,max_value), in ReadPNMImage()
1190 SetPixelBlack(image,ScaleAnyToQuantum(pixel,max_value), in ReadPNMImage()
1192 SetPixelAlpha(image,OpaqueAlpha,q); in ReadPNMImage()
1193 if (image->alpha_trait != UndefinedPixelTrait) in ReadPNMImage()
1196 SetPixelAlpha(image,ScaleAnyToQuantum(pixel, in ReadPNMImage()
1199 q+=GetPixelChannels(image); in ReadPNMImage()
1206 if (image->depth <= 8) in ReadPNMImage()
1211 for (x=0; x < (ssize_t) image->columns; x++) in ReadPNMImage()
1214 SetPixelRed(image,ScaleAnyToQuantum(pixel,max_value),q); in ReadPNMImage()
1216 SetPixelGreen(image,ScaleAnyToQuantum(pixel,max_value), in ReadPNMImage()
1219 SetPixelBlue(image,ScaleAnyToQuantum(pixel,max_value), in ReadPNMImage()
1221 SetPixelAlpha(image,OpaqueAlpha,q); in ReadPNMImage()
1222 if (image->alpha_trait != UndefinedPixelTrait) in ReadPNMImage()
1225 SetPixelAlpha(image,ScaleAnyToQuantum(pixel, in ReadPNMImage()
1228 q+=GetPixelChannels(image); in ReadPNMImage()
1231 else if (image->depth <= 16) in ReadPNMImage()
1236 for (x=0; x < (ssize_t) image->columns; x++) in ReadPNMImage()
1239 SetPixelRed(image,ScaleAnyToQuantum(pixel,max_value),q); in ReadPNMImage()
1241 SetPixelGreen(image,ScaleAnyToQuantum(pixel,max_value), in ReadPNMImage()
1244 SetPixelBlue(image,ScaleAnyToQuantum(pixel,max_value), in ReadPNMImage()
1246 SetPixelAlpha(image,OpaqueAlpha,q); in ReadPNMImage()
1247 if (image->alpha_trait != UndefinedPixelTrait) in ReadPNMImage()
1250 SetPixelAlpha(image,ScaleAnyToQuantum(pixel, in ReadPNMImage()
1253 q+=GetPixelChannels(image); in ReadPNMImage()
1261 for (x=0; x < (ssize_t) image->columns; x++) in ReadPNMImage()
1264 SetPixelRed(image,ScaleAnyToQuantum(pixel,max_value), in ReadPNMImage()
1267 SetPixelGreen(image,ScaleAnyToQuantum(pixel,max_value), in ReadPNMImage()
1270 SetPixelBlue(image,ScaleAnyToQuantum(pixel,max_value), in ReadPNMImage()
1272 SetPixelAlpha(image,OpaqueAlpha,q); in ReadPNMImage()
1273 if (image->alpha_trait != UndefinedPixelTrait) in ReadPNMImage()
1276 SetPixelAlpha(image,ScaleAnyToQuantum(pixel, in ReadPNMImage()
1279 q+=GetPixelChannels(image); in ReadPNMImage()
1287 sync=SyncAuthenticPixels(image,exception); in ReadPNMImage()
1292 SetQuantumImageType(image,quantum_type); in ReadPNMImage()
1299 Convert PFM raster image to pixel packets. in ReadPNMImage()
1302 quantum_type=image->alpha_trait != UndefinedPixelTrait ? RGBAQuantum : in ReadPNMImage()
1306 (void) SetImageColorspace(image,GRAYColorspace,exception); in ReadPNMImage()
1309 image->endian=quantum_scale < 0.0 ? LSBEndian : MSBEndian; in ReadPNMImage()
1310 image->depth=32; in ReadPNMImage()
1311 quantum_info=AcquireQuantumInfo(image_info,image); in ReadPNMImage()
1314 status=SetQuantumFormat(image,quantum_info,FloatingPointQuantumFormat); in ReadPNMImage()
1318 extent=GetQuantumExtent(image,quantum_info,quantum_type); in ReadPNMImage()
1320 for (y=0; y < (ssize_t) image->rows; y++) in ReadPNMImage()
1334 stream=ReadBlobStream(image,extent,pixels,&count); in ReadPNMImage()
1337 if ((image->progress_monitor != (MagickProgressMonitor) NULL) && in ReadPNMImage()
1338 (image->previous == (Image *) NULL)) in ReadPNMImage()
1343 proceed=SetImageProgress(image,LoadImageTag,(MagickOffsetType) in ReadPNMImage()
1344 row,image->rows); in ReadPNMImage()
1349 q=QueueAuthenticPixels(image,0,(ssize_t) (image->rows-offset-1), in ReadPNMImage()
1350 image->columns,1,exception); in ReadPNMImage()
1353 length=ImportQuantumPixels(image,(CacheView *) NULL,quantum_info, in ReadPNMImage()
1357 sync=SyncAuthenticPixels(image,exception); in ReadPNMImage()
1362 SetQuantumImageType(image,quantum_type); in ReadPNMImage()
1369 Convert PFM raster image to pixel packets. in ReadPNMImage()
1372 quantum_type=image->alpha_trait != UndefinedPixelTrait ? RGBAQuantum : in ReadPNMImage()
1376 (void) SetImageColorspace(image,GRAYColorspace,exception); in ReadPNMImage()
1379 image->endian=quantum_scale < 0.0 ? LSBEndian : MSBEndian; in ReadPNMImage()
1380 image->depth=16; in ReadPNMImage()
1381 quantum_info=AcquireQuantumInfo(image_info,image); in ReadPNMImage()
1384 status=SetQuantumFormat(image,quantum_info,FloatingPointQuantumFormat); in ReadPNMImage()
1388 extent=GetQuantumExtent(image,quantum_info,quantum_type); in ReadPNMImage()
1390 for (y=0; y < (ssize_t) image->rows; y++) in ReadPNMImage()
1404 stream=ReadBlobStream(image,extent,pixels,&count); in ReadPNMImage()
1407 if ((image->progress_monitor != (MagickProgressMonitor) NULL) && in ReadPNMImage()
1408 (image->previous == (Image *) NULL)) in ReadPNMImage()
1413 proceed=SetImageProgress(image,LoadImageTag,(MagickOffsetType) in ReadPNMImage()
1414 row,image->rows); in ReadPNMImage()
1419 q=QueueAuthenticPixels(image,0,(ssize_t) (image->rows-offset-1), in ReadPNMImage()
1420 image->columns,1,exception); in ReadPNMImage()
1423 length=ImportQuantumPixels(image,(CacheView *) NULL,quantum_info, in ReadPNMImage()
1427 sync=SyncAuthenticPixels(image,exception); in ReadPNMImage()
1432 SetQuantumImageType(image,quantum_type); in ReadPNMImage()
1439 (void) SetImageProperty(image,"comment",comment_info.comment,exception); in ReadPNMImage()
1441 if (y < (ssize_t) image->rows) in ReadPNMImage()
1443 if (EOFBlob(image) != MagickFalse) in ReadPNMImage()
1446 CorruptImageError,"UnexpectedEndOfFile","`%s'",image->filename); in ReadPNMImage()
1450 Proceed to next image. in ReadPNMImage()
1453 if (image->scene >= (image_info->scene+image_info->number_scenes-1)) in ReadPNMImage()
1461 count=ReadBlob(image,1,(unsigned char *) &format); in ReadPNMImage()
1467 count=ReadBlob(image,1,(unsigned char *) &format); in ReadPNMImage()
1471 Allocate next image structure. in ReadPNMImage()
1473 AcquireNextImage(image_info,image,exception); in ReadPNMImage()
1474 if (GetNextImageInList(image) == (Image *) NULL) in ReadPNMImage()
1479 image=SyncNextImageInList(image); in ReadPNMImage()
1480 status=SetImageProgress(image,LoadImagesTag,TellBlob(image), in ReadPNMImage()
1481 GetBlobSize(image)); in ReadPNMImage()
1486 (void) CloseBlob(image); in ReadPNMImage()
1488 return(DestroyImageList(image)); in ReadPNMImage()
1489 return(GetFirstImageInList(image)); in ReadPNMImage()
1503 % RegisterPNMImage() adds properties for the PNM image format to
1504 % the list of supported formats. The properties include the image format
1523 entry->mime_type=ConstantString("image/x-portable-anymap"); in RegisterPNMImage()
1530 entry->mime_type=ConstantString("image/x-portable-bitmap"); in RegisterPNMImage()
1542 entry->mime_type=ConstantString("image/x-portable-greymap"); in RegisterPNMImage()
1555 entry->mime_type=ConstantString("image/x-portable-pixmap"); in RegisterPNMImage()
1561 entry->mime_type=ConstantString("image/x-portable-pixmap"); in RegisterPNMImage()
1606 % WritePNMImage() writes an image to a file in the PNM rasterfile format.
1611 % Image *image,ExceptionInfo *exception)
1615 % o image_info: the image info.
1617 % o image: The image.
1622 static MagickBooleanType WritePNMImage(const ImageInfo *image_info,Image *image, in WritePNMImage() argument
1664 Open output image file. in WritePNMImage()
1668 assert(image != (Image *) NULL); in WritePNMImage()
1669 assert(image->signature == MagickCoreSignature); in WritePNMImage()
1670 if (image->debug != MagickFalse) in WritePNMImage()
1671 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename); in WritePNMImage()
1674 status=OpenBlob(image_info,image,WriteBinaryBlobMode,exception); in WritePNMImage()
1678 imageListLength=GetImageListLength(image); in WritePNMImage()
1690 max_value=GetQuantumRange(image->depth); in WritePNMImage()
1712 (SetImageGray(image,exception) != MagickFalse)) in WritePNMImage()
1729 (SetImageGray(image,exception) != MagickFalse)) in WritePNMImage()
1737 (SetImageGray(image,exception) != MagickFalse)) in WritePNMImage()
1742 if (SetImageMonochrome(image,exception) != MagickFalse) in WritePNMImage()
1760 (void) WriteBlobString(image,buffer); in WritePNMImage()
1761 value=GetImageProperty(image,"comment",exception); in WritePNMImage()
1770 (void) WriteBlobByte(image,'#'); in WritePNMImage()
1773 (void) WriteBlobByte(image,(unsigned char) *p); in WritePNMImage()
1775 (void) WriteBlobByte(image,'#'); in WritePNMImage()
1777 (void) WriteBlobByte(image,'\n'); in WritePNMImage()
1782 (double) image->columns,(double) image->rows); in WritePNMImage()
1783 (void) WriteBlobString(image,buffer); in WritePNMImage()
1794 "WIDTH %.20g\nHEIGHT %.20g\n",(double) image->columns,(double) in WritePNMImage()
1795 image->rows); in WritePNMImage()
1796 (void) WriteBlobString(image,buffer); in WritePNMImage()
1797 quantum_type=GetQuantumType(image,exception); in WritePNMImage()
1812 if (IdentifyImageMonochrome(image,exception) != MagickFalse) in WritePNMImage()
1819 if (image->alpha_trait != UndefinedPixelTrait) in WritePNMImage()
1826 if (image->alpha_trait != UndefinedPixelTrait) in WritePNMImage()
1831 if (image->depth > 32) in WritePNMImage()
1832 image->depth=32; in WritePNMImage()
1835 ((MagickOffsetType) GetQuantumRange(image->depth))); in WritePNMImage()
1836 (void) WriteBlobString(image,buffer); in WritePNMImage()
1839 (void) WriteBlobString(image,buffer); in WritePNMImage()
1852 Convert image to a PBM image. in WritePNMImage()
1854 (void) SetImageType(image,BilevelType,exception); in WritePNMImage()
1856 for (y=0; y < (ssize_t) image->rows; y++) in WritePNMImage()
1864 p=GetVirtualPixels(image,0,y,image->columns,1,exception); in WritePNMImage()
1867 for (x=0; x < (ssize_t) image->columns; x++) in WritePNMImage()
1869 *q++=(unsigned char) (GetPixelLuma(image,p) >= (QuantumRange/2.0) ? in WritePNMImage()
1874 (void) WriteBlob(image,q-pixels,pixels); in WritePNMImage()
1878 p+=GetPixelChannels(image); in WritePNMImage()
1881 (void) WriteBlob(image,q-pixels,pixels); in WritePNMImage()
1883 if (image->previous == (Image *) NULL) in WritePNMImage()
1885 status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y, in WritePNMImage()
1886 image->rows); in WritePNMImage()
1894 (void) WriteBlob(image,q-pixels,pixels); in WritePNMImage()
1904 Convert image to a PGM image. in WritePNMImage()
1906 if (image->depth <= 8) in WritePNMImage()
1907 (void) WriteBlobString(image,"255\n"); in WritePNMImage()
1909 if (image->depth <= 16) in WritePNMImage()
1910 (void) WriteBlobString(image,"65535\n"); in WritePNMImage()
1912 (void) WriteBlobString(image,"4294967295\n"); in WritePNMImage()
1914 for (y=0; y < (ssize_t) image->rows; y++) in WritePNMImage()
1922 p=GetVirtualPixels(image,0,y,image->columns,1,exception); in WritePNMImage()
1925 for (x=0; x < (ssize_t) image->columns; x++) in WritePNMImage()
1927 index=ClampToQuantum(GetPixelLuma(image,p)); in WritePNMImage()
1928 if (image->depth <= 8) in WritePNMImage()
1932 if (image->depth <= 16) in WritePNMImage()
1942 (void) WriteBlob(image,q-pixels,pixels); in WritePNMImage()
1947 p+=GetPixelChannels(image); in WritePNMImage()
1950 (void) WriteBlob(image,q-pixels,pixels); in WritePNMImage()
1952 if (image->previous == (Image *) NULL) in WritePNMImage()
1954 status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y, in WritePNMImage()
1955 image->rows); in WritePNMImage()
1963 (void) WriteBlob(image,q-pixels,pixels); in WritePNMImage()
1973 Convert image to a PNM image. in WritePNMImage()
1975 (void) TransformImageColorspace(image,sRGBColorspace,exception); in WritePNMImage()
1976 if (image->depth <= 8) in WritePNMImage()
1977 (void) WriteBlobString(image,"255\n"); in WritePNMImage()
1979 if (image->depth <= 16) in WritePNMImage()
1980 (void) WriteBlobString(image,"65535\n"); in WritePNMImage()
1982 (void) WriteBlobString(image,"4294967295\n"); in WritePNMImage()
1984 for (y=0; y < (ssize_t) image->rows; y++) in WritePNMImage()
1992 p=GetVirtualPixels(image,0,y,image->columns,1,exception); in WritePNMImage()
1995 for (x=0; x < (ssize_t) image->columns; x++) in WritePNMImage()
1997 if (image->depth <= 8) in WritePNMImage()
1999 "%u %u %u ",ScaleQuantumToChar(GetPixelRed(image,p)), in WritePNMImage()
2000 ScaleQuantumToChar(GetPixelGreen(image,p)), in WritePNMImage()
2001 ScaleQuantumToChar(GetPixelBlue(image,p))); in WritePNMImage()
2003 if (image->depth <= 16) in WritePNMImage()
2005 "%u %u %u ",ScaleQuantumToShort(GetPixelRed(image,p)), in WritePNMImage()
2006 ScaleQuantumToShort(GetPixelGreen(image,p)), in WritePNMImage()
2007 ScaleQuantumToShort(GetPixelBlue(image,p))); in WritePNMImage()
2010 "%u %u %u ",ScaleQuantumToLong(GetPixelRed(image,p)), in WritePNMImage()
2011 ScaleQuantumToLong(GetPixelGreen(image,p)), in WritePNMImage()
2012 ScaleQuantumToLong(GetPixelBlue(image,p))); in WritePNMImage()
2017 (void) WriteBlob(image,q-pixels,pixels); in WritePNMImage()
2022 p+=GetPixelChannels(image); in WritePNMImage()
2025 (void) WriteBlob(image,q-pixels,pixels); in WritePNMImage()
2027 if (image->previous == (Image *) NULL) in WritePNMImage()
2029 status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y, in WritePNMImage()
2030 image->rows); in WritePNMImage()
2038 (void) WriteBlob(image,q-pixels,pixels); in WritePNMImage()
2048 Convert image to a PBM image. in WritePNMImage()
2050 (void) SetImageType(image,BilevelType,exception); in WritePNMImage()
2051 image->depth=1; in WritePNMImage()
2052 quantum_info=AcquireQuantumInfo(image_info,image); in WritePNMImage()
2056 (void) SetQuantumEndian(image,quantum_info,MSBEndian); in WritePNMImage()
2058 for (y=0; y < (ssize_t) image->rows; y++) in WritePNMImage()
2063 p=GetVirtualPixels(image,0,y,image->columns,1,exception); in WritePNMImage()
2066 extent=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info, in WritePNMImage()
2068 count=WriteBlob(image,extent,pixels); in WritePNMImage()
2071 if (image->previous == (Image *) NULL) in WritePNMImage()
2073 status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y, in WritePNMImage()
2074 image->rows); in WritePNMImage()
2088 Convert image to a PGM image. in WritePNMImage()
2090 if (image->depth > 32) in WritePNMImage()
2091 image->depth=32; in WritePNMImage()
2093 ((MagickOffsetType) GetQuantumRange(image->depth))); in WritePNMImage()
2094 (void) WriteBlobString(image,buffer); in WritePNMImage()
2095 quantum_info=AcquireQuantumInfo(image_info,image); in WritePNMImage()
2098 (void) SetQuantumEndian(image,quantum_info,MSBEndian); in WritePNMImage()
2100 extent=GetQuantumExtent(image,quantum_info,GrayQuantum); in WritePNMImage()
2101 for (y=0; y < (ssize_t) image->rows; y++) in WritePNMImage()
2109 p=GetVirtualPixels(image,0,y,image->columns,1,exception); in WritePNMImage()
2113 switch (image->depth) in WritePNMImage()
2119 extent=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info, in WritePNMImage()
2125 if (image->depth <= 8) in WritePNMImage()
2127 for (x=0; x < (ssize_t) image->columns; x++) in WritePNMImage()
2129 if (IsPixelGray(image,p) == MagickFalse) in WritePNMImage()
2131 image,p)),max_value); in WritePNMImage()
2134 if (image->depth == 8) in WritePNMImage()
2135 pixel=ScaleQuantumToChar(GetPixelRed(image,p)); in WritePNMImage()
2137 pixel=ScaleQuantumToAny(GetPixelRed(image,p), in WritePNMImage()
2141 p+=GetPixelChannels(image); in WritePNMImage()
2146 if (image->depth <= 16) in WritePNMImage()
2148 for (x=0; x < (ssize_t) image->columns; x++) in WritePNMImage()
2150 if (IsPixelGray(image,p) == MagickFalse) in WritePNMImage()
2151 pixel=ScaleQuantumToAny(ClampToQuantum(GetPixelLuma(image, in WritePNMImage()
2155 if (image->depth == 16) in WritePNMImage()
2156 pixel=ScaleQuantumToShort(GetPixelRed(image,p)); in WritePNMImage()
2158 pixel=ScaleQuantumToAny(GetPixelRed(image,p), in WritePNMImage()
2162 p+=GetPixelChannels(image); in WritePNMImage()
2167 for (x=0; x < (ssize_t) image->columns; x++) in WritePNMImage()
2169 if (IsPixelGray(image,p) == MagickFalse) in WritePNMImage()
2170 pixel=ScaleQuantumToAny(ClampToQuantum(GetPixelLuma(image,p)), in WritePNMImage()
2174 if (image->depth == 16) in WritePNMImage()
2175 pixel=ScaleQuantumToLong(GetPixelRed(image,p)); in WritePNMImage()
2177 pixel=ScaleQuantumToAny(GetPixelRed(image,p),max_value); in WritePNMImage()
2180 p+=GetPixelChannels(image); in WritePNMImage()
2186 count=WriteBlob(image,extent,pixels); in WritePNMImage()
2189 if (image->previous == (Image *) NULL) in WritePNMImage()
2191 status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y, in WritePNMImage()
2192 image->rows); in WritePNMImage()
2206 Convert image to a PNM image. in WritePNMImage()
2208 (void) TransformImageColorspace(image,sRGBColorspace,exception); in WritePNMImage()
2209 if (image->depth > 32) in WritePNMImage()
2210 image->depth=32; in WritePNMImage()
2212 ((MagickOffsetType) GetQuantumRange(image->depth))); in WritePNMImage()
2213 (void) WriteBlobString(image,buffer); in WritePNMImage()
2214 quantum_info=AcquireQuantumInfo(image_info,image); in WritePNMImage()
2217 (void) SetQuantumEndian(image,quantum_info,MSBEndian); in WritePNMImage()
2219 extent=GetQuantumExtent(image,quantum_info,quantum_type); in WritePNMImage()
2220 for (y=0; y < (ssize_t) image->rows; y++) in WritePNMImage()
2228 p=GetVirtualPixels(image,0,y,image->columns,1,exception); in WritePNMImage()
2232 switch (image->depth) in WritePNMImage()
2238 extent=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info, in WritePNMImage()
2244 if (image->depth <= 8) in WritePNMImage()
2246 for (x=0; x < (ssize_t) image->columns; x++) in WritePNMImage()
2248 pixel=ScaleQuantumToAny(GetPixelRed(image,p),max_value); in WritePNMImage()
2250 pixel=ScaleQuantumToAny(GetPixelGreen(image,p),max_value); in WritePNMImage()
2252 pixel=ScaleQuantumToAny(GetPixelBlue(image,p),max_value); in WritePNMImage()
2254 p+=GetPixelChannels(image); in WritePNMImage()
2259 if (image->depth <= 16) in WritePNMImage()
2261 for (x=0; x < (ssize_t) image->columns; x++) in WritePNMImage()
2263 pixel=ScaleQuantumToAny(GetPixelRed(image,p),max_value); in WritePNMImage()
2265 pixel=ScaleQuantumToAny(GetPixelGreen(image,p),max_value); in WritePNMImage()
2267 pixel=ScaleQuantumToAny(GetPixelBlue(image,p),max_value); in WritePNMImage()
2269 p+=GetPixelChannels(image); in WritePNMImage()
2274 for (x=0; x < (ssize_t) image->columns; x++) in WritePNMImage()
2276 pixel=ScaleQuantumToAny(GetPixelRed(image,p),max_value); in WritePNMImage()
2278 pixel=ScaleQuantumToAny(GetPixelGreen(image,p),max_value); in WritePNMImage()
2280 pixel=ScaleQuantumToAny(GetPixelBlue(image,p),max_value); in WritePNMImage()
2282 p+=GetPixelChannels(image); in WritePNMImage()
2288 count=WriteBlob(image,extent,pixels); in WritePNMImage()
2291 if (image->previous == (Image *) NULL) in WritePNMImage()
2293 status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y, in WritePNMImage()
2294 image->rows); in WritePNMImage()
2308 Convert image to a PAM. in WritePNMImage()
2310 if (image->depth > 32) in WritePNMImage()
2311 image->depth=32; in WritePNMImage()
2312 quantum_info=AcquireQuantumInfo(image_info,image); in WritePNMImage()
2315 (void) SetQuantumEndian(image,quantum_info,MSBEndian); in WritePNMImage()
2317 for (y=0; y < (ssize_t) image->rows; y++) in WritePNMImage()
2325 p=GetVirtualPixels(image,0,y,image->columns,1,exception); in WritePNMImage()
2329 switch (image->depth) in WritePNMImage()
2335 extent=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info, in WritePNMImage()
2346 if (image->depth <= 8) in WritePNMImage()
2348 for (x=0; x < (ssize_t) image->columns; x++) in WritePNMImage()
2351 image,p)),max_value); in WritePNMImage()
2353 if (image->alpha_trait != UndefinedPixelTrait) in WritePNMImage()
2356 GetPixelAlpha(image,p),max_value); in WritePNMImage()
2359 p+=GetPixelChannels(image); in WritePNMImage()
2363 if (image->depth <= 16) in WritePNMImage()
2365 for (x=0; x < (ssize_t) image->columns; x++) in WritePNMImage()
2368 image,p)),max_value); in WritePNMImage()
2370 if (image->alpha_trait != UndefinedPixelTrait) in WritePNMImage()
2373 GetPixelAlpha(image,p),max_value); in WritePNMImage()
2376 p+=GetPixelChannels(image); in WritePNMImage()
2380 for (x=0; x < (ssize_t) image->columns; x++) in WritePNMImage()
2382 pixel=ScaleQuantumToAny(ClampToQuantum(GetPixelLuma(image, in WritePNMImage()
2385 if (image->alpha_trait != UndefinedPixelTrait) in WritePNMImage()
2388 GetPixelAlpha(image,p),max_value); in WritePNMImage()
2391 p+=GetPixelChannels(image); in WritePNMImage()
2398 if (image->depth <= 8) in WritePNMImage()
2400 for (x=0; x < (ssize_t) image->columns; x++) in WritePNMImage()
2402 pixel=ScaleQuantumToAny(GetPixelRed(image,p),max_value); in WritePNMImage()
2404 pixel=ScaleQuantumToAny(GetPixelGreen(image,p), in WritePNMImage()
2407 pixel=ScaleQuantumToAny(GetPixelBlue(image,p), in WritePNMImage()
2410 pixel=ScaleQuantumToAny(GetPixelBlack(image,p), in WritePNMImage()
2413 if (image->alpha_trait != UndefinedPixelTrait) in WritePNMImage()
2415 pixel=ScaleQuantumToAny(GetPixelAlpha(image,p), in WritePNMImage()
2419 p+=GetPixelChannels(image); in WritePNMImage()
2423 if (image->depth <= 16) in WritePNMImage()
2425 for (x=0; x < (ssize_t) image->columns; x++) in WritePNMImage()
2427 pixel=ScaleQuantumToAny(GetPixelRed(image,p),max_value); in WritePNMImage()
2429 pixel=ScaleQuantumToAny(GetPixelGreen(image,p), in WritePNMImage()
2432 pixel=ScaleQuantumToAny(GetPixelBlue(image,p), in WritePNMImage()
2435 pixel=ScaleQuantumToAny(GetPixelBlack(image,p), in WritePNMImage()
2438 if (image->alpha_trait != UndefinedPixelTrait) in WritePNMImage()
2440 pixel=ScaleQuantumToAny(GetPixelAlpha(image,p), in WritePNMImage()
2444 p+=GetPixelChannels(image); in WritePNMImage()
2448 for (x=0; x < (ssize_t) image->columns; x++) in WritePNMImage()
2450 pixel=ScaleQuantumToAny(GetPixelRed(image,p),max_value); in WritePNMImage()
2452 pixel=ScaleQuantumToAny(GetPixelGreen(image,p),max_value); in WritePNMImage()
2454 pixel=ScaleQuantumToAny(GetPixelBlue(image,p),max_value); in WritePNMImage()
2456 pixel=ScaleQuantumToAny(GetPixelBlack(image,p),max_value); in WritePNMImage()
2458 if (image->alpha_trait != UndefinedPixelTrait) in WritePNMImage()
2460 pixel=ScaleQuantumToAny(GetPixelAlpha(image,p), in WritePNMImage()
2464 p+=GetPixelChannels(image); in WritePNMImage()
2470 if (image->depth <= 8) in WritePNMImage()
2472 for (x=0; x < (ssize_t) image->columns; x++) in WritePNMImage()
2474 pixel=ScaleQuantumToAny(GetPixelRed(image,p),max_value); in WritePNMImage()
2476 pixel=ScaleQuantumToAny(GetPixelGreen(image,p), in WritePNMImage()
2479 pixel=ScaleQuantumToAny(GetPixelBlue(image,p), in WritePNMImage()
2482 if (image->alpha_trait != UndefinedPixelTrait) in WritePNMImage()
2484 pixel=ScaleQuantumToAny(GetPixelAlpha(image,p), in WritePNMImage()
2488 p+=GetPixelChannels(image); in WritePNMImage()
2492 if (image->depth <= 16) in WritePNMImage()
2494 for (x=0; x < (ssize_t) image->columns; x++) in WritePNMImage()
2496 pixel=ScaleQuantumToAny(GetPixelRed(image,p),max_value); in WritePNMImage()
2498 pixel=ScaleQuantumToAny(GetPixelGreen(image,p), in WritePNMImage()
2501 pixel=ScaleQuantumToAny(GetPixelBlue(image,p), in WritePNMImage()
2504 if (image->alpha_trait != UndefinedPixelTrait) in WritePNMImage()
2506 pixel=ScaleQuantumToAny(GetPixelAlpha(image,p), in WritePNMImage()
2510 p+=GetPixelChannels(image); in WritePNMImage()
2514 for (x=0; x < (ssize_t) image->columns; x++) in WritePNMImage()
2516 pixel=ScaleQuantumToAny(GetPixelRed(image,p),max_value); in WritePNMImage()
2518 pixel=ScaleQuantumToAny(GetPixelGreen(image,p),max_value); in WritePNMImage()
2520 pixel=ScaleQuantumToAny(GetPixelBlue(image,p),max_value); in WritePNMImage()
2522 if (image->alpha_trait != UndefinedPixelTrait) in WritePNMImage()
2524 pixel=ScaleQuantumToAny(GetPixelAlpha(image,p), in WritePNMImage()
2528 p+=GetPixelChannels(image); in WritePNMImage()
2537 count=WriteBlob(image,extent,pixels); in WritePNMImage()
2540 if (image->previous == (Image *) NULL) in WritePNMImage()
2542 status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y, in WritePNMImage()
2543 image->rows); in WritePNMImage()
2557 (void) WriteBlobString(image,image->endian == LSBEndian ? "-1.0\n" : in WritePNMImage()
2559 image->depth=32; in WritePNMImage()
2561 quantum_info=AcquireQuantumInfo(image_info,image); in WritePNMImage()
2564 status=SetQuantumFormat(image,quantum_info,FloatingPointQuantumFormat); in WritePNMImage()
2568 for (y=(ssize_t) image->rows-1; y >= 0; y--) in WritePNMImage()
2573 p=GetVirtualPixels(image,0,y,image->columns,1,exception); in WritePNMImage()
2576 extent=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info, in WritePNMImage()
2578 (void) WriteBlob(image,extent,pixels); in WritePNMImage()
2579 if (image->previous == (Image *) NULL) in WritePNMImage()
2581 status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y, in WritePNMImage()
2582 image->rows); in WritePNMImage()
2596 (void) WriteBlobString(image,image->endian == LSBEndian ? "-1.0\n" : in WritePNMImage()
2598 image->depth=16; in WritePNMImage()
2600 quantum_info=AcquireQuantumInfo(image_info,image); in WritePNMImage()
2603 status=SetQuantumFormat(image,quantum_info,FloatingPointQuantumFormat); in WritePNMImage()
2607 for (y=(ssize_t) image->rows-1; y >= 0; y--) in WritePNMImage()
2612 p=GetVirtualPixels(image,0,y,image->columns,1,exception); in WritePNMImage()
2615 extent=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info, in WritePNMImage()
2617 (void) WriteBlob(image,extent,pixels); in WritePNMImage()
2618 if (image->previous == (Image *) NULL) in WritePNMImage()
2620 status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y, in WritePNMImage()
2621 image->rows); in WritePNMImage()
2632 if (GetNextImageInList(image) == (Image *) NULL) in WritePNMImage()
2634 image=SyncNextImageInList(image); in WritePNMImage()
2635 status=SetImageProgress(image,SaveImagesTag,scene++,imageListLength); in WritePNMImage()
2639 (void) CloseBlob(image); in WritePNMImage()