Lines Matching full:image

13 %                     Read/Write Raw GRAY Image Format                        %
52 #include "MagickCore/image.h"
53 #include "MagickCore/image-private.h"
71 WriteGRAYImage(const ImageInfo *,Image *,ExceptionInfo *);
84 % ReadGRAYImage() reads an image of raw GRAY samples and returns it. It
85 % allocates the memory necessary for the new Image structure and returns a
86 % pointer to the new image.
90 % Image *ReadGRAYImage(const ImageInfo *image_info,
95 % o image_info: the image info.
100 static Image *ReadGRAYImage(const ImageInfo *image_info, in ReadGRAYImage()
106 Image in ReadGRAYImage()
108 *image; in ReadGRAYImage() local
136 Open image file. in ReadGRAYImage()
145 image=AcquireImage(image_info,exception); in ReadGRAYImage()
146 if ((image->columns == 0) || (image->rows == 0)) in ReadGRAYImage()
148 image->colorspace=GRAYColorspace; in ReadGRAYImage()
151 status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception); in ReadGRAYImage()
154 image=DestroyImageList(image); in ReadGRAYImage()
155 return((Image *) NULL); in ReadGRAYImage()
157 if (DiscardBlobBytes(image,(MagickSizeType) image->offset) == MagickFalse) in ReadGRAYImage()
159 image->filename); in ReadGRAYImage()
162 Create virtual canvas to support cropping (i.e. image.rgb[100x100+10+20]). in ReadGRAYImage()
164 canvas_image=CloneImage(image,image->extract_info.width,1,MagickFalse, in ReadGRAYImage()
166 if(canvas_image == (Image *) NULL) in ReadGRAYImage()
180 image->alpha_trait=BlendPixelTrait; in ReadGRAYImage()
185 while (image->scene < image_info->scene) in ReadGRAYImage()
188 Skip to next image. in ReadGRAYImage()
190 image->scene++; in ReadGRAYImage()
192 for (y=0; y < (ssize_t) image->rows; y++) in ReadGRAYImage()
194 stream=ReadBlobStream(image,length,pixels,&count); in ReadGRAYImage()
207 Read pixels to virtual canvas image then push to image. in ReadGRAYImage()
210 if (image->scene >= (image_info->scene+image_info->number_scenes-1)) in ReadGRAYImage()
212 status=SetImageExtent(image,image->columns,image->rows,exception); in ReadGRAYImage()
226 stream=ReadBlobStream(image,length,pixels,&count); in ReadGRAYImage()
228 for (y=0; y < (ssize_t) image->extract_info.height; y++) in ReadGRAYImage()
243 "UnexpectedEndOfFile",image->filename); in ReadGRAYImage()
254 if (((y-image->extract_info.y) >= 0) && in ReadGRAYImage()
255 ((y-image->extract_info.y) < (ssize_t) image->rows)) in ReadGRAYImage()
259 q=QueueAuthenticPixels(image,0,y-image->extract_info.y, in ReadGRAYImage()
260 image->columns,1,exception); in ReadGRAYImage()
263 for (x=0; x < (ssize_t) image->columns; x++) in ReadGRAYImage()
265 SetPixelRed(image,GetPixelRed(canvas_image,p),q); in ReadGRAYImage()
266 SetPixelGreen(image,GetPixelGreen(canvas_image,p),q); in ReadGRAYImage()
267 SetPixelBlue(image,GetPixelBlue(canvas_image,p),q); in ReadGRAYImage()
268 SetPixelAlpha(image,OpaqueAlpha,q); in ReadGRAYImage()
269 if (image->alpha_trait != UndefinedPixelTrait) in ReadGRAYImage()
270 SetPixelAlpha(image,GetPixelAlpha(canvas_image,p),q); in ReadGRAYImage()
272 q+=GetPixelChannels(image); in ReadGRAYImage()
274 if (SyncAuthenticPixels(image,exception) == MagickFalse) in ReadGRAYImage()
277 if (image->previous == (Image *) NULL) in ReadGRAYImage()
279 status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y, in ReadGRAYImage()
280 image->rows); in ReadGRAYImage()
284 stream=ReadBlobStream(image,length,pixels,&count); in ReadGRAYImage()
303 stream=ReadBlobStream(image,length,pixels,&count); in ReadGRAYImage()
305 for (y=0; y < (ssize_t) image->extract_info.height; y++) in ReadGRAYImage()
307 for (i=0; i < (ssize_t) (image->alpha_trait != UndefinedPixelTrait ? 4 : 3); i++) in ReadGRAYImage()
322 "UnexpectedEndOfFile",image->filename); in ReadGRAYImage()
334 if (((y-image->extract_info.y) >= 0) && in ReadGRAYImage()
335 ((y-image->extract_info.y) < (ssize_t) image->rows)) in ReadGRAYImage()
339 q=GetAuthenticPixels(image,0,y-image->extract_info.y, in ReadGRAYImage()
340 image->columns,1,exception); in ReadGRAYImage()
343 for (x=0; x < (ssize_t) image->columns; x++) in ReadGRAYImage()
349 SetPixelGray(image,GetPixelGray(canvas_image,p),q); in ReadGRAYImage()
354 SetPixelAlpha(image,GetPixelAlpha(canvas_image,p),q); in ReadGRAYImage()
361 q+=GetPixelChannels(image); in ReadGRAYImage()
363 if (SyncAuthenticPixels(image,exception) == MagickFalse) in ReadGRAYImage()
366 stream=ReadBlobStream(image,length,pixels,&count); in ReadGRAYImage()
368 if (image->previous == (Image *) NULL) in ReadGRAYImage()
370 status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y, in ReadGRAYImage()
371 image->rows); in ReadGRAYImage()
386 stream=ReadBlobStream(image,length,pixels,&count); in ReadGRAYImage()
388 for (y=0; y < (ssize_t) image->extract_info.height; y++) in ReadGRAYImage()
403 "UnexpectedEndOfFile",image->filename); in ReadGRAYImage()
414 if (((y-image->extract_info.y) >= 0) && in ReadGRAYImage()
415 ((y-image->extract_info.y) < (ssize_t) image->rows)) in ReadGRAYImage()
419 q=GetAuthenticPixels(image,0,y-image->extract_info.y, in ReadGRAYImage()
420 image->columns,1,exception); in ReadGRAYImage()
423 for (x=0; x < (ssize_t) image->columns; x++) in ReadGRAYImage()
425 SetPixelGray(image,GetPixelGray(canvas_image,p),q); in ReadGRAYImage()
427 q+=GetPixelChannels(image); in ReadGRAYImage()
429 if (SyncAuthenticPixels(image,exception) == MagickFalse) in ReadGRAYImage()
432 stream=ReadBlobStream(image,length,pixels,&count); in ReadGRAYImage()
434 if (image->previous == (Image *) NULL) in ReadGRAYImage()
436 status=SetImageProgress(image,LoadImageTag,1,6); in ReadGRAYImage()
440 if (image->alpha_trait != UndefinedPixelTrait) in ReadGRAYImage()
442 for (y=0; y < (ssize_t) image->extract_info.height; y++) in ReadGRAYImage()
457 "UnexpectedEndOfFile",image->filename); in ReadGRAYImage()
468 if (((y-image->extract_info.y) >= 0) && in ReadGRAYImage()
469 ((y-image->extract_info.y) < (ssize_t) image->rows)) in ReadGRAYImage()
474 q=GetAuthenticPixels(image,0,y-image->extract_info.y, in ReadGRAYImage()
475 image->columns,1,exception); in ReadGRAYImage()
478 for (x=0; x < (ssize_t) image->columns; x++) in ReadGRAYImage()
480 SetPixelAlpha(image,GetPixelAlpha(canvas_image,p),q); in ReadGRAYImage()
482 q+=GetPixelChannels(image); in ReadGRAYImage()
484 if (SyncAuthenticPixels(image,exception) == MagickFalse) in ReadGRAYImage()
487 stream=ReadBlobStream(image,length,pixels,&count); in ReadGRAYImage()
489 if (image->previous == (Image *) NULL) in ReadGRAYImage()
491 status=SetImageProgress(image,LoadImageTag,5,6); in ReadGRAYImage()
496 if (image->previous == (Image *) NULL) in ReadGRAYImage()
498 status=SetImageProgress(image,LoadImageTag,6,6); in ReadGRAYImage()
509 AppendImageFormat("G",image->filename); in ReadGRAYImage()
510 status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception); in ReadGRAYImage()
513 if (DiscardBlobBytes(image,(MagickSizeType) image->offset) == MagickFalse) in ReadGRAYImage()
517 "UnexpectedEndOfFile",image->filename); in ReadGRAYImage()
523 for (y=0; y < (ssize_t) image->extract_info.height; y++) in ReadGRAYImage()
525 stream=ReadBlobStream(image,length,pixels,&count); in ReadGRAYImage()
532 stream=ReadBlobStream(image,length,pixels,&count); in ReadGRAYImage()
533 for (y=0; y < (ssize_t) image->extract_info.height; y++) in ReadGRAYImage()
548 "UnexpectedEndOfFile",image->filename); in ReadGRAYImage()
559 if (((y-image->extract_info.y) >= 0) && in ReadGRAYImage()
560 ((y-image->extract_info.y) < (ssize_t) image->rows)) in ReadGRAYImage()
564 q=GetAuthenticPixels(image,0,y-image->extract_info.y, in ReadGRAYImage()
565 image->columns,1,exception); in ReadGRAYImage()
568 for (x=0; x < (ssize_t) image->columns; x++) in ReadGRAYImage()
570 SetPixelRed(image,GetPixelRed(canvas_image,p),q); in ReadGRAYImage()
572 q+=GetPixelChannels(image); in ReadGRAYImage()
574 if (SyncAuthenticPixels(image,exception) == MagickFalse) in ReadGRAYImage()
577 stream=ReadBlobStream(image,length,pixels,&count); in ReadGRAYImage()
579 if (image->previous == (Image *) NULL) in ReadGRAYImage()
581 status=SetImageProgress(image,LoadImageTag,1,5); in ReadGRAYImage()
585 (void) CloseBlob(image); in ReadGRAYImage()
586 if (image->alpha_trait != UndefinedPixelTrait) in ReadGRAYImage()
588 (void) CloseBlob(image); in ReadGRAYImage()
589 AppendImageFormat("A",image->filename); in ReadGRAYImage()
590 status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception); in ReadGRAYImage()
596 for (y=0; y < (ssize_t) image->extract_info.height; y++) in ReadGRAYImage()
598 stream=ReadBlobStream(image,length,pixels,&count); in ReadGRAYImage()
605 stream=ReadBlobStream(image,length,pixels,&count); in ReadGRAYImage()
606 for (y=0; y < (ssize_t) image->extract_info.height; y++) in ReadGRAYImage()
621 "UnexpectedEndOfFile",image->filename); in ReadGRAYImage()
632 if (((y-image->extract_info.y) >= 0) && in ReadGRAYImage()
633 ((y-image->extract_info.y) < (ssize_t) image->rows)) in ReadGRAYImage()
637 q=GetAuthenticPixels(image,0,y-image->extract_info.y, in ReadGRAYImage()
638 image->columns,1,exception); in ReadGRAYImage()
641 for (x=0; x < (ssize_t) image->columns; x++) in ReadGRAYImage()
643 SetPixelAlpha(image,GetPixelAlpha(canvas_image,p),q); in ReadGRAYImage()
645 q+=GetPixelChannels(image); in ReadGRAYImage()
647 if (SyncAuthenticPixels(image,exception) == MagickFalse) in ReadGRAYImage()
650 stream=ReadBlobStream(image,length,pixels,&count); in ReadGRAYImage()
652 if (image->previous == (Image *) NULL) in ReadGRAYImage()
654 status=SetImageProgress(image,LoadImageTag,4,5); in ReadGRAYImage()
659 (void) CloseBlob(image); in ReadGRAYImage()
660 if (image->previous == (Image *) NULL) in ReadGRAYImage()
662 status=SetImageProgress(image,LoadImageTag,5,5); in ReadGRAYImage()
671 SetQuantumImageType(image,quantum_type); in ReadGRAYImage()
673 Proceed to next image. in ReadGRAYImage()
676 if (image->scene >= (image_info->scene+image_info->number_scenes-1)) in ReadGRAYImage()
681 Allocate next image structure. in ReadGRAYImage()
683 AcquireNextImage(image_info,image,exception); in ReadGRAYImage()
684 if (GetNextImageInList(image) == (Image *) NULL) in ReadGRAYImage()
689 image=SyncNextImageInList(image); in ReadGRAYImage()
690 status=SetImageProgress(image,LoadImagesTag,TellBlob(image), in ReadGRAYImage()
691 GetBlobSize(image)); in ReadGRAYImage()
699 (void) CloseBlob(image); in ReadGRAYImage()
701 return(DestroyImageList(image)); in ReadGRAYImage()
702 return(GetFirstImageInList(image)); in ReadGRAYImage()
716 % RegisterGRAYImage() adds attributes for the GRAY image format to
717 % the list of supported formats. The attributes include the image format
784 % WriteGRAYImage() writes an image to a file in the GRAY, GRAYAlpha, or GRAYO
790 % Image *image,ExceptionInfo *exception)
794 % o image_info: the image info.
796 % o image: The image.
802 Image *image,ExceptionInfo *exception) in WriteGRAYImage() argument
832 assert(image != (Image *) NULL); in WriteGRAYImage()
833 assert(image->signature == MagickCoreSignature); in WriteGRAYImage()
834 if (image->debug != MagickFalse) in WriteGRAYImage()
835 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename); in WriteGRAYImage()
839 Open output image file. in WriteGRAYImage()
841 status=OpenBlob(image_info,image,WriteBinaryBlobMode,exception); in WriteGRAYImage()
849 imageListLength=GetImageListLength(image); in WriteGRAYImage()
855 (void) TransformImageColorspace(image,GRAYColorspace,exception); in WriteGRAYImage()
857 (image->alpha_trait == UndefinedPixelTrait)) in WriteGRAYImage()
858 (void) SetImageAlphaChannel(image,OpaqueAlphaChannel,exception); in WriteGRAYImage()
859 quantum_info=AcquireQuantumInfo(image_info,image); in WriteGRAYImage()
871 for (y=0; y < (ssize_t) image->rows; y++) in WriteGRAYImage()
876 p=GetVirtualPixels(image,0,y,image->columns,1,exception); in WriteGRAYImage()
879 length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info, in WriteGRAYImage()
881 count=WriteBlob(image,length,pixels); in WriteGRAYImage()
884 if (image->previous == (Image *) NULL) in WriteGRAYImage()
886 status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y, in WriteGRAYImage()
887 image->rows); in WriteGRAYImage()
899 for (y=0; y < (ssize_t) image->rows; y++) in WriteGRAYImage()
904 p=GetVirtualPixels(image,0,y,image->columns,1,exception); in WriteGRAYImage()
907 length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info, in WriteGRAYImage()
909 count=WriteBlob(image,length,pixels); in WriteGRAYImage()
914 length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info, in WriteGRAYImage()
916 count=WriteBlob(image,length,pixels); in WriteGRAYImage()
920 if (image->previous == (Image *) NULL) in WriteGRAYImage()
922 status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y, in WriteGRAYImage()
923 image->rows); in WriteGRAYImage()
935 for (y=0; y < (ssize_t) image->rows; y++) in WriteGRAYImage()
940 p=GetVirtualPixels(image,0,y,image->columns,1,exception); in WriteGRAYImage()
943 length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info, in WriteGRAYImage()
945 count=WriteBlob(image,length,pixels); in WriteGRAYImage()
949 if (image->previous == (Image *) NULL) in WriteGRAYImage()
951 status=SetImageProgress(image,SaveImageTag,1,6); in WriteGRAYImage()
957 for (y=0; y < (ssize_t) image->rows; y++) in WriteGRAYImage()
962 p=GetVirtualPixels(image,0,y,image->columns,1,exception); in WriteGRAYImage()
965 length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info, in WriteGRAYImage()
967 count=WriteBlob(image,length,pixels); in WriteGRAYImage()
971 if (image->previous == (Image *) NULL) in WriteGRAYImage()
973 status=SetImageProgress(image,SaveImageTag,5,6); in WriteGRAYImage()
979 (void) CopyMagickString(image->filename,image_info->filename, in WriteGRAYImage()
981 if (image->previous == (Image *) NULL) in WriteGRAYImage()
983 status=SetImageProgress(image,SaveImageTag,6,6); in WriteGRAYImage()
994 AppendImageFormat("G",image->filename); in WriteGRAYImage()
995 status=OpenBlob(image_info,image,scene == 0 ? WriteBinaryBlobMode : in WriteGRAYImage()
999 for (y=0; y < (ssize_t) image->rows; y++) in WriteGRAYImage()
1004 p=GetVirtualPixels(image,0,y,image->columns,1,exception); in WriteGRAYImage()
1007 length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info, in WriteGRAYImage()
1009 count=WriteBlob(image,length,pixels); in WriteGRAYImage()
1013 if (image->previous == (Image *) NULL) in WriteGRAYImage()
1015 status=SetImageProgress(image,SaveImageTag,1,6); in WriteGRAYImage()
1019 (void) CloseBlob(image); in WriteGRAYImage()
1022 (void) CloseBlob(image); in WriteGRAYImage()
1023 AppendImageFormat("A",image->filename); in WriteGRAYImage()
1024 status=OpenBlob(image_info,image,scene == 0 ? WriteBinaryBlobMode : in WriteGRAYImage()
1028 for (y=0; y < (ssize_t) image->rows; y++) in WriteGRAYImage()
1033 p=GetVirtualPixels(image,0,y,image->columns,1,exception); in WriteGRAYImage()
1036 length=ExportQuantumPixels(image,(CacheView *) NULL,quantum_info, in WriteGRAYImage()
1038 count=WriteBlob(image,length,pixels); in WriteGRAYImage()
1042 if (image->previous == (Image *) NULL) in WriteGRAYImage()
1044 status=SetImageProgress(image,SaveImageTag,5,6); in WriteGRAYImage()
1049 (void) CloseBlob(image); in WriteGRAYImage()
1050 (void) CopyMagickString(image->filename,image_info->filename, in WriteGRAYImage()
1052 if (image->previous == (Image *) NULL) in WriteGRAYImage()
1054 status=SetImageProgress(image,SaveImageTag,6,6); in WriteGRAYImage()
1062 if (GetNextImageInList(image) == (Image *) NULL) in WriteGRAYImage()
1064 image=SyncNextImageInList(image); in WriteGRAYImage()
1065 status=SetImageProgress(image,SaveImagesTag,scene++,imageListLength); in WriteGRAYImage()
1069 (void) CloseBlob(image); in WriteGRAYImage()