Lines Matching full:image

13 %                Read/Write Khoros Visualization Image Format                 %
55 #include "MagickCore/image.h"
56 #include "MagickCore/image-private.h"
73 WriteVIFFImage(const ImageInfo *,Image *,ExceptionInfo *);
86 % IsVIFF() returns MagickTrue if the image format type, identified by the
95 % o magick: compare image format pattern against these bytes.
120 % ReadVIFFImage() reads a Khoros Visualization image file and returns
121 % it. It allocates the memory necessary for the new Image structure and
122 % returns a pointer to the new image.
126 % Image *ReadVIFFImage(const ImageInfo *image_info,
131 % o image: Method ReadVIFFImage returns a pointer to the image after
132 % reading. A null image is returned if there is a memory shortage or if
133 % the image cannot be read.
135 % o image_info: the image info.
140 static Image *ReadVIFFImage(const ImageInfo *image_info, in ReadVIFFImage()
214 Image in ReadVIFFImage()
215 *image; in ReadVIFFImage() local
257 Open image file. in ReadVIFFImage()
266 image=AcquireImage(image_info,exception); in ReadVIFFImage()
267 status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception); in ReadVIFFImage()
270 image=DestroyImageList(image); in ReadVIFFImage()
271 return((Image *) NULL); in ReadVIFFImage()
276 count=ReadBlob(image,1,&viff_info.identifier); in ReadVIFFImage()
285 Initialize VIFF image. in ReadVIFFImage()
287 (void) ReadBlob(image,sizeof(viff_info.file_type),&viff_info.file_type); in ReadVIFFImage()
288 (void) ReadBlob(image,sizeof(viff_info.release),&viff_info.release); in ReadVIFFImage()
289 (void) ReadBlob(image,sizeof(viff_info.version),&viff_info.version); in ReadVIFFImage()
290 (void) ReadBlob(image,sizeof(viff_info.machine_dependency), in ReadVIFFImage()
292 (void) ReadBlob(image,sizeof(viff_info.reserve),viff_info.reserve); in ReadVIFFImage()
293 count=ReadBlob(image,512,(unsigned char *) viff_info.comment); in ReadVIFFImage()
298 (void) SetImageProperty(image,"comment",viff_info.comment,exception); in ReadVIFFImage()
301 image->endian=LSBEndian; in ReadVIFFImage()
303 image->endian=MSBEndian; in ReadVIFFImage()
304 viff_info.rows=ReadBlobLong(image); in ReadVIFFImage()
305 viff_info.columns=ReadBlobLong(image); in ReadVIFFImage()
306 viff_info.subrows=ReadBlobLong(image); in ReadVIFFImage()
307 viff_info.x_offset=ReadBlobSignedLong(image); in ReadVIFFImage()
308 viff_info.y_offset=ReadBlobSignedLong(image); in ReadVIFFImage()
309 viff_info.x_bits_per_pixel=(float) ReadBlobLong(image); in ReadVIFFImage()
310 viff_info.y_bits_per_pixel=(float) ReadBlobLong(image); in ReadVIFFImage()
311 viff_info.location_type=ReadBlobLong(image); in ReadVIFFImage()
312 viff_info.location_dimension=ReadBlobLong(image); in ReadVIFFImage()
313 viff_info.number_of_images=ReadBlobLong(image); in ReadVIFFImage()
314 viff_info.number_data_bands=ReadBlobLong(image); in ReadVIFFImage()
315 viff_info.data_storage_type=ReadBlobLong(image); in ReadVIFFImage()
316 viff_info.data_encode_scheme=ReadBlobLong(image); in ReadVIFFImage()
317 viff_info.map_scheme=ReadBlobLong(image); in ReadVIFFImage()
318 viff_info.map_storage_type=ReadBlobLong(image); in ReadVIFFImage()
319 viff_info.map_rows=ReadBlobLong(image); in ReadVIFFImage()
320 viff_info.map_columns=ReadBlobLong(image); in ReadVIFFImage()
321 viff_info.map_subrows=ReadBlobLong(image); in ReadVIFFImage()
322 viff_info.map_enable=ReadBlobLong(image); in ReadVIFFImage()
323 viff_info.maps_per_cycle=ReadBlobLong(image); in ReadVIFFImage()
324 viff_info.color_space_model=ReadBlobLong(image); in ReadVIFFImage()
326 (void) ReadBlobByte(image); in ReadVIFFImage()
327 if (EOFBlob(image) != MagickFalse) in ReadVIFFImage()
330 if (number_pixels > GetBlobSize(image)) in ReadVIFFImage()
336 image->columns=viff_info.rows; in ReadVIFFImage()
337 image->rows=viff_info.columns; in ReadVIFFImage()
338 image->depth=viff_info.x_bits_per_pixel <= 8 ? 8UL : in ReadVIFFImage()
340 image->alpha_trait=viff_info.number_data_bands == 4 ? BlendPixelTrait : in ReadVIFFImage()
342 status=SetImageExtent(image,image->columns,image->rows,exception); in ReadVIFFImage()
344 return(DestroyImageList(image)); in ReadVIFFImage()
345 (void) SetImageBackgroundColor(image,exception); in ReadVIFFImage()
347 Verify that we can read this VIFF image. in ReadVIFFImage()
387 image->colors=2; in ReadVIFFImage()
390 image->colors=256UL; in ReadVIFFImage()
392 image->colors=image->depth <= 8 ? 256UL : 65536UL; in ReadVIFFImage()
393 status=AcquireImageColormap(image,image->colors,exception); in ReadVIFFImage()
417 image->colors=viff_info.map_columns; in ReadVIFFImage()
418 if ((MagickSizeType) (viff_info.map_rows*image->colors) > GetBlobSize(image)) in ReadVIFFImage()
420 if (AcquireImageColormap(image,image->colors,exception) == MagickFalse) in ReadVIFFImage()
422 if ((MagickSizeType) viff_info.map_rows > GetBlobSize(image)) in ReadVIFFImage()
427 viff_colormap=(unsigned char *) AcquireQuantumMemory(image->colors, in ReadVIFFImage()
434 count=ReadBlob(image,bytes_per_pixel*image->colors*viff_info.map_rows, in ReadVIFFImage()
444 MSBOrderShort(viff_colormap,(bytes_per_pixel*image->colors* in ReadVIFFImage()
451 MSBOrderLong(viff_colormap,(bytes_per_pixel*image->colors* in ReadVIFFImage()
457 for (i=0; i < (ssize_t) (viff_info.map_rows*image->colors); i++) in ReadVIFFImage()
467 if (i < (ssize_t) image->colors) in ReadVIFFImage()
469 image->colormap[i].red=(MagickRealType) in ReadVIFFImage()
471 image->colormap[i].green=(MagickRealType) in ReadVIFFImage()
473 image->colormap[i].blue=(MagickRealType) in ReadVIFFImage()
477 if (i < (ssize_t) (2*image->colors)) in ReadVIFFImage()
478 image->colormap[i % image->colors].green=(MagickRealType) in ReadVIFFImage()
481 if (i < (ssize_t) (3*image->colors)) in ReadVIFFImage()
482 image->colormap[i % image->colors].blue=(MagickRealType) in ReadVIFFImage()
492 if (image->scene >= (image_info->scene+image_info->number_scenes-1)) in ReadVIFFImage()
499 image->colors=2; in ReadVIFFImage()
500 if (AcquireImageColormap(image,image->colors,exception) == MagickFalse) in ReadVIFFImage()
502 image->colorspace=GRAYColorspace; in ReadVIFFImage()
517 …if (HeapOverflowSanityCheckGetSize((image->columns+7UL) >> 3UL,image->rows,&max_packets) != Magick… in ReadVIFFImage()
525 if ((MagickSizeType) (bytes_per_pixel*max_packets) > GetBlobSize(image)) in ReadVIFFImage()
533 count=ReadBlob(image,bytes_per_pixel*max_packets,pixels); in ReadVIFFImage()
628 Convert VIFF raster image to pixel packets. in ReadVIFFImage()
636 for (y=0; y < (ssize_t) image->rows; y++) in ReadVIFFImage()
638 q=QueueAuthenticPixels(image,0,y,image->columns,1,exception); in ReadVIFFImage()
641 for (x=0; x < (ssize_t) (image->columns-7); x+=8) in ReadVIFFImage()
646 SetPixelRed(image,quantum == 0 ? 0 : QuantumRange,q); in ReadVIFFImage()
647 SetPixelGreen(image,quantum == 0 ? 0 : QuantumRange,q); in ReadVIFFImage()
648 SetPixelBlue(image,quantum == 0 ? 0 : QuantumRange,q); in ReadVIFFImage()
649 if (image->storage_class == PseudoClass) in ReadVIFFImage()
650 SetPixelIndex(image,(Quantum) quantum,q); in ReadVIFFImage()
651 q+=GetPixelChannels(image); in ReadVIFFImage()
655 if ((image->columns % 8) != 0) in ReadVIFFImage()
657 for (bit=0; bit < (int) (image->columns % 8); bit++) in ReadVIFFImage()
660 SetPixelRed(image,quantum == 0 ? 0 : QuantumRange,q); in ReadVIFFImage()
661 SetPixelGreen(image,quantum == 0 ? 0 : QuantumRange,q); in ReadVIFFImage()
662 SetPixelBlue(image,quantum == 0 ? 0 : QuantumRange,q); in ReadVIFFImage()
663 if (image->storage_class == PseudoClass) in ReadVIFFImage()
664 SetPixelIndex(image,(Quantum) quantum,q); in ReadVIFFImage()
665 q+=GetPixelChannels(image); in ReadVIFFImage()
669 if (SyncAuthenticPixels(image,exception) == MagickFalse) in ReadVIFFImage()
671 if (image->previous == (Image *) NULL) in ReadVIFFImage()
673 status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y, in ReadVIFFImage()
674 image->rows); in ReadVIFFImage()
681 if (image->storage_class == PseudoClass) in ReadVIFFImage()
682 for (y=0; y < (ssize_t) image->rows; y++) in ReadVIFFImage()
684 q=QueueAuthenticPixels(image,0,y,image->columns,1,exception); in ReadVIFFImage()
687 for (x=0; x < (ssize_t) image->columns; x++) in ReadVIFFImage()
689 SetPixelIndex(image,*p++,q); in ReadVIFFImage()
690 q+=GetPixelChannels(image); in ReadVIFFImage()
692 if (SyncAuthenticPixels(image,exception) == MagickFalse) in ReadVIFFImage()
694 if (image->previous == (Image *) NULL) in ReadVIFFImage()
696 status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y, in ReadVIFFImage()
697 image->rows); in ReadVIFFImage()
707 number_pixels=(MagickSizeType) image->columns*image->rows; in ReadVIFFImage()
708 for (y=0; y < (ssize_t) image->rows; y++) in ReadVIFFImage()
710 q=QueueAuthenticPixels(image,0,y,image->columns,1,exception); in ReadVIFFImage()
713 for (x=0; x < (ssize_t) image->columns; x++) in ReadVIFFImage()
715 SetPixelRed(image,ScaleCharToQuantum(*p),q); in ReadVIFFImage()
716 SetPixelGreen(image,ScaleCharToQuantum(*(p+number_pixels)),q); in ReadVIFFImage()
717 SetPixelBlue(image,ScaleCharToQuantum(*(p+2*number_pixels)),q); in ReadVIFFImage()
718 if (image->colors != 0) in ReadVIFFImage()
723 index=(ssize_t) GetPixelRed(image,q); in ReadVIFFImage()
724 SetPixelRed(image,ClampToQuantum(image->colormap[ in ReadVIFFImage()
725 ConstrainColormapIndex(image,index,exception)].red),q); in ReadVIFFImage()
726 index=(ssize_t) GetPixelGreen(image,q); in ReadVIFFImage()
727 SetPixelGreen(image,ClampToQuantum(image->colormap[ in ReadVIFFImage()
728 ConstrainColormapIndex(image,index,exception)].green),q); in ReadVIFFImage()
729 index=(ssize_t) GetPixelBlue(image,q); in ReadVIFFImage()
730 SetPixelBlue(image,ClampToQuantum(image->colormap[ in ReadVIFFImage()
731 ConstrainColormapIndex(image,index,exception)].blue),q); in ReadVIFFImage()
733 SetPixelAlpha(image,image->alpha_trait != UndefinedPixelTrait ? in ReadVIFFImage()
736 q+=GetPixelChannels(image); in ReadVIFFImage()
738 if (SyncAuthenticPixels(image,exception) == MagickFalse) in ReadVIFFImage()
740 if (image->previous == (Image *) NULL) in ReadVIFFImage()
742 status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y, in ReadVIFFImage()
743 image->rows); in ReadVIFFImage()
750 if (image->storage_class == PseudoClass) in ReadVIFFImage()
751 (void) SyncImage(image,exception); in ReadVIFFImage()
752 if (EOFBlob(image) != MagickFalse) in ReadVIFFImage()
755 image->filename); in ReadVIFFImage()
759 Proceed to next image. in ReadVIFFImage()
762 if (image->scene >= (image_info->scene+image_info->number_scenes-1)) in ReadVIFFImage()
764 count=ReadBlob(image,1,&viff_info.identifier); in ReadVIFFImage()
768 Allocate next image structure. in ReadVIFFImage()
770 AcquireNextImage(image_info,image,exception); in ReadVIFFImage()
771 if (GetNextImageInList(image) == (Image *) NULL) in ReadVIFFImage()
776 image=SyncNextImageInList(image); in ReadVIFFImage()
777 status=SetImageProgress(image,LoadImagesTag,TellBlob(image), in ReadVIFFImage()
778 GetBlobSize(image)); in ReadVIFFImage()
783 (void) CloseBlob(image); in ReadVIFFImage()
785 return(DestroyImageList(image)); in ReadVIFFImage()
786 return(GetFirstImageInList(image)); in ReadVIFFImage()
800 % RegisterVIFFImage() adds properties for the VIFF image format to
801 % the list of supported formats. The properties include the image format
817 entry=AcquireMagickInfo("VIFF","VIFF","Khoros Visualization image"); in RegisterVIFFImage()
823 entry=AcquireMagickInfo("VIFF","XV","Khoros Visualization image"); in RegisterVIFFImage()
867 % WriteVIFFImage() writes an image to a file in the VIFF image format.
872 % Image *image,ExceptionInfo *exception)
876 % o image_info: the image info.
878 % o image: The image.
884 Image *image,ExceptionInfo *exception) in WriteVIFFImage() argument
978 Open output image file. in WriteVIFFImage()
982 assert(image != (Image *) NULL); in WriteVIFFImage()
983 assert(image->signature == MagickCoreSignature); in WriteVIFFImage()
984 if (image->debug != MagickFalse) in WriteVIFFImage()
985 (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename); in WriteVIFFImage()
988 status=OpenBlob(image_info,image,WriteBinaryBlobMode,exception); in WriteVIFFImage()
993 imageListLength=GetImageListLength(image); in WriteVIFFImage()
997 Initialize VIFF image structure. in WriteVIFFImage()
999 (void) TransformImageColorspace(image,sRGBColorspace,exception); in WriteVIFFImage()
1006 value=GetImageProperty(image,"comment",exception); in WriteVIFFImage()
1010 viff_info.rows=image->columns; in WriteVIFFImage()
1011 viff_info.columns=image->rows; in WriteVIFFImage()
1028 number_pixels=(MagickSizeType) image->columns*image->rows; in WriteVIFFImage()
1029 if (image->storage_class == DirectClass) in WriteVIFFImage()
1034 viff_info.number_data_bands=image->alpha_trait ? 4U : 3U; in WriteVIFFImage()
1045 if (SetImageGray(image,exception) == MagickFalse) in WriteVIFFImage()
1053 viff_info.map_columns=(unsigned int) image->colors; in WriteVIFFImage()
1056 if (image->colors <= 2) in WriteVIFFImage()
1062 packets=((image->columns+7) >> 3)*image->rows; in WriteVIFFImage()
1066 Write VIFF image header (pad to 1024 bytes). in WriteVIFFImage()
1068 (void) WriteBlob(image,sizeof(viff_info.identifier),(unsigned char *) in WriteVIFFImage()
1070 (void) WriteBlob(image,sizeof(viff_info.file_type),(unsigned char *) in WriteVIFFImage()
1072 (void) WriteBlob(image,sizeof(viff_info.release),(unsigned char *) in WriteVIFFImage()
1074 (void) WriteBlob(image,sizeof(viff_info.version),(unsigned char *) in WriteVIFFImage()
1076 (void) WriteBlob(image,sizeof(viff_info.machine_dependency), in WriteVIFFImage()
1078 (void) WriteBlob(image,sizeof(viff_info.reserve),(unsigned char *) in WriteVIFFImage()
1080 (void) WriteBlob(image,512,(unsigned char *) viff_info.comment); in WriteVIFFImage()
1081 (void) WriteBlobMSBLong(image,(unsigned int) viff_info.rows); in WriteVIFFImage()
1082 (void) WriteBlobMSBLong(image,(unsigned int) viff_info.columns); in WriteVIFFImage()
1083 (void) WriteBlobMSBLong(image,(unsigned int) viff_info.subrows); in WriteVIFFImage()
1084 (void) WriteBlobMSBLong(image,(unsigned int) viff_info.x_offset); in WriteVIFFImage()
1085 (void) WriteBlobMSBLong(image,(unsigned int) viff_info.y_offset); in WriteVIFFImage()
1087 (void) WriteBlobMSBLong(image,(unsigned int) viff_info.x_bits_per_pixel); in WriteVIFFImage()
1089 (void) WriteBlobMSBLong(image,(unsigned int) viff_info.y_bits_per_pixel); in WriteVIFFImage()
1090 (void) WriteBlobMSBLong(image,viff_info.location_type); in WriteVIFFImage()
1091 (void) WriteBlobMSBLong(image,viff_info.location_dimension); in WriteVIFFImage()
1092 (void) WriteBlobMSBLong(image,(unsigned int) viff_info.number_of_images); in WriteVIFFImage()
1093 (void) WriteBlobMSBLong(image,(unsigned int) viff_info.number_data_bands); in WriteVIFFImage()
1094 (void) WriteBlobMSBLong(image,(unsigned int) viff_info.data_storage_type); in WriteVIFFImage()
1095 (void) WriteBlobMSBLong(image,(unsigned int) viff_info.data_encode_scheme); in WriteVIFFImage()
1096 (void) WriteBlobMSBLong(image,(unsigned int) viff_info.map_scheme); in WriteVIFFImage()
1097 (void) WriteBlobMSBLong(image,(unsigned int) viff_info.map_storage_type); in WriteVIFFImage()
1098 (void) WriteBlobMSBLong(image,(unsigned int) viff_info.map_rows); in WriteVIFFImage()
1099 (void) WriteBlobMSBLong(image,(unsigned int) viff_info.map_columns); in WriteVIFFImage()
1100 (void) WriteBlobMSBLong(image,(unsigned int) viff_info.map_subrows); in WriteVIFFImage()
1101 (void) WriteBlobMSBLong(image,(unsigned int) viff_info.map_enable); in WriteVIFFImage()
1102 (void) WriteBlobMSBLong(image,(unsigned int) viff_info.maps_per_cycle); in WriteVIFFImage()
1103 (void) WriteBlobMSBLong(image,(unsigned int) viff_info.color_space_model); in WriteVIFFImage()
1105 (void) WriteBlobByte(image,'\0'); in WriteVIFFImage()
1114 if (image->storage_class == DirectClass) in WriteVIFFImage()
1119 number_pixels=(MagickSizeType) image->columns*image->rows; in WriteVIFFImage()
1120 for (y=0; y < (ssize_t) image->rows; y++) in WriteVIFFImage()
1122 p=GetVirtualPixels(image,0,y,image->columns,1,exception); in WriteVIFFImage()
1125 for (x=0; x < (ssize_t) image->columns; x++) in WriteVIFFImage()
1127 *q=ScaleQuantumToChar(GetPixelRed(image,p)); in WriteVIFFImage()
1128 *(q+number_pixels)=ScaleQuantumToChar(GetPixelGreen(image,p)); in WriteVIFFImage()
1129 *(q+number_pixels*2)=ScaleQuantumToChar(GetPixelBlue(image,p)); in WriteVIFFImage()
1130 if (image->alpha_trait != UndefinedPixelTrait) in WriteVIFFImage()
1132 (GetPixelAlpha(image,p))); in WriteVIFFImage()
1133 p+=GetPixelChannels(image); in WriteVIFFImage()
1136 if (image->previous == (Image *) NULL) in WriteVIFFImage()
1138 status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y, in WriteVIFFImage()
1139 image->rows); in WriteVIFFImage()
1146 if (SetImageGray(image,exception) == MagickFalse) in WriteVIFFImage()
1154 viff_colormap=(unsigned char *) AcquireQuantumMemory(image->colors, in WriteVIFFImage()
1159 for (i=0; i < (ssize_t) image->colors; i++) in WriteVIFFImage()
1160 *q++=ScaleQuantumToChar(ClampToQuantum(image->colormap[i].red)); in WriteVIFFImage()
1161 for (i=0; i < (ssize_t) image->colors; i++) in WriteVIFFImage()
1162 *q++=ScaleQuantumToChar(ClampToQuantum(image->colormap[i].green)); in WriteVIFFImage()
1163 for (i=0; i < (ssize_t) image->colors; i++) in WriteVIFFImage()
1164 *q++=ScaleQuantumToChar(ClampToQuantum(image->colormap[i].blue)); in WriteVIFFImage()
1165 (void) WriteBlob(image,3*image->colors,viff_colormap); in WriteVIFFImage()
1171 for (y=0; y < (ssize_t) image->rows; y++) in WriteVIFFImage()
1173 p=GetVirtualPixels(image,0,y,image->columns,1,exception); in WriteVIFFImage()
1176 for (x=0; x < (ssize_t) image->columns; x++) in WriteVIFFImage()
1178 *q++=(unsigned char) ((ssize_t) GetPixelIndex(image,p)); in WriteVIFFImage()
1179 p+=GetPixelChannels(image); in WriteVIFFImage()
1181 if (image->previous == (Image *) NULL) in WriteVIFFImage()
1183 status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y, in WriteVIFFImage()
1184 image->rows); in WriteVIFFImage()
1191 if (image->colors <= 2) in WriteVIFFImage()
1198 Convert PseudoClass image to a VIFF monochrome image. in WriteVIFFImage()
1200 for (y=0; y < (ssize_t) image->rows; y++) in WriteVIFFImage()
1202 p=GetVirtualPixels(image,0,y,image->columns,1,exception); in WriteVIFFImage()
1207 for (x=0; x < (ssize_t) image->columns; x++) in WriteVIFFImage()
1210 if (GetPixelLuma(image,p) < (QuantumRange/2.0)) in WriteVIFFImage()
1219 p+=GetPixelChannels(image); in WriteVIFFImage()
1223 if (image->previous == (Image *) NULL) in WriteVIFFImage()
1225 status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) in WriteVIFFImage()
1226 y,image->rows); in WriteVIFFImage()
1237 for (y=0; y < (ssize_t) image->rows; y++) in WriteVIFFImage()
1239 p=GetVirtualPixels(image,0,y,image->columns,1,exception); in WriteVIFFImage()
1242 for (x=0; x < (ssize_t) image->columns; x++) in WriteVIFFImage()
1244 *q++=(unsigned char) ClampToQuantum(GetPixelLuma(image,p)); in WriteVIFFImage()
1245 p+=GetPixelChannels(image); in WriteVIFFImage()
1247 if (image->previous == (Image *) NULL) in WriteVIFFImage()
1249 status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) in WriteVIFFImage()
1250 y,image->rows); in WriteVIFFImage()
1256 (void) WriteBlob(image,(size_t) packets,pixels); in WriteVIFFImage()
1258 if (GetNextImageInList(image) == (Image *) NULL) in WriteVIFFImage()
1260 image=SyncNextImageInList(image); in WriteVIFFImage()
1261 status=SetImageProgress(image,SaveImagesTag,scene++,imageListLength); in WriteVIFFImage()
1265 (void) CloseBlob(image); in WriteVIFFImage()