Lines Matching refs:image

151 static int PNMComment(Image *image,CommentInfo *comment_info,  in PNMComment()  argument
176 c=ReadBlobByte(image); in PNMComment()
186 static unsigned int PNMInteger(Image *image,CommentInfo *comment_info, in PNMInteger() argument
200 c=ReadBlobByte(image); in PNMInteger()
204 c=PNMComment(image,comment_info,exception); in PNMInteger()
220 c=ReadBlobByte(image); in PNMInteger()
225 c=PNMComment(image,comment_info,exception); in PNMInteger()
248 *image; in ReadPNMImage() local
282 image=AcquireImage(image_info,exception); in ReadPNMImage()
283 status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception); in ReadPNMImage()
286 image=DestroyImageList(image); in ReadPNMImage()
292 count=ReadBlob(image,1,(unsigned char *) &format); in ReadPNMImage()
305 format=(char) ReadBlobByte(image); in ReadPNMImage()
311 image->columns=(size_t) PNMInteger(image,&comment_info,10,exception); in ReadPNMImage()
312 image->rows=(size_t) PNMInteger(image,&comment_info,10,exception); in ReadPNMImage()
318 if (ReadBlobString(image,scale) != (char *) NULL) in ReadPNMImage()
326 max_value=(QuantumAny) PNMInteger(image,&comment_info,10, in ReadPNMImage()
345 for (c=ReadBlobByte(image); c != EOF; c=ReadBlobByte(image)) in ReadPNMImage()
348 c=ReadBlobByte(image); in ReadPNMImage()
354 c=PNMComment(image,&comment_info,exception); in ReadPNMImage()
355 c=ReadBlobByte(image); in ReadPNMImage()
357 c=ReadBlobByte(image); in ReadPNMImage()
364 c=ReadBlobByte(image); in ReadPNMImage()
370 c=ReadBlobByte(image); in ReadPNMImage()
376 c=ReadBlobByte(image); in ReadPNMImage()
386 image->rows=StringToUnsignedLong(value); in ReadPNMImage()
393 (void) SetImageColorspace(image,GRAYColorspace,exception); in ReadPNMImage()
398 (void) SetImageColorspace(image,GRAYColorspace,exception); in ReadPNMImage()
399 image->alpha_trait=BlendPixelTrait; in ReadPNMImage()
405 (void) SetImageColorspace(image,GRAYColorspace,exception); in ReadPNMImage()
409 (void) SetImageColorspace(image,GRAYColorspace,exception); in ReadPNMImage()
410 image->alpha_trait=BlendPixelTrait; in ReadPNMImage()
415 image->alpha_trait=BlendPixelTrait; in ReadPNMImage()
420 (void) SetImageColorspace(image,CMYKColorspace,exception); in ReadPNMImage()
425 (void) SetImageColorspace(image,CMYKColorspace,exception); in ReadPNMImage()
426 image->alpha_trait=BlendPixelTrait; in ReadPNMImage()
431 image->columns=StringToUnsignedLong(value); in ReadPNMImage()
434 if ((image->columns == 0) || (image->rows == 0)) in ReadPNMImage()
439 image->depth=depth; in ReadPNMImage()
441 if (image->scene >= (image_info->scene+image_info->number_scenes-1)) in ReadPNMImage()
443 if ((MagickSizeType) (image->columns*image->rows/8) > GetBlobSize(image)) in ReadPNMImage()
445 status=SetImageExtent(image,image->columns,image->rows,exception); in ReadPNMImage()
449 return(DestroyImageList(image)); in ReadPNMImage()
451 (void) SetImageBackgroundColor(image,exception); in ReadPNMImage()
464 (void) SetImageColorspace(image,GRAYColorspace,exception); in ReadPNMImage()
465 for (y=0; y < (ssize_t) image->rows; y++) in ReadPNMImage()
473 q=QueueAuthenticPixels(image,0,y,image->columns,1,exception); in ReadPNMImage()
476 for (x=0; x < (ssize_t) image->columns; x++) in ReadPNMImage()
478 SetPixelGray(image,PNMInteger(image,&comment_info,2,exception) == in ReadPNMImage()
480 if (EOFBlob(image) != MagickFalse) in ReadPNMImage()
482 q+=GetPixelChannels(image); in ReadPNMImage()
484 if (SyncAuthenticPixels(image,exception) == MagickFalse) in ReadPNMImage()
486 if (image->previous == (Image *) NULL) in ReadPNMImage()
488 status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y, in ReadPNMImage()
489 image->rows); in ReadPNMImage()
493 if (EOFBlob(image) != MagickFalse) in ReadPNMImage()
496 image->type=BilevelType; in ReadPNMImage()
507 (void) SetImageColorspace(image,GRAYColorspace,exception); in ReadPNMImage()
508 for (y=0; y < (ssize_t) image->rows; y++) in ReadPNMImage()
516 q=QueueAuthenticPixels(image,0,y,image->columns,1,exception); in ReadPNMImage()
519 for (x=0; x < (ssize_t) image->columns; x++) in ReadPNMImage()
521 intensity=ScaleAnyToQuantum(PNMInteger(image,&comment_info,10, in ReadPNMImage()
523 if (EOFBlob(image) != MagickFalse) in ReadPNMImage()
525 SetPixelGray(image,intensity,q); in ReadPNMImage()
526 q+=GetPixelChannels(image); in ReadPNMImage()
528 if (SyncAuthenticPixels(image,exception) == MagickFalse) in ReadPNMImage()
530 if (image->previous == (Image *) NULL) in ReadPNMImage()
532 status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y, in ReadPNMImage()
533 image->rows); in ReadPNMImage()
537 if (EOFBlob(image) != MagickFalse) in ReadPNMImage()
540 image->type=GrayscaleType; in ReadPNMImage()
548 for (y=0; y < (ssize_t) image->rows; y++) in ReadPNMImage()
556 q=QueueAuthenticPixels(image,0,y,image->columns,1,exception); in ReadPNMImage()
559 for (x=0; x < (ssize_t) image->columns; x++) in ReadPNMImage()
564 pixel=ScaleAnyToQuantum(PNMInteger(image,&comment_info,10, in ReadPNMImage()
566 if (EOFBlob(image) != MagickFalse) in ReadPNMImage()
568 SetPixelRed(image,pixel,q); in ReadPNMImage()
569 pixel=ScaleAnyToQuantum(PNMInteger(image,&comment_info,10, in ReadPNMImage()
571 SetPixelGreen(image,pixel,q); in ReadPNMImage()
572 pixel=ScaleAnyToQuantum(PNMInteger(image,&comment_info,10, in ReadPNMImage()
574 SetPixelBlue(image,pixel,q); in ReadPNMImage()
575 q+=GetPixelChannels(image); in ReadPNMImage()
577 if (SyncAuthenticPixels(image,exception) == MagickFalse) in ReadPNMImage()
579 if (image->previous == (Image *) NULL) in ReadPNMImage()
581 status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y, in ReadPNMImage()
582 image->rows); in ReadPNMImage()
586 if (EOFBlob(image) != MagickFalse) in ReadPNMImage()
596 (void) SetImageColorspace(image,GRAYColorspace,exception); in ReadPNMImage()
598 if (image->storage_class == PseudoClass) in ReadPNMImage()
600 quantum_info=AcquireQuantumInfo(image_info,image); in ReadPNMImage()
604 extent=GetQuantumExtent(image,quantum_info,quantum_type); in ReadPNMImage()
605 for (y=0; y < (ssize_t) image->rows; y++) in ReadPNMImage()
622 pixels=(unsigned char *) ReadBlobStream(image,extent, in ReadPNMImage()
626 if ((image->progress_monitor != (MagickProgressMonitor) NULL) && in ReadPNMImage()
627 (image->previous == (Image *) NULL)) in ReadPNMImage()
632 proceed=SetImageProgress(image,LoadImageTag,(MagickOffsetType) in ReadPNMImage()
633 row,image->rows); in ReadPNMImage()
638 q=QueueAuthenticPixels(image,0,offset,image->columns,1,exception); in ReadPNMImage()
641 length=ImportQuantumPixels(image,(CacheView *) NULL,quantum_info, in ReadPNMImage()
645 sync=SyncAuthenticPixels(image,exception); in ReadPNMImage()
650 SetQuantumImageType(image,quantum_type); in ReadPNMImage()
658 (void) SetImageColorspace(image,GRAYColorspace,exception); in ReadPNMImage()
660 extent=(image->depth <= 8 ? 1 : image->depth <= 16 ? 2 : 4)* in ReadPNMImage()
661 image->columns; in ReadPNMImage()
662 quantum_info=AcquireQuantumInfo(image_info,image); in ReadPNMImage()
665 for (y=0; y < (ssize_t) image->rows; y++) in ReadPNMImage()
685 pixels=(unsigned char *) ReadBlobStream(image,extent, in ReadPNMImage()
689 if ((image->progress_monitor != (MagickProgressMonitor) NULL) && in ReadPNMImage()
690 (image->previous == (Image *) NULL)) in ReadPNMImage()
695 proceed=SetImageProgress(image,LoadImageTag,(MagickOffsetType) in ReadPNMImage()
696 row,image->rows); in ReadPNMImage()
701 q=QueueAuthenticPixels(image,0,offset,image->columns,1,exception); in ReadPNMImage()
705 switch (image->depth) in ReadPNMImage()
711 (void) ImportQuantumPixels(image,(CacheView *) NULL,quantum_info, in ReadPNMImage()
717 if (image->depth <= 8) in ReadPNMImage()
722 for (x=0; x < (ssize_t) image->columns; x++) in ReadPNMImage()
725 SetPixelGray(image,ScaleAnyToQuantum(pixel,max_value),q); in ReadPNMImage()
726 q+=GetPixelChannels(image); in ReadPNMImage()
729 else if (image->depth <= 16) in ReadPNMImage()
734 for (x=0; x < (ssize_t) image->columns; x++) in ReadPNMImage()
737 SetPixelGray(image,ScaleAnyToQuantum(pixel,max_value),q); in ReadPNMImage()
738 q+=GetPixelChannels(image); in ReadPNMImage()
746 for (x=0; x < (ssize_t) image->columns; x++) in ReadPNMImage()
749 SetPixelGray(image,ScaleAnyToQuantum(pixel,max_value),q); in ReadPNMImage()
750 q+=GetPixelChannels(image); in ReadPNMImage()
756 sync=SyncAuthenticPixels(image,exception); in ReadPNMImage()
761 SetQuantumImageType(image,quantum_type); in ReadPNMImage()
770 extent=3*(image->depth <= 8 ? 1 : image->depth <= 16 ? 2 : 4)* in ReadPNMImage()
771 image->columns; in ReadPNMImage()
772 quantum_info=AcquireQuantumInfo(image_info,image); in ReadPNMImage()
775 (void) SetQuantumEndian(image,quantum_info,MSBEndian); in ReadPNMImage()
776 for (y=0; y < (ssize_t) image->rows; y++) in ReadPNMImage()
796 pixels=(unsigned char *) ReadBlobStream(image,extent, in ReadPNMImage()
800 if ((image->progress_monitor != (MagickProgressMonitor) NULL) && in ReadPNMImage()
801 (image->previous == (Image *) NULL)) in ReadPNMImage()
806 proceed=SetImageProgress(image,LoadImageTag,(MagickOffsetType) in ReadPNMImage()
807 row,image->rows); in ReadPNMImage()
812 q=QueueAuthenticPixels(image,0,offset,image->columns,1,exception); in ReadPNMImage()
816 switch (image->depth) in ReadPNMImage()
820 for (x=0; x < (ssize_t) image->columns; x++) in ReadPNMImage()
822 SetPixelRed(image,ScaleCharToQuantum(*p++),q); in ReadPNMImage()
823 SetPixelGreen(image,ScaleCharToQuantum(*p++),q); in ReadPNMImage()
824 SetPixelBlue(image,ScaleCharToQuantum(*p++),q); in ReadPNMImage()
825 SetPixelAlpha(image,OpaqueAlpha,q); in ReadPNMImage()
826 q+=GetPixelChannels(image); in ReadPNMImage()
835 for (x=0; x < (ssize_t) image->columns; x++) in ReadPNMImage()
838 SetPixelRed(image,ScaleShortToQuantum(pixel),q); in ReadPNMImage()
840 SetPixelGreen(image,ScaleShortToQuantum(pixel),q); in ReadPNMImage()
842 SetPixelBlue(image,ScaleShortToQuantum(pixel),q); in ReadPNMImage()
843 SetPixelAlpha(image,OpaqueAlpha,q); in ReadPNMImage()
844 q+=GetPixelChannels(image); in ReadPNMImage()
853 for (x=0; x < (ssize_t) image->columns; x++) in ReadPNMImage()
856 SetPixelRed(image,ScaleLongToQuantum(pixel),q); in ReadPNMImage()
858 SetPixelGreen(image,ScaleLongToQuantum(pixel),q); in ReadPNMImage()
860 SetPixelBlue(image,ScaleLongToQuantum(pixel),q); in ReadPNMImage()
861 SetPixelAlpha(image,OpaqueAlpha,q); in ReadPNMImage()
862 q+=GetPixelChannels(image); in ReadPNMImage()
868 if (image->depth <= 8) in ReadPNMImage()
873 for (x=0; x < (ssize_t) image->columns; x++) in ReadPNMImage()
876 SetPixelRed(image,ScaleAnyToQuantum(pixel,max_value),q); in ReadPNMImage()
878 SetPixelGreen(image,ScaleAnyToQuantum(pixel,max_value),q); in ReadPNMImage()
880 SetPixelBlue(image,ScaleAnyToQuantum(pixel,max_value),q); in ReadPNMImage()
881 SetPixelAlpha(image,OpaqueAlpha,q); in ReadPNMImage()
882 q+=GetPixelChannels(image); in ReadPNMImage()
885 else if (image->depth <= 16) in ReadPNMImage()
890 for (x=0; x < (ssize_t) image->columns; x++) in ReadPNMImage()
893 SetPixelRed(image,ScaleAnyToQuantum(pixel,max_value),q); in ReadPNMImage()
895 SetPixelGreen(image,ScaleAnyToQuantum(pixel,max_value),q); in ReadPNMImage()
897 SetPixelBlue(image,ScaleAnyToQuantum(pixel,max_value),q); in ReadPNMImage()
898 SetPixelAlpha(image,OpaqueAlpha,q); in ReadPNMImage()
899 q+=GetPixelChannels(image); in ReadPNMImage()
907 for (x=0; x < (ssize_t) image->columns; x++) in ReadPNMImage()
910 SetPixelRed(image,ScaleAnyToQuantum(pixel,max_value),q); in ReadPNMImage()
912 SetPixelGreen(image,ScaleAnyToQuantum(pixel,max_value),q); in ReadPNMImage()
914 SetPixelBlue(image,ScaleAnyToQuantum(pixel,max_value),q); in ReadPNMImage()
915 SetPixelAlpha(image,OpaqueAlpha,q); in ReadPNMImage()
916 q+=GetPixelChannels(image); in ReadPNMImage()
922 sync=SyncAuthenticPixels(image,exception); in ReadPNMImage()
957 if (image->alpha_trait != UndefinedPixelTrait) in ReadPNMImage()
959 extent=channels*(image->depth <= 8 ? 1 : image->depth <= 16 ? 2 : 4)* in ReadPNMImage()
960 image->columns; in ReadPNMImage()
961 quantum_info=AcquireQuantumInfo(image_info,image); in ReadPNMImage()
964 for (y=0; y < (ssize_t) image->rows; y++) in ReadPNMImage()
984 pixels=(unsigned char *) ReadBlobStream(image,extent, in ReadPNMImage()
988 if ((image->progress_monitor != (MagickProgressMonitor) NULL) && in ReadPNMImage()
989 (image->previous == (Image *) NULL)) in ReadPNMImage()
994 proceed=SetImageProgress(image,LoadImageTag,(MagickOffsetType) in ReadPNMImage()
995 row,image->rows); in ReadPNMImage()
1000 q=QueueAuthenticPixels(image,0,offset,image->columns,1,exception); in ReadPNMImage()
1004 switch (image->depth) in ReadPNMImage()
1010 (void) ImportQuantumPixels(image,(CacheView *) NULL,quantum_info, in ReadPNMImage()
1021 if (image->depth <= 8) in ReadPNMImage()
1026 for (x=0; x < (ssize_t) image->columns; x++) in ReadPNMImage()
1029 SetPixelGray(image,ScaleAnyToQuantum(pixel,max_value), in ReadPNMImage()
1031 SetPixelAlpha(image,OpaqueAlpha,q); in ReadPNMImage()
1032 if (image->alpha_trait != UndefinedPixelTrait) in ReadPNMImage()
1035 if (image->depth != 1) in ReadPNMImage()
1036 SetPixelAlpha(image,ScaleAnyToQuantum(pixel, in ReadPNMImage()
1039 SetPixelAlpha(image,QuantumRange- in ReadPNMImage()
1042 q+=GetPixelChannels(image); in ReadPNMImage()
1045 else if (image->depth <= 16) in ReadPNMImage()
1050 for (x=0; x < (ssize_t) image->columns; x++) in ReadPNMImage()
1053 SetPixelGray(image,ScaleAnyToQuantum(pixel,max_value), in ReadPNMImage()
1055 SetPixelAlpha(image,OpaqueAlpha,q); in ReadPNMImage()
1056 if (image->alpha_trait != UndefinedPixelTrait) in ReadPNMImage()
1059 SetPixelAlpha(image,ScaleAnyToQuantum(pixel, in ReadPNMImage()
1062 q+=GetPixelChannels(image); in ReadPNMImage()
1070 for (x=0; x < (ssize_t) image->columns; x++) in ReadPNMImage()
1073 SetPixelGray(image,ScaleAnyToQuantum(pixel,max_value), in ReadPNMImage()
1075 SetPixelAlpha(image,OpaqueAlpha,q); in ReadPNMImage()
1076 if (image->alpha_trait != UndefinedPixelTrait) in ReadPNMImage()
1079 SetPixelAlpha(image,ScaleAnyToQuantum(pixel, in ReadPNMImage()
1082 q+=GetPixelChannels(image); in ReadPNMImage()
1090 if (image->depth <= 8) in ReadPNMImage()
1095 for (x=0; x < (ssize_t) image->columns; x++) in ReadPNMImage()
1098 SetPixelRed(image,ScaleAnyToQuantum(pixel,max_value),q); in ReadPNMImage()
1100 SetPixelGreen(image,ScaleAnyToQuantum(pixel,max_value), in ReadPNMImage()
1103 SetPixelBlue(image,ScaleAnyToQuantum(pixel,max_value), in ReadPNMImage()
1106 SetPixelBlack(image,ScaleAnyToQuantum(pixel,max_value), in ReadPNMImage()
1108 SetPixelAlpha(image,OpaqueAlpha,q); in ReadPNMImage()
1109 if (image->alpha_trait != UndefinedPixelTrait) in ReadPNMImage()
1112 SetPixelAlpha(image,ScaleAnyToQuantum(pixel, in ReadPNMImage()
1115 q+=GetPixelChannels(image); in ReadPNMImage()
1118 else if (image->depth <= 16) in ReadPNMImage()
1123 for (x=0; x < (ssize_t) image->columns; x++) in ReadPNMImage()
1126 SetPixelRed(image,ScaleAnyToQuantum(pixel,max_value),q); in ReadPNMImage()
1128 SetPixelGreen(image,ScaleAnyToQuantum(pixel,max_value), in ReadPNMImage()
1131 SetPixelBlue(image,ScaleAnyToQuantum(pixel,max_value), in ReadPNMImage()
1134 SetPixelBlack(image,ScaleAnyToQuantum(pixel,max_value), in ReadPNMImage()
1136 SetPixelAlpha(image,OpaqueAlpha,q); in ReadPNMImage()
1137 if (image->alpha_trait != UndefinedPixelTrait) in ReadPNMImage()
1140 SetPixelAlpha(image,ScaleAnyToQuantum(pixel, in ReadPNMImage()
1143 q+=GetPixelChannels(image); in ReadPNMImage()
1151 for (x=0; x < (ssize_t) image->columns; x++) in ReadPNMImage()
1154 SetPixelRed(image,ScaleAnyToQuantum(pixel,max_value), in ReadPNMImage()
1157 SetPixelGreen(image,ScaleAnyToQuantum(pixel,max_value), in ReadPNMImage()
1160 SetPixelBlue(image,ScaleAnyToQuantum(pixel,max_value), in ReadPNMImage()
1163 SetPixelBlack(image,ScaleAnyToQuantum(pixel,max_value), in ReadPNMImage()
1165 SetPixelAlpha(image,OpaqueAlpha,q); in ReadPNMImage()
1166 if (image->alpha_trait != UndefinedPixelTrait) in ReadPNMImage()
1169 SetPixelAlpha(image,ScaleAnyToQuantum(pixel, in ReadPNMImage()
1172 q+=GetPixelChannels(image); in ReadPNMImage()
1179 if (image->depth <= 8) in ReadPNMImage()
1184 for (x=0; x < (ssize_t) image->columns; x++) in ReadPNMImage()
1187 SetPixelRed(image,ScaleAnyToQuantum(pixel,max_value),q); in ReadPNMImage()
1189 SetPixelGreen(image,ScaleAnyToQuantum(pixel,max_value), in ReadPNMImage()
1192 SetPixelBlue(image,ScaleAnyToQuantum(pixel,max_value), in ReadPNMImage()
1194 SetPixelAlpha(image,OpaqueAlpha,q); in ReadPNMImage()
1195 if (image->alpha_trait != UndefinedPixelTrait) in ReadPNMImage()
1198 SetPixelAlpha(image,ScaleAnyToQuantum(pixel, in ReadPNMImage()
1201 q+=GetPixelChannels(image); in ReadPNMImage()
1204 else if (image->depth <= 16) in ReadPNMImage()
1209 for (x=0; x < (ssize_t) image->columns; x++) in ReadPNMImage()
1212 SetPixelRed(image,ScaleAnyToQuantum(pixel,max_value),q); in ReadPNMImage()
1214 SetPixelGreen(image,ScaleAnyToQuantum(pixel,max_value), in ReadPNMImage()
1217 SetPixelBlue(image,ScaleAnyToQuantum(pixel,max_value), in ReadPNMImage()
1219 SetPixelAlpha(image,OpaqueAlpha,q); in ReadPNMImage()
1220 if (image->alpha_trait != UndefinedPixelTrait) in ReadPNMImage()
1223 SetPixelAlpha(image,ScaleAnyToQuantum(pixel, in ReadPNMImage()
1226 q+=GetPixelChannels(image); in ReadPNMImage()
1234 for (x=0; x < (ssize_t) image->columns; x++) in ReadPNMImage()
1237 SetPixelRed(image,ScaleAnyToQuantum(pixel,max_value), in ReadPNMImage()
1240 SetPixelGreen(image,ScaleAnyToQuantum(pixel,max_value), in ReadPNMImage()
1243 SetPixelBlue(image,ScaleAnyToQuantum(pixel,max_value), in ReadPNMImage()
1245 SetPixelAlpha(image,OpaqueAlpha,q); in ReadPNMImage()
1246 if (image->alpha_trait != UndefinedPixelTrait) in ReadPNMImage()
1249 SetPixelAlpha(image,ScaleAnyToQuantum(pixel, in ReadPNMImage()
1252 q+=GetPixelChannels(image); in ReadPNMImage()
1260 sync=SyncAuthenticPixels(image,exception); in ReadPNMImage()
1265 SetQuantumImageType(image,quantum_type); in ReadPNMImage()
1275 (void) SetImageColorspace(image,GRAYColorspace,exception); in ReadPNMImage()
1277 image->endian=quantum_scale < 0.0 ? LSBEndian : MSBEndian; in ReadPNMImage()
1278 image->depth=32; in ReadPNMImage()
1279 quantum_info=AcquireQuantumInfo(image_info,image); in ReadPNMImage()
1282 status=SetQuantumDepth(image,quantum_info,32); in ReadPNMImage()
1285 status=SetQuantumFormat(image,quantum_info,FloatingPointQuantumFormat); in ReadPNMImage()
1289 extent=GetQuantumExtent(image,quantum_info,quantum_type); in ReadPNMImage()
1290 for (y=0; y < (ssize_t) image->rows; y++) in ReadPNMImage()
1307 pixels=(unsigned char *) ReadBlobStream(image,extent, in ReadPNMImage()
1311 if ((image->progress_monitor != (MagickProgressMonitor) NULL) && in ReadPNMImage()
1312 (image->previous == (Image *) NULL)) in ReadPNMImage()
1317 proceed=SetImageProgress(image,LoadImageTag,(MagickOffsetType) in ReadPNMImage()
1318 row,image->rows); in ReadPNMImage()
1323 q=QueueAuthenticPixels(image,0,(ssize_t) (image->rows-offset-1), in ReadPNMImage()
1324 image->columns,1,exception); in ReadPNMImage()
1327 length=ImportQuantumPixels(image,(CacheView *) NULL,quantum_info, in ReadPNMImage()
1331 sync=SyncAuthenticPixels(image,exception); in ReadPNMImage()
1336 SetQuantumImageType(image,quantum_type); in ReadPNMImage()
1343 (void) SetImageProperty(image,"comment",comment_info.comment,exception); in ReadPNMImage()
1345 if (y < (ssize_t) image->rows) in ReadPNMImage()
1347 if (EOFBlob(image) != MagickFalse) in ReadPNMImage()
1350 CorruptImageError,"UnexpectedEndOfFile","`%s'",image->filename); in ReadPNMImage()
1357 if (image->scene >= (image_info->scene+image_info->number_scenes-1)) in ReadPNMImage()
1365 count=ReadBlob(image,1,(unsigned char *) &format); in ReadPNMImage()
1371 count=ReadBlob(image,1,(unsigned char *) &format); in ReadPNMImage()
1377 AcquireNextImage(image_info,image,exception); in ReadPNMImage()
1378 if (GetNextImageInList(image) == (Image *) NULL) in ReadPNMImage()
1383 image=SyncNextImageInList(image); in ReadPNMImage()
1384 status=SetImageProgress(image,LoadImagesTag,TellBlob(image), in ReadPNMImage()
1385 GetBlobSize(image)); in ReadPNMImage()
1390 (void) CloseBlob(image); in ReadPNMImage()
1392 return(DestroyImageList(image)); in ReadPNMImage()
1393 return(GetFirstImageInList(image)); in ReadPNMImage()
1520 static MagickBooleanType WritePNMImage(const ImageInfo *image_info,Image *image, in WritePNMImage() argument
1566 assert(image != (Image *) NULL); in WritePNMImage()
1567 assert(image->signature == MagickCoreSignature); in WritePNMImage()
1568 if (image->debug != MagickFalse) in WritePNMImage()
1569 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename); in WritePNMImage()
1572 status=OpenBlob(image_info,image,WriteBinaryBlobMode,exception); in WritePNMImage()
1576 imageListLength=GetImageListLength(image); in WritePNMImage()
1588 max_value=GetQuantumRange(image->depth); in WritePNMImage()
1609 if (SetImageGray(image,exception) != MagickFalse) in WritePNMImage()
1625 (SetImageGray(image,exception) != MagickFalse)) in WritePNMImage()
1630 if (SetImageMonochrome(image,exception) != MagickFalse) in WritePNMImage()
1648 (void) WriteBlobString(image,buffer); in WritePNMImage()
1649 value=GetImageProperty(image,"comment",exception); in WritePNMImage()
1658 (void) WriteBlobByte(image,'#'); in WritePNMImage()
1661 (void) WriteBlobByte(image,(unsigned char) *p); in WritePNMImage()
1663 (void) WriteBlobByte(image,'#'); in WritePNMImage()
1665 (void) WriteBlobByte(image,'\n'); in WritePNMImage()
1670 (double) image->columns,(double) image->rows); in WritePNMImage()
1671 (void) WriteBlobString(image,buffer); in WritePNMImage()
1682 "WIDTH %.20g\nHEIGHT %.20g\n",(double) image->columns,(double) in WritePNMImage()
1683 image->rows); in WritePNMImage()
1684 (void) WriteBlobString(image,buffer); in WritePNMImage()
1685 quantum_type=GetQuantumType(image,exception); in WritePNMImage()
1700 if (IdentifyImageMonochrome(image,exception) != MagickFalse) in WritePNMImage()
1707 if (image->alpha_trait != UndefinedPixelTrait) in WritePNMImage()
1714 if (image->alpha_trait != UndefinedPixelTrait) in WritePNMImage()
1719 if (image->depth > 32) in WritePNMImage()
1720 image->depth=32; in WritePNMImage()
1723 ((MagickOffsetType) GetQuantumRange(image->depth))); in WritePNMImage()
1724 (void) WriteBlobString(image,buffer); in WritePNMImage()
1727 (void) WriteBlobString(image,buffer); in WritePNMImage()
1742 (void) SetImageType(image,BilevelType,exception); in WritePNMImage()
1744 for (y=0; y < (ssize_t) image->rows; y++) in WritePNMImage()
1752 p=GetVirtualPixels(image,0,y,image->columns,1,exception); in WritePNMImage()
1755 for (x=0; x < (ssize_t) image->columns; x++) in WritePNMImage()
1757 *q++=(unsigned char) (GetPixelLuma(image,p) >= (QuantumRange/2.0) ? in WritePNMImage()
1763 (void) WriteBlob(image,q-pixels,pixels); in WritePNMImage()
1766 p+=GetPixelChannels(image); in WritePNMImage()
1769 (void) WriteBlob(image,q-pixels,pixels); in WritePNMImage()
1771 if (image->previous == (Image *) NULL) in WritePNMImage()
1773 status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y, in WritePNMImage()
1774 image->rows); in WritePNMImage()
1782 (void) WriteBlob(image,q-pixels,pixels); in WritePNMImage()
1794 if (image->depth <= 8) in WritePNMImage()
1795 (void) WriteBlobString(image,"255\n"); in WritePNMImage()
1797 if (image->depth <= 16) in WritePNMImage()
1798 (void) WriteBlobString(image,"65535\n"); in WritePNMImage()
1800 (void) WriteBlobString(image,"4294967295\n"); in WritePNMImage()
1802 for (y=0; y < (ssize_t) image->rows; y++) in WritePNMImage()
1810 p=GetVirtualPixels(image,0,y,image->columns,1,exception); in WritePNMImage()
1813 for (x=0; x < (ssize_t) image->columns; x++) in WritePNMImage()
1815 index=ClampToQuantum(GetPixelLuma(image,p)); in WritePNMImage()
1816 if (image->depth <= 8) in WritePNMImage()
1820 if (image->depth <= 16) in WritePNMImage()
1832 (void) WriteBlob(image,q-pixels,pixels); in WritePNMImage()
1835 p+=GetPixelChannels(image); in WritePNMImage()
1838 (void) WriteBlob(image,q-pixels,pixels); in WritePNMImage()
1840 if (image->previous == (Image *) NULL) in WritePNMImage()
1842 status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y, in WritePNMImage()
1843 image->rows); in WritePNMImage()
1851 (void) WriteBlob(image,q-pixels,pixels); in WritePNMImage()
1863 (void) TransformImageColorspace(image,sRGBColorspace,exception); in WritePNMImage()
1864 if (image->depth <= 8) in WritePNMImage()
1865 (void) WriteBlobString(image,"255\n"); in WritePNMImage()
1867 if (image->depth <= 16) in WritePNMImage()
1868 (void) WriteBlobString(image,"65535\n"); in WritePNMImage()
1870 (void) WriteBlobString(image,"4294967295\n"); in WritePNMImage()
1872 for (y=0; y < (ssize_t) image->rows; y++) in WritePNMImage()
1880 p=GetVirtualPixels(image,0,y,image->columns,1,exception); in WritePNMImage()
1883 for (x=0; x < (ssize_t) image->columns; x++) in WritePNMImage()
1885 if (image->depth <= 8) in WritePNMImage()
1887 "%u %u %u ",ScaleQuantumToChar(GetPixelRed(image,p)), in WritePNMImage()
1888 ScaleQuantumToChar(GetPixelGreen(image,p)), in WritePNMImage()
1889 ScaleQuantumToChar(GetPixelBlue(image,p))); in WritePNMImage()
1891 if (image->depth <= 16) in WritePNMImage()
1893 "%u %u %u ",ScaleQuantumToShort(GetPixelRed(image,p)), in WritePNMImage()
1894 ScaleQuantumToShort(GetPixelGreen(image,p)), in WritePNMImage()
1895 ScaleQuantumToShort(GetPixelBlue(image,p))); in WritePNMImage()
1898 "%u %u %u ",ScaleQuantumToLong(GetPixelRed(image,p)), in WritePNMImage()
1899 ScaleQuantumToLong(GetPixelGreen(image,p)), in WritePNMImage()
1900 ScaleQuantumToLong(GetPixelBlue(image,p))); in WritePNMImage()
1907 (void) WriteBlob(image,q-pixels,pixels); in WritePNMImage()
1910 p+=GetPixelChannels(image); in WritePNMImage()
1913 (void) WriteBlob(image,q-pixels,pixels); in WritePNMImage()
1915 if (image->previous == (Image *) NULL) in WritePNMImage()
1917 status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y, in WritePNMImage()
1918 image->rows); in WritePNMImage()
1926 (void) WriteBlob(image,q-pixels,pixels); in WritePNMImage()
1938 (void) SetImageType(image,BilevelType,exception); in WritePNMImage()
1939 image->depth=1; in WritePNMImage()
1940 quantum_info=AcquireQuantumInfo(image_info,image); in WritePNMImage()
1943 (void) SetQuantumEndian(image,quantum_info,MSBEndian); in WritePNMImage()
1946 for (y=0; y < (ssize_t) image->rows; y++) in WritePNMImage()
1951 p=GetVirtualPixels(image,0,y,image->columns,1,exception); in WritePNMImage()
1954 extent=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info, in WritePNMImage()
1956 count=WriteBlob(image,extent,pixels); in WritePNMImage()
1959 if (image->previous == (Image *) NULL) in WritePNMImage()
1961 status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y, in WritePNMImage()
1962 image->rows); in WritePNMImage()
1978 if (image->depth > 32) in WritePNMImage()
1979 image->depth=32; in WritePNMImage()
1981 ((MagickOffsetType) GetQuantumRange(image->depth))); in WritePNMImage()
1982 (void) WriteBlobString(image,buffer); in WritePNMImage()
1983 quantum_info=AcquireQuantumInfo(image_info,image); in WritePNMImage()
1986 (void) SetQuantumEndian(image,quantum_info,MSBEndian); in WritePNMImage()
1989 extent=GetQuantumExtent(image,quantum_info,GrayQuantum); in WritePNMImage()
1990 for (y=0; y < (ssize_t) image->rows; y++) in WritePNMImage()
1998 p=GetVirtualPixels(image,0,y,image->columns,1,exception); in WritePNMImage()
2002 switch (image->depth) in WritePNMImage()
2008 extent=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info, in WritePNMImage()
2014 if (image->depth <= 8) in WritePNMImage()
2016 for (x=0; x < (ssize_t) image->columns; x++) in WritePNMImage()
2018 if (IsPixelGray(image,p) == MagickFalse) in WritePNMImage()
2020 image,p)),max_value); in WritePNMImage()
2023 if (image->depth == 8) in WritePNMImage()
2024 pixel=ScaleQuantumToChar(GetPixelRed(image,p)); in WritePNMImage()
2026 pixel=ScaleQuantumToAny(GetPixelRed(image,p), in WritePNMImage()
2030 p+=GetPixelChannels(image); in WritePNMImage()
2035 if (image->depth <= 16) in WritePNMImage()
2037 for (x=0; x < (ssize_t) image->columns; x++) in WritePNMImage()
2039 if (IsPixelGray(image,p) == MagickFalse) in WritePNMImage()
2040 pixel=ScaleQuantumToAny(ClampToQuantum(GetPixelLuma(image, in WritePNMImage()
2044 if (image->depth == 16) in WritePNMImage()
2045 pixel=ScaleQuantumToShort(GetPixelRed(image,p)); in WritePNMImage()
2047 pixel=ScaleQuantumToAny(GetPixelRed(image,p), in WritePNMImage()
2051 p+=GetPixelChannels(image); in WritePNMImage()
2056 for (x=0; x < (ssize_t) image->columns; x++) in WritePNMImage()
2058 if (IsPixelGray(image,p) == MagickFalse) in WritePNMImage()
2059 pixel=ScaleQuantumToAny(ClampToQuantum(GetPixelLuma(image,p)), in WritePNMImage()
2063 if (image->depth == 16) in WritePNMImage()
2064 pixel=ScaleQuantumToLong(GetPixelRed(image,p)); in WritePNMImage()
2066 pixel=ScaleQuantumToAny(GetPixelRed(image,p),max_value); in WritePNMImage()
2069 p+=GetPixelChannels(image); in WritePNMImage()
2075 count=WriteBlob(image,extent,pixels); in WritePNMImage()
2078 if (image->previous == (Image *) NULL) in WritePNMImage()
2080 status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y, in WritePNMImage()
2081 image->rows); in WritePNMImage()
2097 (void) TransformImageColorspace(image,sRGBColorspace,exception); in WritePNMImage()
2098 if (image->depth > 32) in WritePNMImage()
2099 image->depth=32; in WritePNMImage()
2101 ((MagickOffsetType) GetQuantumRange(image->depth))); in WritePNMImage()
2102 (void) WriteBlobString(image,buffer); in WritePNMImage()
2103 quantum_info=AcquireQuantumInfo(image_info,image); in WritePNMImage()
2106 (void) SetQuantumEndian(image,quantum_info,MSBEndian); in WritePNMImage()
2108 extent=GetQuantumExtent(image,quantum_info,quantum_type); in WritePNMImage()
2109 for (y=0; y < (ssize_t) image->rows; y++) in WritePNMImage()
2117 p=GetVirtualPixels(image,0,y,image->columns,1,exception); in WritePNMImage()
2121 switch (image->depth) in WritePNMImage()
2127 extent=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info, in WritePNMImage()
2133 if (image->depth <= 8) in WritePNMImage()
2135 for (x=0; x < (ssize_t) image->columns; x++) in WritePNMImage()
2137 pixel=ScaleQuantumToAny(GetPixelRed(image,p),max_value); in WritePNMImage()
2139 pixel=ScaleQuantumToAny(GetPixelGreen(image,p),max_value); in WritePNMImage()
2141 pixel=ScaleQuantumToAny(GetPixelBlue(image,p),max_value); in WritePNMImage()
2143 p+=GetPixelChannels(image); in WritePNMImage()
2148 if (image->depth <= 16) in WritePNMImage()
2150 for (x=0; x < (ssize_t) image->columns; x++) in WritePNMImage()
2152 pixel=ScaleQuantumToAny(GetPixelRed(image,p),max_value); in WritePNMImage()
2154 pixel=ScaleQuantumToAny(GetPixelGreen(image,p),max_value); in WritePNMImage()
2156 pixel=ScaleQuantumToAny(GetPixelBlue(image,p),max_value); in WritePNMImage()
2158 p+=GetPixelChannels(image); in WritePNMImage()
2163 for (x=0; x < (ssize_t) image->columns; x++) in WritePNMImage()
2165 pixel=ScaleQuantumToAny(GetPixelRed(image,p),max_value); in WritePNMImage()
2167 pixel=ScaleQuantumToAny(GetPixelGreen(image,p),max_value); in WritePNMImage()
2169 pixel=ScaleQuantumToAny(GetPixelBlue(image,p),max_value); in WritePNMImage()
2171 p+=GetPixelChannels(image); in WritePNMImage()
2177 count=WriteBlob(image,extent,pixels); in WritePNMImage()
2180 if (image->previous == (Image *) NULL) in WritePNMImage()
2182 status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y, in WritePNMImage()
2183 image->rows); in WritePNMImage()
2199 if (image->depth > 32) in WritePNMImage()
2200 image->depth=32; in WritePNMImage()
2201 quantum_info=AcquireQuantumInfo(image_info,image); in WritePNMImage()
2204 (void) SetQuantumEndian(image,quantum_info,MSBEndian); in WritePNMImage()
2206 for (y=0; y < (ssize_t) image->rows; y++) in WritePNMImage()
2214 p=GetVirtualPixels(image,0,y,image->columns,1,exception); in WritePNMImage()
2218 switch (image->depth) in WritePNMImage()
2224 extent=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info, in WritePNMImage()
2235 if (image->depth <= 8) in WritePNMImage()
2237 for (x=0; x < (ssize_t) image->columns; x++) in WritePNMImage()
2240 image,p)),max_value); in WritePNMImage()
2242 if (image->alpha_trait != UndefinedPixelTrait) in WritePNMImage()
2245 GetPixelAlpha(image,p),max_value); in WritePNMImage()
2248 p+=GetPixelChannels(image); in WritePNMImage()
2252 if (image->depth <= 16) in WritePNMImage()
2254 for (x=0; x < (ssize_t) image->columns; x++) in WritePNMImage()
2257 image,p)),max_value); in WritePNMImage()
2259 if (image->alpha_trait != UndefinedPixelTrait) in WritePNMImage()
2262 GetPixelAlpha(image,p),max_value); in WritePNMImage()
2265 p+=GetPixelChannels(image); in WritePNMImage()
2269 for (x=0; x < (ssize_t) image->columns; x++) in WritePNMImage()
2271 pixel=ScaleQuantumToAny(ClampToQuantum(GetPixelLuma(image, in WritePNMImage()
2274 if (image->alpha_trait != UndefinedPixelTrait) in WritePNMImage()
2277 GetPixelAlpha(image,p),max_value); in WritePNMImage()
2280 p+=GetPixelChannels(image); in WritePNMImage()
2287 if (image->depth <= 8) in WritePNMImage()
2289 for (x=0; x < (ssize_t) image->columns; x++) in WritePNMImage()
2291 pixel=ScaleQuantumToAny(GetPixelRed(image,p),max_value); in WritePNMImage()
2293 pixel=ScaleQuantumToAny(GetPixelGreen(image,p), in WritePNMImage()
2296 pixel=ScaleQuantumToAny(GetPixelBlue(image,p), in WritePNMImage()
2299 pixel=ScaleQuantumToAny(GetPixelBlack(image,p), in WritePNMImage()
2302 if (image->alpha_trait != UndefinedPixelTrait) in WritePNMImage()
2304 pixel=ScaleQuantumToAny(GetPixelAlpha(image,p), in WritePNMImage()
2308 p+=GetPixelChannels(image); in WritePNMImage()
2312 if (image->depth <= 16) in WritePNMImage()
2314 for (x=0; x < (ssize_t) image->columns; x++) in WritePNMImage()
2316 pixel=ScaleQuantumToAny(GetPixelRed(image,p),max_value); in WritePNMImage()
2318 pixel=ScaleQuantumToAny(GetPixelGreen(image,p), in WritePNMImage()
2321 pixel=ScaleQuantumToAny(GetPixelBlue(image,p), in WritePNMImage()
2324 pixel=ScaleQuantumToAny(GetPixelBlack(image,p), in WritePNMImage()
2327 if (image->alpha_trait != UndefinedPixelTrait) in WritePNMImage()
2329 pixel=ScaleQuantumToAny(GetPixelAlpha(image,p), in WritePNMImage()
2333 p+=GetPixelChannels(image); in WritePNMImage()
2337 for (x=0; x < (ssize_t) image->columns; x++) in WritePNMImage()
2339 pixel=ScaleQuantumToAny(GetPixelRed(image,p),max_value); in WritePNMImage()
2341 pixel=ScaleQuantumToAny(GetPixelGreen(image,p),max_value); in WritePNMImage()
2343 pixel=ScaleQuantumToAny(GetPixelBlue(image,p),max_value); in WritePNMImage()
2345 pixel=ScaleQuantumToAny(GetPixelBlack(image,p),max_value); in WritePNMImage()
2347 if (image->alpha_trait != UndefinedPixelTrait) in WritePNMImage()
2349 pixel=ScaleQuantumToAny(GetPixelAlpha(image,p), in WritePNMImage()
2353 p+=GetPixelChannels(image); in WritePNMImage()
2359 if (image->depth <= 8) in WritePNMImage()
2361 for (x=0; x < (ssize_t) image->columns; x++) in WritePNMImage()
2363 pixel=ScaleQuantumToAny(GetPixelRed(image,p),max_value); in WritePNMImage()
2365 pixel=ScaleQuantumToAny(GetPixelGreen(image,p), in WritePNMImage()
2368 pixel=ScaleQuantumToAny(GetPixelBlue(image,p), in WritePNMImage()
2371 if (image->alpha_trait != UndefinedPixelTrait) in WritePNMImage()
2373 pixel=ScaleQuantumToAny(GetPixelAlpha(image,p), in WritePNMImage()
2377 p+=GetPixelChannels(image); in WritePNMImage()
2381 if (image->depth <= 16) in WritePNMImage()
2383 for (x=0; x < (ssize_t) image->columns; x++) in WritePNMImage()
2385 pixel=ScaleQuantumToAny(GetPixelRed(image,p),max_value); in WritePNMImage()
2387 pixel=ScaleQuantumToAny(GetPixelGreen(image,p), in WritePNMImage()
2390 pixel=ScaleQuantumToAny(GetPixelBlue(image,p), in WritePNMImage()
2393 if (image->alpha_trait != UndefinedPixelTrait) in WritePNMImage()
2395 pixel=ScaleQuantumToAny(GetPixelAlpha(image,p), in WritePNMImage()
2399 p+=GetPixelChannels(image); in WritePNMImage()
2403 for (x=0; x < (ssize_t) image->columns; x++) in WritePNMImage()
2405 pixel=ScaleQuantumToAny(GetPixelRed(image,p),max_value); in WritePNMImage()
2407 pixel=ScaleQuantumToAny(GetPixelGreen(image,p),max_value); in WritePNMImage()
2409 pixel=ScaleQuantumToAny(GetPixelBlue(image,p),max_value); in WritePNMImage()
2411 if (image->alpha_trait != UndefinedPixelTrait) in WritePNMImage()
2413 pixel=ScaleQuantumToAny(GetPixelAlpha(image,p), in WritePNMImage()
2417 p+=GetPixelChannels(image); in WritePNMImage()
2426 count=WriteBlob(image,extent,pixels); in WritePNMImage()
2429 if (image->previous == (Image *) NULL) in WritePNMImage()
2431 status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y, in WritePNMImage()
2432 image->rows); in WritePNMImage()
2446 (void) WriteBlobString(image,image->endian == LSBEndian ? "-1.0\n" : in WritePNMImage()
2448 image->depth=32; in WritePNMImage()
2450 quantum_info=AcquireQuantumInfo(image_info,image); in WritePNMImage()
2453 status=SetQuantumFormat(image,quantum_info,FloatingPointQuantumFormat); in WritePNMImage()
2457 for (y=(ssize_t) image->rows-1; y >= 0; y--) in WritePNMImage()
2462 p=GetVirtualPixels(image,0,y,image->columns,1,exception); in WritePNMImage()
2465 extent=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info, in WritePNMImage()
2467 (void) WriteBlob(image,extent,pixels); in WritePNMImage()
2468 if (image->previous == (Image *) NULL) in WritePNMImage()
2470 status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y, in WritePNMImage()
2471 image->rows); in WritePNMImage()
2480 if (GetNextImageInList(image) == (Image *) NULL) in WritePNMImage()
2482 image=SyncNextImageInList(image); in WritePNMImage()
2483 status=SetImageProgress(image,SaveImagesTag,scene++,imageListLength); in WritePNMImage()
2487 (void) CloseBlob(image); in WritePNMImage()