这篇教程C++ DestroyImageInfo函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中DestroyImageInfo函数的典型用法代码示例。如果您正苦于以下问题:C++ DestroyImageInfo函数的具体用法?C++ DestroyImageInfo怎么用?C++ DestroyImageInfo使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了DestroyImageInfo函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: GlobExpression/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% %% %% G l o b E x p r e s s i o n %% %% %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GlobExpression() returns MagickTrue if the expression matches the pattern.%% The format of the GlobExpression function is:%% MagickBooleanType GlobExpression(const char *expression,% const char *pattern)%% A description of each parameter follows:%% o expression: Specifies a pointer to a text string containing a file name.%% o pattern: Specifies a pointer to a text string containing a pattern.%%*/MagickExport MagickBooleanType GlobExpression(const char *expression, const char *pattern){ MagickBooleanType done; register const char *p; /* Return on empty pattern or '*'. */ if (pattern == (char *) NULL) return(MagickTrue); if (*pattern == '/0') return(MagickTrue); if (LocaleCompare(pattern,"*") == 0) return(MagickTrue); p=pattern+strlen(pattern)-1; if ((*p == ']') && (strchr(pattern,'[') != (char *) NULL)) { ExceptionInfo exception; ImageInfo *image_info; /* Determine if pattern is a scene, i.e. img0001.pcd[2]. */ image_info=CloneImageInfo((ImageInfo *) NULL); (void) CopyMagickString(image_info->filename,pattern,MaxTextExtent); GetExceptionInfo(&exception); (void) SetImageInfo(image_info,MagickTrue,&exception); DestroyExceptionInfo(&exception); if (LocaleCompare(image_info->filename,pattern) != 0) { image_info=DestroyImageInfo(image_info); return(MagickFalse); } image_info=DestroyImageInfo(image_info); } /* Evaluate glob expression. */ done=MagickFalse; while ((*pattern != '/0') && (done == MagickFalse)) { if (*expression == '/0') if ((*pattern != '{') && (*pattern != '*')) break; switch (*pattern) { case '//': { pattern++; if (*pattern != '/0') pattern++; break; } case '*': { MagickBooleanType status; pattern++; status=MagickFalse; while ((*expression != '/0') && (status == MagickFalse)) status=GlobExpression(expression++,pattern); if (status != MagickFalse) { while (*expression != '/0') expression++; while (*pattern != '/0')//.........这里部分代码省略.........
开发者ID:miettal,项目名称:armadillo420_standard,代码行数:101,
示例2: IdentifyImageCommand//.........这里部分代码省略......... if (LocaleCompare(option,")") == 0) { FireImageStack(MagickFalse,MagickTrue,MagickTrue); if (k == 0) ThrowIdentifyException(OptionError,"UnableToParseExpression",option); PopImageStack(); continue; } if (IsMagickOption(option) == MagickFalse) { char *filename; Image *images; ImageInfo *identify_info; /* Read input image. */ FireImageStack(MagickFalse,MagickFalse,pend); identify_info=CloneImageInfo(image_info); identify_info->verbose=MagickFalse; filename=argv[i]; if ((LocaleCompare(filename,"--") == 0) && (i < (argc-1))) filename=argv[++i]; (void) CopyMagickString(identify_info->filename,filename,MaxTextExtent); if (identify_info->ping != MagickFalse) images=PingImages(identify_info,exception); else images=ReadImages(identify_info,exception); identify_info=DestroyImageInfo(identify_info); status&=(images != (Image *) NULL) && (exception->severity < ErrorException); if (images == (Image *) NULL) continue; AppendImageStack(images); FinalizeImageSettings(image_info,image,MagickFalse); for ( ; image != (Image *) NULL; image=GetNextImageInList(image)) { if (image->scene == 0) image->scene=count++; if (format == (char *) NULL) { (void) IdentifyImage(image,stdout,image_info->verbose); continue; } if (metadata != (char **) NULL) { char *text; text=InterpretImageProperties(image_info,image,format); if (text == (char *) NULL) ThrowIdentifyException(ResourceLimitError, "MemoryAllocationFailed",GetExceptionMessage(errno)); (void) ConcatenateString(&(*metadata),text); text=DestroyString(text); if (LocaleCompare(format,"%n") == 0) break; } } RemoveAllImageStack(); continue;
开发者ID:0xPr0xy,项目名称:ImageMagick,代码行数:67,
示例3: DestroyImageInfo/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% %% %% R e a d X T R N I m a g e %% %% %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Method ReadXTRNImage reads a XTRN image file and returns it. It% allocates the memory necessary for the new Image structure and returns a% pointer to the new image.%% The format of the ReadXTRNImage method is:%% Image *ReadXTRNImage(const ImageInfo *image_info,% ExceptionInfo *exception)%% A description of each parameter follows:%% o image: Method ReadXTRNImage returns a pointer to the image after% reading. A null image is returned if there is a memory shortage or% if the image cannot be read.%% o image_info: Specifies a pointer to an ImageInfo structure.%% o exception: return any errors or warnings in this structure.%%*/static Image *ReadXTRNImage(const ImageInfo *image_info, ExceptionInfo *exception){ Image *image; ImageInfo *clone_info; void *param1, *param2, *param3; param1 = param2 = param3 = (void *) NULL; image = (Image *) NULL; clone_info=CloneImageInfo(image_info); if (clone_info->filename == NULL) { DestroyImageInfo(clone_info); ThrowReaderException(OptionError,MissingAnImageFilename,image); } /* DebugString("ReadXTRN CODER: %s/n",clone_info->filename); */ if (LocaleCompare(image_info->magick,"XTRNFILE") == 0) { image=ReadImage(clone_info,exception); /* this should not be needed since the upstream code should catch any excetpions thrown by ReadImage */ if (exception->severity != UndefinedException) MagickWarning2(exception->severity,exception->reason,exception->description); } else if (LocaleCompare(image_info->magick,"XTRNIMAGE") == 0) { Image **image_ptr;#ifdef ALL_IMAGEINFO ImageInfo **image_info_ptr;#endif (void) sscanf(clone_info->filename,"%lx,%lx",¶m1,¶m2); image_ptr=(Image **) param2; if (*image_ptr != (Image *)NULL) image=CloneImage(*image_ptr,0,0,False,&(*image_ptr)->exception);#ifdef ALL_IMAGEINFO image_info_ptr=(ImageInfo **) param1; if (*image_info_ptr != (ImageInfo *)NULL) image_info=*image_info_ptr;#endif } else if (LocaleCompare(image_info->magick,"XTRNBLOB") == 0) { char **blob_data; size_t *blob_length; char filename[MaxTextExtent]; (void) sscanf(clone_info->filename,"%lx,%lx,%s",¶m1,¶m2,&filename); blob_data=(char **) param1; blob_length=(size_t *) param2; image=BlobToImage(clone_info,*blob_data,*blob_length,exception); if (exception->severity != UndefinedException) MagickWarning2(exception->severity,exception->reason,exception->description);//.........这里部分代码省略.........
开发者ID:CliffsDover,项目名称:graphicsmagick,代码行数:101,
示例4: ReadDOTImage/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% %% %% R e a d D O T I m a g e %% %% %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ReadDOTImage() reads a Graphviz image file and returns it. It allocates% the memory necessary for the new Image structure and returns a pointer to% the new image.%% The format of the ReadDOTImage method is:%% Image *ReadDOTImage(const ImageInfo *image_info,ExceptionInfo *exception)%% A description of each parameter follows:%% o image_info: the image info.%% o exception: return any errors or warnings in this structure.%*/static Image *ReadDOTImage(const ImageInfo *image_info,ExceptionInfo *exception){ char command[MagickPathExtent]; const char *option; graph_t *graph; Image *image; ImageInfo *read_info; MagickBooleanType status; /* Open image file. */ assert(image_info != (const ImageInfo *) NULL); assert(image_info->signature == MagickCoreSignature); if (image_info->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s", image_info->filename); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickCoreSignature); assert(graphic_context != (GVC_t *) NULL); image=AcquireImage(image_info,exception); status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception); if (status == MagickFalse) return(DestroyImageList(image)); read_info=CloneImageInfo(image_info); SetImageInfoBlob(read_info,(void *) NULL,0); (void) CopyMagickString(read_info->magick,"SVG",MagickPathExtent); (void) AcquireUniqueFilename(read_info->filename); (void) FormatLocaleString(command,MagickPathExtent,"-Tsvg -o%s %s", read_info->filename,image_info->filename);#if !defined(WITH_CGRAPH) graph=agread(GetBlobFileHandle(image));#else graph=agread(GetBlobFileHandle(image),(Agdisc_t *) NULL);#endif if (graph == (graph_t *) NULL) { (void) RelinquishUniqueFileResource(read_info->filename); return(DestroyImageList(image)); } option=GetImageOption(image_info,"dot:layout-engine"); if (option == (const char *) NULL) gvLayout(graphic_context,graph,(char *) "dot"); else gvLayout(graphic_context,graph,(char *) option); gvRenderFilename(graphic_context,graph,(char *) "svg",read_info->filename); gvFreeLayout(graphic_context,graph); agclose(graph); image=DestroyImageList(image); /* Read SVG graph. */ (void) CopyMagickString(read_info->magick,"SVG",MaxTextExtent); image=ReadImage(read_info,exception); (void) RelinquishUniqueFileResource(read_info->filename); read_info=DestroyImageInfo(read_info); if (image == (Image *) NULL) return((Image *) NULL); return(GetFirstImageInList(image));}
开发者ID:ImageMagick,项目名称:ImageMagick,代码行数:97,
示例5: ReadPWPImage//.........这里部分代码省略......... Open image file. */ assert(image_info != (const ImageInfo *) NULL); assert(image_info->signature == MagickSignature); if (image_info->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s", image_info->filename); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickSignature); pwp_image=AcquireImage(image_info); image=pwp_image; status=OpenBlob(image_info,pwp_image,ReadBinaryBlobMode,exception); if (status == MagickFalse) return((Image *) NULL); count=ReadBlob(pwp_image,5,magick); if ((count == 0) || (LocaleNCompare((char *) magick,"SFW95",5) != 0)) ThrowReaderException(CorruptImageError,"ImproperImageHeader"); read_info=CloneImageInfo(image_info); (void) SetImageInfoProgressMonitor(read_info,(MagickProgressMonitor) NULL, (void *) NULL); SetImageInfoBlob(read_info,(void *) NULL,0); unique_file=AcquireUniqueFileResource(read_info->filename); for ( ; ; ) { for (c=ReadBlobByte(pwp_image); c != EOF; c=ReadBlobByte(pwp_image)) { for (i=0; i < 17; i++) magick[i]=magick[i+1]; magick[17]=(unsigned char) c; if (LocaleNCompare((char *) (magick+12),"SFW94A",6) == 0) break; } if (c == EOF) break; if (LocaleNCompare((char *) (magick+12),"SFW94A",6) != 0) ThrowReaderException(CorruptImageError,"ImproperImageHeader"); /* Dump SFW image to a temporary file. */ file=(FILE *) NULL; if (unique_file != -1) file=fdopen(unique_file,"wb"); if ((unique_file == -1) || (file == (FILE *) NULL)) { ThrowFileException(exception,FileOpenError,"UnableToWriteFile", image->filename); image=DestroyImageList(image); return((Image *) NULL); } length=fwrite("SFW94A",1,6,file); (void) length; filesize=65535UL*magick[2]+256L*magick[1]+magick[0]; for (i=0; i < (ssize_t) filesize; i++) { c=ReadBlobByte(pwp_image); (void) fputc(c,file); } (void) fclose(file); next_image=ReadImage(read_info,exception); if (next_image == (Image *) NULL) break; (void) FormatLocaleString(next_image->filename,MaxTextExtent, "slide_%02ld.sfw",(long) next_image->scene); if (image == (Image *) NULL) image=next_image; else { /* Link image into image list. */ for (p=image; p->next != (Image *) NULL; p=GetNextImageInList(p)) ; next_image->previous=p; next_image->scene=p->scene+1; p->next=next_image; } if (image_info->number_scenes != 0) if (next_image->scene >= (image_info->scene+image_info->number_scenes-1)) break; status=SetImageProgress(image,LoadImagesTag,TellBlob(pwp_image), GetBlobSize(pwp_image)); if (status == MagickFalse) break; } (void) RelinquishUniqueFileResource(read_info->filename); read_info=DestroyImageInfo(read_info); (void) CloseBlob(pwp_image); pwp_image=DestroyImage(pwp_image); if (EOFBlob(image) != MagickFalse) { char *message; message=GetExceptionMessage(errno); (void) ThrowMagickException(exception,GetMagickModule(),CorruptImageError, "UnexpectedEndOfFile","`%s': %s",image->filename,message); message=DestroyString(message); } (void) CloseBlob(image); return(GetFirstImageInList(image));}
开发者ID:divyasnair123,项目名称:vegetable_store,代码行数:101,
示例6: GetBitstatic Image *ReadSTEGANOImage(const ImageInfo *image_info, ExceptionInfo *exception){#define GetBit(alpha,i) MagickMin((((size_t) (alpha) >> (size_t) / (i)) & 0x01),16)#define SetBit(i,set) SetPixelIndex(image,((set) != 0 ? / (size_t) GetPixelIndex(image,q) | (one << (size_t) (i)) : / (size_t) GetPixelIndex(image,q) & ~(one << (size_t) (i))),q) Image *image, *watermark; ImageInfo *read_info; int c; MagickBooleanType status; PixelInfo pixel; register Quantum *q; register ssize_t x; size_t depth, one; ssize_t i, j, k, y; /* Initialize Image structure. */ assert(image_info != (const ImageInfo *) NULL); assert(image_info->signature == MagickSignature); if (image_info->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s", image_info->filename); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickSignature); one=1; image=AcquireImage(image_info,exception); if ((image->columns == 0) || (image->rows == 0)) ThrowReaderException(OptionError,"MustSpecifyImageSize"); read_info=CloneImageInfo(image_info); SetImageInfoBlob(read_info,(void *) NULL,0); *read_info->magick='/0'; watermark=ReadImage(read_info,exception); read_info=DestroyImageInfo(read_info); if (watermark == (Image *) NULL) return((Image *) NULL); watermark->depth=MAGICKCORE_QUANTUM_DEPTH; if (AcquireImageColormap(image,MaxColormapSize,exception) == MagickFalse) ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); if (image_info->ping != MagickFalse) { (void) CloseBlob(image); return(GetFirstImageInList(image)); } /* Get hidden watermark from low-order bits of image. */ c=0; i=0; j=0; i=(ssize_t) (watermark->depth-1); depth=watermark->depth; for (k=image->offset; (i >= 0) && (j < (ssize_t) depth); i--) { for (y=0; (y < (ssize_t) image->rows) && (j < (ssize_t) depth); y++) { x=0; for ( ; (x < (ssize_t) image->columns) && (j < (ssize_t) depth); x++) { if ((k/(ssize_t) watermark->columns) >= (ssize_t) watermark->rows) break; (void) GetOneVirtualPixelInfo(watermark,UndefinedVirtualPixelMethod, k % (ssize_t) watermark->columns,k/(ssize_t) watermark->columns, &pixel,exception); q=GetAuthenticPixels(image,x,y,1,1,exception); if (q == (Quantum *) NULL) break; switch (c) { case 0: { SetBit(i,GetBit(pixel.red,j)); break; }//.........这里部分代码省略.........
开发者ID:Ladeira,项目名称:ImageMagick,代码行数:101,
示例7: ReadDNGImage//.........这里部分代码省略......... image_info->filename); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickSignature); image=AcquireImage(image_info); status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception); if (status == MagickFalse) { image=DestroyImageList(image); return((Image *) NULL); } (void) CloseBlob(image); (void) DestroyImageList(image); /* Convert DNG to PPM with delegate. */ image=AcquireImage(image_info); read_info=CloneImageInfo(image_info); SetImageInfoBlob(read_info,(void *) NULL,0); (void) InvokeDelegate(read_info,image,"dng:decode",(char *) NULL,exception); image=DestroyImage(image); (void) FormatLocaleString(read_info->filename,MaxTextExtent,"%s.png", read_info->unique); sans_exception=AcquireExceptionInfo(); image=ReadImage(read_info,sans_exception); sans_exception=DestroyExceptionInfo(sans_exception); if (image == (Image *) NULL) { (void) FormatLocaleString(read_info->filename,MaxTextExtent,"%s.ppm", read_info->unique); image=ReadImage(read_info,exception); } (void) RelinquishUniqueFileResource(read_info->filename); if (image != (Image *) NULL) { char filename[MaxTextExtent], *xml; ExceptionInfo *sans; (void) CopyMagickString(image->magick,read_info->magick,MaxTextExtent); (void) FormatLocaleString(filename,MaxTextExtent,"%s.ufraw", read_info->unique); sans=AcquireExceptionInfo(); xml=FileToString(filename,MaxTextExtent,sans); (void) RelinquishUniqueFileResource(filename); if (xml != (char *) NULL) { XMLTreeInfo *ufraw; /* Inject. */ ufraw=NewXMLTree(xml,sans); if (ufraw != (XMLTreeInfo *) NULL) { char *content, property[MaxTextExtent]; const char *tag; XMLTreeInfo *next; if (image->properties == (void *) NULL) ((Image *) image)->properties=NewSplayTree( CompareSplayTreeString,RelinquishMagickMemory, RelinquishMagickMemory); next=GetXMLTreeChild(ufraw,(const char *) NULL); while (next != (XMLTreeInfo *) NULL) { tag=GetXMLTreeTag(next); if (tag == (char *) NULL) tag="unknown"; (void) FormatLocaleString(property,MaxTextExtent,"dng:%s",tag); content=ConstantString(GetXMLTreeContent(next)); StripString(content); if ((LocaleCompare(tag,"log") != 0) && (LocaleCompare(tag,"InputFilename") != 0) && (LocaleCompare(tag,"OutputFilename") != 0) && (LocaleCompare(tag,"OutputType") != 0) && (strlen(content) != 0)) (void) AddValueToSplayTree((SplayTreeInfo *) ((Image *) image)->properties,ConstantString(property), content); next=GetXMLTreeSibling(next); } ufraw=DestroyXMLTree(ufraw); } xml=DestroyString(xml); } sans=DestroyExceptionInfo(sans); } read_info=DestroyImageInfo(read_info); return(image);}
开发者ID:UIKit0,项目名称:YoyaMagick,代码行数:101,
示例8: WriteImages//.........这里部分代码省略.........MagickExport MagickBooleanType WriteImages(const ImageInfo *image_info, Image *images,const char *filename,ExceptionInfo *exception){#define WriteImageTag "Write/Image" ExceptionInfo *sans_exception; ImageInfo *write_info; MagickBooleanType proceed; MagickOffsetType progress; MagickProgressMonitor progress_monitor; MagickSizeType number_images; MagickStatusType status; register Image *p; assert(image_info != (const ImageInfo *) NULL); assert(image_info->signature == MagickCoreSignature); assert(images != (Image *) NULL); assert(images->signature == MagickCoreSignature); if (images->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",images->filename); assert(exception != (ExceptionInfo *) NULL); write_info=CloneImageInfo(image_info); *write_info->magick='/0'; images=GetFirstImageInList(images); if (filename != (const char *) NULL) for (p=images; p != (Image *) NULL; p=GetNextImageInList(p)) (void) CopyMagickString(p->filename,filename,MagickPathExtent); (void) CopyMagickString(write_info->filename,images->filename, MagickPathExtent); sans_exception=AcquireExceptionInfo(); (void) SetImageInfo(write_info,(unsigned int) GetImageListLength(images), sans_exception); sans_exception=DestroyExceptionInfo(sans_exception); if (*write_info->magick == '/0') (void) CopyMagickString(write_info->magick,images->magick,MagickPathExtent); p=images; for ( ; GetNextImageInList(p) != (Image *) NULL; p=GetNextImageInList(p)) { register Image *next; next=GetNextImageInList(p); if (next == (Image *) NULL) break; if (p->scene >= next->scene) { register ssize_t i; /* Generate consistent scene numbers. */ i=(ssize_t) images->scene; for (p=images; p != (Image *) NULL; p=GetNextImageInList(p)) p->scene=(size_t) i++; break; } } /* Write images. */ status=MagickTrue; progress_monitor=(MagickProgressMonitor) NULL; progress=0; number_images=GetImageListLength(images); for (p=images; p != (Image *) NULL; p=GetNextImageInList(p)) { if (number_images != 1) progress_monitor=SetImageProgressMonitor(p,(MagickProgressMonitor) NULL, p->client_data); status&=WriteImage(write_info,p,exception); if (number_images != 1) (void) SetImageProgressMonitor(p,progress_monitor,p->client_data); if (write_info->adjoin != MagickFalse) break; if (number_images != 1) { proceed=SetImageProgress(p,WriteImageTag,progress++,number_images); if (proceed == MagickFalse) break; } } write_info=DestroyImageInfo(write_info); return(status != 0 ? MagickTrue : MagickFalse);}
开发者ID:freehawkzk,项目名称:ImageMagick,代码行数:101,
示例9: ReadImage/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% %% %% R e a d I m a g e %% %% %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ReadImage() reads an image or image sequence from a file or file handle.% The method returns a NULL if there is a memory shortage or if the image% cannot be read. On failure, a NULL image is returned and exception% describes the reason for the failure.%% The format of the ReadImage method is:%% Image *ReadImage(const ImageInfo *image_info,ExceptionInfo *exception)%% A description of each parameter follows:%% o image_info: Read the image defined by the file or filename members of% this structure.%% o exception: return any errors or warnings in this structure.%*/MagickExport Image *ReadImage(const ImageInfo *image_info, ExceptionInfo *exception){ char filename[MagickPathExtent], magick[MagickPathExtent], magick_filename[MagickPathExtent]; const char *value; const DelegateInfo *delegate_info; const MagickInfo *magick_info; ExceptionInfo *sans_exception; GeometryInfo geometry_info; Image *image, *next; ImageInfo *read_info; MagickStatusType flags; PolicyDomain domain; PolicyRights rights; /* Determine image type from filename prefix or suffix (e.g. image.jpg). */ assert(image_info != (ImageInfo *) NULL); assert(image_info->signature == MagickCoreSignature); assert(image_info->filename != (char *) NULL); if (image_info->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s", image_info->filename); assert(exception != (ExceptionInfo *) NULL); read_info=CloneImageInfo(image_info); (void) CopyMagickString(magick_filename,read_info->filename,MagickPathExtent); (void) SetImageInfo(read_info,0,exception); (void) CopyMagickString(filename,read_info->filename,MagickPathExtent); (void) CopyMagickString(magick,read_info->magick,MagickPathExtent); domain=CoderPolicyDomain; rights=ReadPolicyRights; if (IsRightsAuthorized(domain,rights,read_info->magick) == MagickFalse) { errno=EPERM; (void) ThrowMagickException(exception,GetMagickModule(),PolicyError, "NotAuthorized","`%s'",read_info->filename); read_info=DestroyImageInfo(read_info); return((Image *) NULL); } /* Call appropriate image reader based on image type. */ sans_exception=AcquireExceptionInfo(); magick_info=GetMagickInfo(read_info->magick,sans_exception); sans_exception=DestroyExceptionInfo(sans_exception); if (magick_info != (const MagickInfo *) NULL) {//.........这里部分代码省略.........
开发者ID:freehawkzk,项目名称:ImageMagick,代码行数:101,
示例10: int_imread/*---------------------------------------------------------- * int_imread: * interface for imread function. * should provide [RGB]=imread(name) * [Index,Map]=imread(name) at Scilab level * * TO-DO * - return on errors, even if exeption is NULL * * $Revision: 1.2 $ $Date: 2009-03-29 21:34:48 $ *----------------------------------------------------------*/SipExport int int_imread(char *fname) { /* Interface variables */ HyperMat *Img; int m1, n1,l1, /* for name input argument */ m2, n2, /* for index output argument */ minlhs=1, maxlhs=2, minrhs=1, maxrhs=1, i; double *l2; /* Other variables */ unsigned long imgsize; /* ImageMagick variables */ ExceptionInfo exception; Image *image; ImageInfo *image_info; PixelPacket *pix; ImageType imgtype; bool stat; CheckRhs(minrhs,maxrhs) ; CheckLhs(minlhs,maxlhs) ; /* Get name (#1) */ GetRhsVar(1, "c", &m1, &n1, &l1); /* Initialize the image info structure and read an image. */ InitializeMagick(NULL); GetExceptionInfo(&exception); image_info=CloneImageInfo((ImageInfo *) NULL); (void) strncpy(image_info->filename,cstk(l1),MaxTextExtent); image=ReadImage(image_info,&exception); if (image == (Image *) NULL) { /* clean up */ if(exception.reason != NULL) { char errmsg[50]; for (i=0; i<49; i++) errmsg[i]=' '; errmsg[49]='/0'; strncpy(errmsg,SipGetLocaleExceptionMessage(exception.severity,exception.reason),50); DestroyImageInfo(image_info); DestroyExceptionInfo(&exception); DestroyMagick(); sip_error(errmsg); } DestroyImageInfo(image_info); DestroyExceptionInfo(&exception); DestroyMagick(); sip_error("unknown reason"); } m2 = image->rows; n2 = image->columns; if (sip_verbose == SIP_WORDY) sciprint("Size:/t%ld rows X %ld columns/n/r", m2, n2); imgsize = m2 * n2; pix=GetImagePixels(image, 0, 0, n2, m2); if(pix == (PixelPacket *) NULL) SIP_MAGICK_ERROR; switch(image->storage_class) { case DirectClass: { imgtype = GetImageType(image, &exception); if(imgtype == BilevelType) { stat = magick_binary_image_to_double_array(fname,pix,&l2, m2, n2); if (!stat) return false; CreateVarFromPtr(2, "d",&m2,&n2,&l2); free(l2); } else { stat= magick_truecolor_image_to_double_hypermat(fname,pix,&Img,m2,n2); if (!stat) return false; CreateHMat(2,Img); free_sci_tru_img(&Img); } m1 = n1 = 0; CreateVar(3,"d",&m1,&n1,&l1); break; } case PseudoClass: { stat= magick_index_map_to_sci_dbl(fname,image,2);//.........这里部分代码省略.........
开发者ID:rfabbri,项目名称:siptoolbox,代码行数:101,
示例11: ReadTEXTImage//.........这里部分代码省略......... image->resolution.y=geometry_info.sigma; if ((flags & SigmaValue) == 0) image->resolution.y=image->resolution.x; } page.width=612; page.height=792; page.x=43; page.y=43; if (image_info->page != (char *) NULL) (void) ParseAbsoluteGeometry(image_info->page,&page); /* Initialize Image structure. */ image->columns=(size_t) floor((((double) page.width*image->resolution.x)/ delta.x)+0.5); image->rows=(size_t) floor((((double) page.height*image->resolution.y)/ delta.y)+0.5); status=SetImageExtent(image,image->columns,image->rows,exception); if (status == MagickFalse) return(DestroyImageList(image)); image->page.x=0; image->page.y=0; texture=(Image *) NULL; if (image_info->texture != (char *) NULL) { ImageInfo *read_info; read_info=CloneImageInfo(image_info); SetImageInfoBlob(read_info,(void *) NULL,0); (void) CopyMagickString(read_info->filename,image_info->texture, MagickPathExtent); texture=ReadImage(read_info,exception); read_info=DestroyImageInfo(read_info); } /* Annotate the text image. */ (void) SetImageBackgroundColor(image,exception); draw_info=CloneDrawInfo(image_info,(DrawInfo *) NULL); (void) CloneString(&draw_info->text,image_info->filename); (void) FormatLocaleString(geometry,MagickPathExtent,"%gx%g%+g%+g",(double) image->columns,(double) image->rows,(double) page.x,(double) page.y); (void) CloneString(&draw_info->geometry,geometry); status=GetTypeMetrics(image,draw_info,&metrics,exception); if (status == MagickFalse) ThrowReaderException(TypeError,"UnableToGetTypeMetrics"); page.y=(ssize_t) ceil((double) page.y+metrics.ascent-0.5); (void) FormatLocaleString(geometry,MagickPathExtent,"%gx%g%+g%+g",(double) image->columns,(double) image->rows,(double) page.x,(double) page.y); (void) CloneString(&draw_info->geometry,geometry); (void) CopyMagickString(filename,image_info->filename,MagickPathExtent); if (*draw_info->text != '/0') *draw_info->text='/0'; p=text; for (offset=2*page.y; p != (char *) NULL; ) { /* Annotate image with text. */ (void) ConcatenateString(&draw_info->text,text); (void) ConcatenateString(&draw_info->text,"/n"); offset+=(ssize_t) (metrics.ascent-metrics.descent); if (image->previous == (Image *) NULL) { status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) offset,
开发者ID:remicollet,项目名称:ImageMagick,代码行数:67,
示例12: assert//.........这里部分代码省略......... ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); count=ReadBlob(image,(size_t) GetBlobSize(image),buffer); if ((count == 0) || (LocaleNCompare((char *) buffer,"SFW",3) != 0)) ThrowReaderException(CorruptImageError,"ImproperImageHeader"); (void) CloseBlob(image); image=DestroyImage(image); /* Find the start of the JFIF data */ header=SFWScan(buffer,buffer+count-1,(const unsigned char *) "/377/310/377/320",4); if (header == (unsigned char *) NULL) { buffer=(unsigned char *) RelinquishMagickMemory(buffer); ThrowReaderException(CorruptImageError,"ImproperImageHeader"); } TranslateSFWMarker(header); /* translate soi and app tags */ TranslateSFWMarker(header+2); (void) CopyMagickMemory(header+6,"JFIF/0/001/0",7); /* JFIF magic */ /* Translate remaining markers. */ offset=header+2; offset+=(offset[2] << 8)+offset[3]+2; for ( ; ; ) { TranslateSFWMarker(offset); if (offset[1] == 0xda) break; offset+=(offset[2] << 8)+offset[3]+2; } offset--; data=SFWScan(offset,buffer+count-1,(const unsigned char *) "/377/311",2); if (data == (unsigned char *) NULL) { buffer=(unsigned char *) RelinquishMagickMemory(buffer); ThrowReaderException(CorruptImageError,"ImproperImageHeader"); } TranslateSFWMarker(data++); /* translate eoi marker */ /* Write JFIF file. */ read_info=CloneImageInfo(image_info); read_info->blob=(void *) NULL; read_info->length=0; file=(FILE *) NULL; unique_file=AcquireUniqueFileResource(read_info->filename); if (unique_file != -1) file=OpenMagickStream(read_info->filename,"wb"); if ((unique_file == -1) || (file == (FILE *) NULL)) { buffer=(unsigned char *) RelinquishMagickMemory(buffer); read_info=DestroyImageInfo(read_info); (void) CopyMagickString(image->filename,read_info->filename, MaxTextExtent); ThrowFileException(exception,FileOpenError,"UnableToCreateTemporaryFile", image->filename); image=DestroyImageList(image); return((Image *) NULL); } extent=fwrite(header,(size_t) (offset-header+1),1,file); extent=fwrite(HuffmanTable,1,sizeof(HuffmanTable)/sizeof(*HuffmanTable),file); extent=fwrite(offset+1,(size_t) (data-offset),1,file); status=ferror(file) == -1 ? MagickFalse : MagickTrue; (void) fclose(file); buffer=(unsigned char *) RelinquishMagickMemory(buffer); if (status == MagickFalse) { char *message; (void) remove(read_info->filename); read_info=DestroyImageInfo(read_info); message=GetExceptionMessage(errno); (void) ThrowMagickException(&image->exception,GetMagickModule(), FileOpenError,"UnableToWriteFile","`%s': %s",image->filename,message); message=DestroyString(message); image=DestroyImageList(image); return((Image *) NULL); } /* Read JPEG image. */ image=ReadImage(read_info,exception); (void) RelinquishUniqueFileResource(read_info->filename); read_info=DestroyImageInfo(read_info); if (image == (Image *) NULL) return(GetFirstImageInList(image)); /* Correct image orientation. */ flipped_image=FlipImage(image,exception); if (flipped_image != (Image *) NULL) { DuplicateBlob(flipped_image,image); image=DestroyImage(image); image=flipped_image; } return(GetFirstImageInList(image));}
开发者ID:0xPr0xy,项目名称:ImageMagick,代码行数:101,
示例13: dt_imageio_large_thumbnail// load a full-res thumbnail:int dt_imageio_large_thumbnail(const char *filename, uint8_t **buffer, int32_t *width, int32_t *height, dt_colorspaces_color_profile_type_t *color_space){ int res = 1; uint8_t *buf = NULL; char *mime_type = NULL; size_t bufsize; // get the biggest thumb from exif if(dt_exif_get_thumbnail(filename, &buf, &bufsize, &mime_type)) goto error; if(strcmp(mime_type, "image/jpeg") == 0) { // Decompress the JPG into our own memory format dt_imageio_jpeg_t jpg; if(dt_imageio_jpeg_decompress_header(buf, bufsize, &jpg)) goto error; *buffer = (uint8_t *)malloc((size_t)sizeof(uint8_t) * jpg.width * jpg.height * 4); if(!*buffer) goto error; *width = jpg.width; *height = jpg.height; // TODO: check if the embedded thumbs have a color space set! currently we assume that it's always sRGB *color_space = DT_COLORSPACE_SRGB; if(dt_imageio_jpeg_decompress(&jpg, *buffer)) { free(*buffer); *buffer = NULL; goto error; } res = 0; } else {#ifdef HAVE_GRAPHICSMAGICK ExceptionInfo exception; Image *image = NULL; ImageInfo *image_info = NULL; GetExceptionInfo(&exception); image_info = CloneImageInfo((ImageInfo *)NULL); image = BlobToImage(image_info, buf, bufsize, &exception); if(exception.severity != UndefinedException) CatchException(&exception); if(!image) { fprintf(stderr, "[dt_imageio_large_thumbnail GM] thumbnail not found?/n"); goto error_gm; } *width = image->columns; *height = image->rows; *color_space = DT_COLORSPACE_SRGB; // FIXME: this assumes that embedded thumbnails are always srgb *buffer = (uint8_t *)malloc((size_t)sizeof(uint8_t) * image->columns * image->rows * 4); if(!*buffer) goto error_gm; for(uint32_t row = 0; row < image->rows; row++) { uint8_t *bufprt = *buffer + (size_t)4 * row * image->columns; int gm_ret = DispatchImage(image, 0, row, image->columns, 1, "RGBP", CharPixel, bufprt, &exception); if(exception.severity != UndefinedException) CatchException(&exception); if(gm_ret != MagickPass) { fprintf(stderr, "[dt_imageio_large_thumbnail GM] error_gm reading thumbnail/n"); free(*buffer); *buffer = NULL; goto error_gm; } } // fprintf(stderr, "[dt_imageio_large_thumbnail GM] successfully decoded thumbnail/n"); res = 0; error_gm: if(image) DestroyImage(image); if(image_info) DestroyImageInfo(image_info); DestroyExceptionInfo(&exception); if(res) goto error;#else fprintf(stderr, "[dt_imageio_large_thumbnail] error: The thumbnail image is not in JPEG format, but DT " "was built without GraphicsMagick. Please rebuild DT with GraphicsMagick support " "enabled./n");#endif } if(res) { fprintf( stderr, "[dt_imageio_large_thumbnail] error: Not a supported thumbnail image format or broken thumbnail: %s/n", mime_type); goto error; }//.........这里部分代码省略.........
开发者ID:CoreyChen922,项目名称:darktable,代码行数:101,
示例14: WriteINLINEImage/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% %% %% W r i t e I N L I N E I m a g e %% %% %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% WriteINLINEImage() writes an image to a file in INLINE format (Base64).%% The format of the WriteINLINEImage method is:%% MagickBooleanType WriteINLINEImage(const ImageInfo *image_info,% Image *image,ExceptionInfo *exception)%% A description of each parameter follows.%% o image_info: the image info.%% o image: The image.%% o exception: return any errors or warnings in this structure.%*/static MagickBooleanType WriteINLINEImage(const ImageInfo *image_info, Image *image,ExceptionInfo *exception){ char *base64, message[MagickPathExtent]; const MagickInfo *magick_info; Image *write_image; ImageInfo *write_info; MagickBooleanType status; size_t blob_length, encode_length; unsigned char *blob; /* Convert image to base64-encoding. */ assert(image_info != (const ImageInfo *) NULL); assert(image_info->signature == MagickCoreSignature); assert(image != (Image *) NULL); assert(image->signature == MagickCoreSignature); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename); write_info=CloneImageInfo(image_info); (void) SetImageInfo(write_info,1,exception); if (LocaleCompare(write_info->magick,"INLINE") == 0) (void) CopyMagickString(write_info->magick,image->magick,MagickPathExtent); magick_info=GetMagickInfo(write_info->magick,exception); if ((magick_info == (const MagickInfo *) NULL) || (GetMagickMimeType(magick_info) == (const char *) NULL)) ThrowWriterException(CorruptImageError,"ImageTypeNotSupported"); (void) CopyMagickString(image->filename,write_info->filename, MagickPathExtent); blob_length=2048; write_image=CloneImage(image,0,0,MagickTrue,exception); if (write_image == (Image *) NULL) { write_info=DestroyImageInfo(write_info); return(MagickTrue); } blob=(unsigned char *) ImageToBlob(write_info,write_image,&blob_length, exception); write_image=DestroyImage(write_image); write_info=DestroyImageInfo(write_info); if (blob == (unsigned char *) NULL) return(MagickFalse); encode_length=0; base64=Base64Encode(blob,blob_length,&encode_length); blob=(unsigned char *) RelinquishMagickMemory(blob); if (base64 == (char *) NULL) ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed"); /* Write base64-encoded image. */ status=OpenBlob(image_info,image,WriteBinaryBlobMode,exception); if (status == MagickFalse) { base64=DestroyString(base64); return(status); } (void) FormatLocaleString(message,MagickPathExtent,"data:%s;base64,",//.........这里部分代码省略.........
开发者ID:278443820,项目名称:ImageMagick,代码行数:101,
示例15: ReadImages/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% %% %% R e a d I m a g e s %% %% %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ReadImages() reads one or more images and returns them as an image list.%% The format of the ReadImage method is:%% Image *ReadImages(ImageInfo *image_info,const char *filename,% ExceptionInfo *exception)%% A description of each parameter follows:%% o image_info: the image info.%% o filename: the image filename.%% o exception: return any errors or warnings in this structure.%*/MagickExport Image *ReadImages(ImageInfo *image_info,const char *filename, ExceptionInfo *exception){ char read_filename[MagickPathExtent]; Image *image, *images; ImageInfo *read_info; /* Read image list from a file. */ assert(image_info != (ImageInfo *) NULL); assert(image_info->signature == MagickCoreSignature); if (image_info->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s", image_info->filename); assert(exception != (ExceptionInfo *) NULL); read_info=CloneImageInfo(image_info); *read_info->magick='/0'; (void) SetImageOption(read_info,"filename",filename); (void) CopyMagickString(read_info->filename,filename,MagickPathExtent); (void) InterpretImageFilename(read_info,(Image *) NULL,filename, (int) read_info->scene,read_filename,exception); if (LocaleCompare(read_filename,read_info->filename) != 0) { ExceptionInfo *sans; ssize_t extent, scene; /* Images of the form image-%d.png[1-5]. */ sans=AcquireExceptionInfo(); (void) SetImageInfo(read_info,0,sans); sans=DestroyExceptionInfo(sans); if (read_info->number_scenes == 0) { read_info=DestroyImageInfo(read_info); return(ReadImage(image_info,exception)); } (void) CopyMagickString(read_filename,read_info->filename,MagickPathExtent); images=NewImageList(); extent=(ssize_t) (read_info->scene+read_info->number_scenes); for (scene=(ssize_t) read_info->scene; scene < (ssize_t) extent; scene++) { (void) InterpretImageFilename(image_info,(Image *) NULL,read_filename, (int) scene,read_info->filename,exception); image=ReadImage(read_info,exception); if (image == (Image *) NULL) continue; AppendImageToList(&images,image); } read_info=DestroyImageInfo(read_info); return(images); } image=ReadImage(read_info,exception); read_info=DestroyImageInfo(read_info); return(image);}
开发者ID:freehawkzk,项目名称:ImageMagick,代码行数:94,
示例16: WriteMPEGImage//.........这里部分代码省略......... length=0; scene=p->scene; delay=100.0*p->delay/MagickMax(1.0*p->ticks_per_second,1.0); for (i=0; i < (ssize_t) MagickMax((1.0*delay+1.0)/3.0,1.0); i++) { p->scene=count; count++; status=MagickFalse; switch (i) { case 0: { Image *frame; (void) FormatLocaleString(p->filename,MagickPathExtent,"%s%.20g.%s", basename,(double) p->scene,WriteMPEGIntermediateFormat); (void) FormatLocaleString(filename,MagickPathExtent,"%s%.20g.%s", basename,(double) p->scene,WriteMPEGIntermediateFormat); (void) FormatLocaleString(previous_image,MagickPathExtent, "%s%.20g.%s",basename,(double) p->scene, WriteMPEGIntermediateFormat); frame=CloneImage(p,0,0,MagickTrue,exception); if (frame == (Image *) NULL) break; status=WriteImage(write_info,frame,exception); frame=DestroyImage(frame); break; } case 1: { blob=(unsigned char *) FileToBlob(previous_image,~0UL,&length, exception); } default: { (void) FormatLocaleString(filename,MagickPathExtent,"%s%.20g.%s", basename,(double) p->scene,WriteMPEGIntermediateFormat); if (length > 0) status=BlobToFile(filename,blob,length,exception); break; } } if (image->debug != MagickFalse) { if (status != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "%.20g. Wrote %s file for scene %.20g:",(double) i, WriteMPEGIntermediateFormat,(double) p->scene); else (void) LogMagickEvent(CoderEvent,GetMagickModule(), "%.20g. Failed to write %s file for scene %.20g:",(double) i, WriteMPEGIntermediateFormat,(double) p->scene); (void) LogMagickEvent(CoderEvent,GetMagickModule(),"%s",filename); } } p->scene=scene; if (blob != (unsigned char *) NULL) blob=(unsigned char *) RelinquishMagickMemory(blob); if (status == MagickFalse) break; } /* Convert JPEG to MPEG. */ (void) CopyMagickString(coalesce_image->magick_filename,basename, MagickPathExtent); (void) CopyMagickString(coalesce_image->filename,basename,MagickPathExtent); GetPathComponent(image_info->filename,ExtensionPath,coalesce_image->magick); if (*coalesce_image->magick == '/0') (void) CopyMagickString(coalesce_image->magick,image->magick, MagickPathExtent); status=InvokeDelegate(write_info,coalesce_image,(char *) NULL,"mpeg:encode", exception); (void) FormatLocaleString(write_info->filename,MagickPathExtent,"%s.%s", write_info->unique,coalesce_image->magick); status=CopyDelegateFile(write_info->filename,image->filename); (void) RelinquishUniqueFileResource(write_info->filename); write_info=DestroyImageInfo(write_info); /* Relinquish resources. */ count=0; for (p=coalesce_image; p != (Image *) NULL; p=GetNextImageInList(p)) { delay=100.0*p->delay/MagickMax(1.0*p->ticks_per_second,1.0); for (i=0; i < (ssize_t) MagickMax((1.0*delay+1.0)/3.0,1.0); i++) { (void) FormatLocaleString(p->filename,MagickPathExtent,"%s%.20g.%s", basename,(double) count++,WriteMPEGIntermediateFormat); (void) RelinquishUniqueFileResource(p->filename); } (void) CopyMagickString(p->filename,image_info->filename,MagickPathExtent); } (void) RelinquishUniqueFileResource(basename); coalesce_image=DestroyImageList(coalesce_image); if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(),"exit"); return(status);}
开发者ID:vcgato29,项目名称:ImageMagick,代码行数:101,
示例17: WriteImage/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% %% %% W r i t e I m a g e %% %% %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% WriteImage() writes an image or an image sequence to a file or file handle.% If writing to a file is on disk, the name is defined by the filename member% of the image structure. WriteImage() returns MagickFalse is there is a% memory shortage or if the image cannot be written. Check the exception% member of image to determine the cause for any failure.%% The format of the WriteImage method is:%% MagickBooleanType WriteImage(const ImageInfo *image_info,Image *image,% ExceptionInfo *exception)%% A description of each parameter follows:%% o image_info: the image info.%% o image: the image.%% o exception: return any errors or warnings in this structure.%*/MagickExport MagickBooleanType WriteImage(const ImageInfo *image_info, Image *image,ExceptionInfo *exception){ char filename[MagickPathExtent]; const char *option; const DelegateInfo *delegate_info; const MagickInfo *magick_info; ExceptionInfo *sans_exception; ImageInfo *write_info; MagickBooleanType status, temporary; PolicyDomain domain; PolicyRights rights; /* Determine image type from filename prefix or suffix (e.g. image.jpg). */ assert(image_info != (ImageInfo *) NULL); assert(image_info->signature == MagickCoreSignature); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s", image_info->filename); assert(image != (Image *) NULL); assert(image->signature == MagickCoreSignature); assert(exception != (ExceptionInfo *) NULL); sans_exception=AcquireExceptionInfo(); write_info=CloneImageInfo(image_info); (void) CopyMagickString(write_info->filename,image->filename,MagickPathExtent); (void) SetImageInfo(write_info,1,sans_exception); if (*write_info->magick == '/0') (void) CopyMagickString(write_info->magick,image->magick,MagickPathExtent); (void) CopyMagickString(filename,image->filename,MagickPathExtent); (void) CopyMagickString(image->filename,write_info->filename,MagickPathExtent); domain=CoderPolicyDomain; rights=WritePolicyRights; if (IsRightsAuthorized(domain,rights,write_info->magick) == MagickFalse) { sans_exception=DestroyExceptionInfo(sans_exception); write_info=DestroyImageInfo(write_info); errno=EPERM; ThrowBinaryException(PolicyError,"NotAuthorized",filename); } /* Call appropriate image reader based on image type. */ magick_info=GetMagickInfo(write_info->magick,sans_exception); sans_exception=DestroyExceptionInfo(sans_exception); if (magick_info != (const MagickInfo *) NULL) { if (GetMagickEndianSupport(magick_info) == MagickFalse) image->endian=UndefinedEndian; else//.........这里部分代码省略.........
开发者ID:freehawkzk,项目名称:ImageMagick,代码行数:101,
示例18: WritePICONImage//.........这里部分代码省略......... unsigned long characters_per_pixel, colors; /* Open output image file. */ assert(image_info != (const ImageInfo *) NULL); assert(image_info->signature == MagickSignature); assert(image != (Image *) NULL); assert(image->signature == MagickSignature); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename); status=OpenBlob(image_info,image,WriteBinaryBlobMode,&image->exception); if (status == MagickFalse) return(status); if (image->colorspace != RGBColorspace) (void) TransformImageColorspace(image,RGBColorspace); SetGeometry(image,&geometry); (void) ParseMetaGeometry(PiconGeometry,&geometry.x,&geometry.y, &geometry.width,&geometry.height); picon=ResizeImage(image,geometry.width,geometry.height,TriangleFilter,1.0, &image->exception); blob_info=CloneImageInfo(image_info); (void) AcquireUniqueFilename(blob_info->filename); if ((image_info->type != TrueColorType) && (IsGrayImage(image,&image->exception) != MagickFalse)) affinity_image=BlobToImage(blob_info,Graymap,GraymapExtent, &image->exception); else affinity_image=BlobToImage(blob_info,Colormap,ColormapExtent, &image->exception); (void) RelinquishUniqueFileResource(blob_info->filename); blob_info=DestroyImageInfo(blob_info); if ((picon == (Image *) NULL) || (affinity_image == (Image *) NULL)) return(MagickFalse); quantize_info=AcquireQuantizeInfo(image_info); status=RemapImage(quantize_info,picon,affinity_image); quantize_info=DestroyQuantizeInfo(quantize_info); affinity_image=DestroyImage(affinity_image); transparent=MagickFalse; exception=(&image->exception); if (picon->storage_class == PseudoClass) { CompressImageColormap(picon); if (picon->matte != MagickFalse) transparent=MagickTrue; } else { /* Convert DirectClass to PseudoClass picon. */ if (picon->matte != MagickFalse) { /* Map all the transparent pixels. */ for (y=0; y < (long) picon->rows; y++) { q=GetAuthenticPixels(picon,0,y,picon->columns,1,exception); if (q == (PixelPacket *) NULL) break; for (x=0; x < (long) picon->columns; x++) { if (q->opacity == (Quantum) TransparentOpacity)
开发者ID:0xPr0xy,项目名称:ImageMagick,代码行数:67,
示例19: WriteTHUMBNAILImage/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% %% %% W r i t e T H U M B N A I L I m a g e %% %% %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% WriteTHUMBNAILImage() extracts the EXIF thumbnail image and writes it.%% The format of the WriteTHUMBNAILImage method is:%% MagickBooleanType WriteTHUMBNAILImage(const ImageInfo *image_info,% Image *image)%% A description of each parameter follows.%% o image_info: the image info.%% o image: The image.%*/static MagickBooleanType WriteTHUMBNAILImage(const ImageInfo *image_info, Image *image){ const char *property; const StringInfo *profile; Image *thumbnail_image; ImageInfo *write_info; MagickBooleanType status; register ssize_t i; size_t length; ssize_t offset; unsigned char magick[MaxTextExtent]; profile=GetImageProfile(image,"exif"); if (profile == (const StringInfo *) NULL) ThrowWriterException(CoderError,"ImageDoesNotHaveAThumbnail"); property=GetImageProperty(image,"exif:JPEGInterchangeFormat"); if (property == (const char *) NULL) ThrowWriterException(CoderError,"ImageDoesNotHaveAThumbnail"); offset=(ssize_t) StringToLong(property); property=GetImageProperty(image,"exif:JPEGInterchangeFormatLength"); if (property == (const char *) NULL) ThrowWriterException(CoderError,"ImageDoesNotHaveAThumbnail"); length=(size_t) StringToLong(property); (void) ResetMagickMemory(magick,0,sizeof(magick)); for (i=0; i < (ssize_t) length; i++) { magick[0]=magick[1]; magick[1]=magick[2]; magick[2]=GetStringInfoDatum(profile)[offset+i]; if (memcmp(magick,"/377/330/377",3) == 0) break; } thumbnail_image=BlobToImage(image_info,GetStringInfoDatum(profile)+offset+i-2, length,&image->exception); if (thumbnail_image == (Image *) NULL) return(MagickFalse); (void) SetImageType(thumbnail_image,thumbnail_image->matte == MagickFalse ? TrueColorType : TrueColorMatteType); (void) CopyMagickString(thumbnail_image->filename,image->filename, MaxTextExtent); write_info=CloneImageInfo(image_info); (void) SetImageInfo(write_info,1,&image->exception); if (LocaleCompare(write_info->magick,"THUMBNAIL") == 0) (void) FormatLocaleString(thumbnail_image->filename,MaxTextExtent, "miff:%s",write_info->filename); status=WriteImage(write_info,thumbnail_image); thumbnail_image=DestroyImage(thumbnail_image); write_info=DestroyImageInfo(write_info); return(status);}
开发者ID:0xPr0xy,项目名称:ImageMagick,代码行数:93,
示例20: ReadPESImage//.........这里部分代码省略......... { /* Normal stitch. */ if ((y & 0x40) != 0) y-=0x80; } else { /* Jump stitch. */ y=((y & 0x0f) << 8)+ReadBlobByte(image); if ((y & 0x800) != 0) y-=0x1000; } /* Note stitch (x,y). */ x+=delta_x; y+=delta_y; delta_x=x; delta_y=y; stitches[i].x=(double) x; stitches[i].y=(double) y; if ((double) x < bounds.x1) bounds.x1=(double) x; if ((double) x > bounds.x2) bounds.x2=(double) x; if ((double) y < bounds.y1) bounds.y1=(double) y; if ((double) y > bounds.y2) bounds.y2=(double) y; i++; if (i >= (ssize_t) number_stitches) { /* Make room for more stitches. */ number_stitches<<=1; stitches=(PointInfo *) ResizeQuantumMemory(stitches,(size_t) number_stitches,sizeof(*stitches)); if (stitches == (PointInfo *) NULL) ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); } } j++; blocks[j].offset=(ssize_t) i; number_blocks=(size_t) j; /* Write stitches as SVG file. */ file=(FILE *) NULL; unique_file=AcquireUniqueFileResource(filename); if (unique_file != -1) file=fdopen(unique_file,"wb"); if ((unique_file == -1) || (file == (FILE *) NULL)) ThrowImageException(FileOpenError,"UnableToCreateTemporaryFile"); (void) FormatLocaleFile(file,"<?xml version=/"1.0/"?>/n"); (void) FormatLocaleFile(file,"<svg xmlns=/"http://www.w3.org/2000/svg/" " "xlink=/"http://www.w3.org/1999/xlink/" " "ev=/"http://www.w3.org/2001/xml-events/" version=/"1.1/" " "baseProfile=/"full/" width=/"%g/" height=/"%g/">/n",bounds.x2-bounds.x1, bounds.y2-bounds.y1); for (i=0; i < (ssize_t) number_blocks; i++) { offset=blocks[i].offset; (void) FormatLocaleFile(file," <path stroke=/"#%02x%02x%02x/" " "fill=/"none/" d=/"M %g %g",blocks[i].color->red,blocks[i].color->green, blocks[i].color->blue,stitches[offset].x-bounds.x1, stitches[offset].y-bounds.y1); for (j=1; j < (ssize_t) (blocks[i+1].offset-offset); j++) (void) FormatLocaleFile(file," L %g %g",stitches[offset+j].x-bounds.x1, stitches[offset+j].y-bounds.y1); (void) FormatLocaleFile(file,"/"/>/n"); } (void) FormatLocaleFile(file,"</svg>/n"); (void) fclose(file); (void) CloseBlob(image); image=DestroyImage(image); /* Read SVG file. */ read_info=CloneImageInfo(image_info); SetImageInfoBlob(read_info,(void *) NULL,0); (void) FormatLocaleString(read_info->filename,MaxTextExtent,"svg:%s", filename); image=ReadImage(read_info,exception); if (image != (Image *) NULL) { (void) CopyMagickString(image->filename,image_info->filename, MaxTextExtent); (void) CopyMagickString(image->magick_filename,image_info->filename, MaxTextExtent); (void) CopyMagickString(image->magick,"PES",MaxTextExtent); } read_info=DestroyImageInfo(read_info); (void) RelinquishUniqueFileResource(filename); return(GetFirstImageInList(image));}
开发者ID:GalliumOS,项目名称:imagemagick,代码行数:101,
示例21: SetImageInfoBlobstatic Image *ReadURLImage(const ImageInfo *image_info,ExceptionInfo *exception){#define MaxBufferExtent 8192 char filename[MagickPathExtent]; FILE *file; Image *image; ImageInfo *read_info; int unique_file; read_info=CloneImageInfo(image_info); SetImageInfoBlob(read_info,(void *) NULL,0); if (LocaleCompare(read_info->magick,"file") == 0) { (void) CopyMagickString(read_info->filename,image_info->filename+2, MagickPathExtent); *read_info->magick='/0'; image=ReadImage(read_info,exception); read_info=DestroyImageInfo(read_info); return(GetFirstImageInList(image)); } file=(FILE *) NULL; unique_file=AcquireUniqueFileResource(read_info->filename); if (unique_file != -1) file=fdopen(unique_file,"wb"); if ((unique_file == -1) || (file == (FILE *) NULL)) { ThrowFileException(exception,FileOpenError,"UnableToCreateTemporaryFile", read_info->filename); read_info=DestroyImageInfo(read_info); return((Image *) NULL); } (void) CopyMagickString(filename,image_info->magick,MagickPathExtent); (void) ConcatenateMagickString(filename,":",MagickPathExtent); LocaleLower(filename); (void) ConcatenateMagickString(filename,image_info->filename, MagickPathExtent);#if defined(MAGICKCORE_WINDOWS_SUPPORT) && / !(defined(__MINGW32__) || defined(__MINGW64__)) (void) fclose(file); if (URLDownloadToFile(NULL,filename,read_info->filename,0,NULL) != S_OK) { ThrowFileException(exception,FileOpenError,"UnableToOpenFile", filename); (void) RelinquishUniqueFileResource(read_info->filename); read_info=DestroyImageInfo(read_info); return((Image *) NULL); }#else#if defined(MAGICKCORE_XML_DELEGATE) && defined(LIBXML_FTP_ENABLED) if (LocaleCompare(read_info->magick,"ftp") == 0) { void *context; xmlNanoFTPInit(); context=xmlNanoFTPNewCtxt(filename); if (context != (void *) NULL) { if (xmlNanoFTPConnect(context) >= 0) (void) xmlNanoFTPGet(context,GetFTPData,(void *) file, (char *) NULL); (void) xmlNanoFTPClose(context); } }#endif#if defined(MAGICKCORE_XML_DELEGATE) && defined(LIBXML_HTTP_ENABLED) if (LocaleCompare(read_info->magick,"http") == 0) { char buffer[MaxBufferExtent], *type; int bytes; void *context; type=(char *) NULL; context=xmlNanoHTTPMethod(filename,(const char *) NULL, (const char *) NULL,&type,(const char *) NULL,0); if (context != (void *) NULL) { ssize_t count; while ((bytes=xmlNanoHTTPRead(context,buffer,MaxBufferExtent)) > 0) count=(ssize_t) fwrite(buffer,bytes,1,file); (void) count; xmlNanoHTTPClose(context);//.........这里部分代码省略.........
开发者ID:278443820,项目名称:ImageMagick,代码行数:101,
示例22: ReadPCLImage//.........这里部分代码省略......... if (count != 4) continue; /* Set PCL render geometry. */ width=(size_t) floor(bounds.x2-bounds.x1+0.5); height=(size_t) floor(bounds.y2-bounds.y1+0.5); if (width > page.width) page.width=width; if (height > page.height) page.height=height; } (void) CloseBlob(image); /* Render PCL with the GhostPCL delegate. */ if ((page.width == 0) || (page.height == 0)) (void) ParseAbsoluteGeometry(PSPageGeometry,&page); if (image_info->page != (char *) NULL) (void) ParseAbsoluteGeometry(image_info->page,&page); (void) FormatLocaleString(geometry,MaxTextExtent,"%.20gx%.20g",(double) page.width,(double) page.height); if (image_info->monochrome != MagickFalse) delegate_info=GetDelegateInfo("pcl:mono",(char *) NULL,exception); else if (cmyk != MagickFalse) delegate_info=GetDelegateInfo("pcl:cmyk",(char *) NULL,exception); else delegate_info=GetDelegateInfo("pcl:color",(char *) NULL,exception); if (delegate_info == (const DelegateInfo *) NULL) return((Image *) NULL); *options='/0'; if ((page.width == 0) || (page.height == 0)) (void) ParseAbsoluteGeometry(PSPageGeometry,&page); if (image_info->page != (char *) NULL) (void) ParseAbsoluteGeometry(image_info->page,&page); (void) FormatLocaleString(density,MaxTextExtent,"%gx%g", image->resolution.x,image->resolution.y); page.width=(size_t) floor(page.width*image->resolution.x/delta.x+0.5); page.height=(size_t) floor(page.height*image->resolution.y/delta.y+ 0.5); (void) FormatLocaleString(options,MaxTextExtent,"-g%.20gx%.20g ",(double) page.width,(double) page.height); image=DestroyImage(image); read_info=CloneImageInfo(image_info); *read_info->magick='/0'; if (read_info->number_scenes != 0) { if (read_info->number_scenes != 1) (void) FormatLocaleString(options,MaxTextExtent,"-dLastPage=%.20g", (double) (read_info->scene+read_info->number_scenes)); else (void) FormatLocaleString(options,MaxTextExtent, "-dFirstPage=%.20g -dLastPage=%.20g",(double) read_info->scene+1, (double) (read_info->scene+read_info->number_scenes)); read_info->number_scenes=0; if (read_info->scenes != (char *) NULL) *read_info->scenes='/0'; } option=GetImageOption(read_info,"authenticate"); if (option != (const char *) NULL) (void) FormatLocaleString(options+strlen(options),MaxTextExtent, " -sPCLPassword=%s",option); (void) CopyMagickString(filename,read_info->filename,MaxTextExtent); (void) AcquireUniqueFilename(read_info->filename); (void) FormatLocaleString(command,MaxTextExtent, GetDelegateCommands(delegate_info), read_info->antialias != MagickFalse ? 4 : 1, read_info->antialias != MagickFalse ? 4 : 1,density,options, read_info->filename,input_filename); status=SystemCommand(MagickFalse,read_info->verbose,command,exception) != 0 ? MagickTrue : MagickFalse; image=ReadImage(read_info,exception); (void) RelinquishUniqueFileResource(read_info->filename); (void) RelinquishUniqueFileResource(input_filename); read_info=DestroyImageInfo(read_info); if (image == (Image *) NULL) ThrowReaderException(DelegateError,"PCLDelegateFailed"); if (LocaleCompare(image->magick,"BMP") == 0) { Image *cmyk_image; cmyk_image=ConsolidateCMYKImages(image,exception); if (cmyk_image != (Image *) NULL) { image=DestroyImageList(image); image=cmyk_image; } } do { (void) CopyMagickString(image->filename,filename,MaxTextExtent); image->page=page; next_image=SyncNextImageInList(image); if (next_image != (Image *) NULL) image=next_image; } while (next_image != (Image *) NULL); return(GetFirstImageInList(image));}
开发者ID:ChaseReid,项目名称:ImageMagick,代码行数:101,
示例23: dt_imageio_open_gmdt_imageio_retval_tdt_imageio_open_gm( dt_image_t *img, const char *filename, dt_mipmap_cache_allocator_t a){ int err = DT_IMAGEIO_FILE_CORRUPTED; float *buf = NULL; ExceptionInfo exception; Image *image = NULL; ImageInfo *image_info = NULL; uint32_t width, height, orientation; if(!_supported_image(filename)) return DT_IMAGEIO_FILE_CORRUPTED; if(!img->exif_inited) (void) dt_exif_read(img, filename); GetExceptionInfo(&exception); image_info=CloneImageInfo((ImageInfo *) NULL); g_strlcpy(image_info->filename,filename,sizeof(image_info->filename)); image=ReadImage(image_info,&exception); if (exception.severity != UndefinedException) CatchException(&exception); if (!image) { fprintf(stderr, "[GraphicsMagick_open] image `%s' not found/n", img->filename); err = DT_IMAGEIO_FILE_NOT_FOUND; goto error; } width = image->columns; height = image->rows; orientation = image->orientation; if(orientation & 4) { img->width = height; img->height = width; } else { img->width = width; img->height = height; } img->bpp = 4*sizeof(float); float *mipbuf = (float *)dt_mipmap_cache_alloc(img, DT_MIPMAP_FULL, a); if(!mipbuf) { fprintf(stderr, "[GraphicsMagick_open] could not alloc full buffer for image `%s'/n", img->filename); err = DT_IMAGEIO_CACHE_FULL; goto error; } buf = (float *)dt_alloc_align(16, width*img->bpp); if(!buf) goto error; const int ht2 = orientation & 4 ? img->width : img->height; // pretend unrotated, rotate in write_pos const int wd2 = orientation & 4 ? img->height : img->width; for (uint32_t row = 0; row < height; row++) { int ret = DispatchImage(image, 0, row, width, 1, "RGBP", FloatPixel, (void *)buf, &exception); if (exception.severity != UndefinedException) CatchException(&exception); if(ret != MagickPass) { fprintf(stderr, "[GraphicsMagick_open] error reading image `%s'/n", img->filename); err = DT_IMAGEIO_FILE_CORRUPTED; goto error; } for(uint32_t i=0; i<width; i++) for(int k=0; k<4; k++) mipbuf[4*dt_imageio_write_pos(i, row, wd2, ht2, wd2, ht2, orientation) + k] = buf[4*i + k]; } if(buf) dt_free_align(buf); if(image) DestroyImage(image); if(image_info) DestroyImageInfo(image_info); DestroyExceptionInfo(&exception); img->filters = 0; img->flags &= ~DT_IMAGE_RAW; img->flags &= ~DT_IMAGE_HDR; img->flags |= DT_IMAGE_LDR; return DT_IMAGEIO_OK;error: if(buf) dt_free_align(buf); if(image) DestroyImage(image); if(image_info) DestroyImageInfo(image_info); DestroyExceptionInfo(&exception); return err;}
开发者ID:hauva69,项目名称:darktable,代码行数:99,
示例24: WriteHISTOGRAMImage//.........这里部分代码省略......... */ (void) QueryColorCompliance("#000000",AllCompliance, &histogram_image->background_color,exception); (void) SetImageBackgroundColor(histogram_image,exception); for (x=0; x < (ssize_t) histogram_image->columns; x++) { q=GetAuthenticPixels(histogram_image,x,0,1,histogram_image->rows,exception); if (q == (Quantum *) NULL) break; if ((GetPixelRedTraits(image) & UpdatePixelTrait) != 0) { y=(ssize_t) ceil(histogram_image->rows-scale*histogram[x].red-0.5); r=q+y*GetPixelChannels(histogram_image); for ( ; y < (ssize_t) histogram_image->rows; y++) { SetPixelRed(histogram_image,QuantumRange,r); r+=GetPixelChannels(histogram_image); } } if ((GetPixelGreenTraits(image) & UpdatePixelTrait) != 0) { y=(ssize_t) ceil(histogram_image->rows-scale*histogram[x].green-0.5); r=q+y*GetPixelChannels(histogram_image); for ( ; y < (ssize_t) histogram_image->rows; y++) { SetPixelGreen(histogram_image,QuantumRange,r); r+=GetPixelChannels(histogram_image); } } if ((GetPixelBlueTraits(image) & UpdatePixelTrait) != 0) { y=(ssize_t) ceil(histogram_image->rows-scale*histogram[x].blue-0.5); r=q+y*GetPixelChannels(histogram_image); for ( ; y < (ssize_t) histogram_image->rows; y++) { SetPixelBlue(histogram_image,QuantumRange,r); r+=GetPixelChannels(histogram_image); } } if (SyncAuthenticPixels(histogram_image,exception) == MagickFalse) break; status=SetImageProgress(image,SaveImageTag,y,histogram_image->rows); if (status == MagickFalse) break; } histogram=(PixelInfo *) RelinquishMagickMemory(histogram); option=GetImageOption(image_info,"histogram:unique-colors"); if ((option == (const char *) NULL) || (IsStringTrue(option) != MagickFalse)) { FILE *file; int unique_file; /* Add a unique colors as an image comment. */ file=(FILE *) NULL; unique_file=AcquireUniqueFileResource(filename); if (unique_file != -1) file=fdopen(unique_file,"wb"); if ((unique_file != -1) && (file != (FILE *) NULL)) { char *property; (void) GetNumberColors(image,file,exception); (void) fclose(file); property=FileToString(filename,~0UL,exception); if (property != (char *) NULL) { (void) SetImageProperty(histogram_image,"comment",property, exception); property=DestroyString(property); } } (void) RelinquishUniqueFileResource(filename); } /* Write Histogram image. */ (void) CopyMagickString(histogram_image->filename,image_info->filename, MagickPathExtent); write_info=CloneImageInfo(image_info); *write_info->magick='/0'; (void) SetImageInfo(write_info,1,exception); if ((*write_info->magick == '/0') || (LocaleCompare(write_info->magick,"HISTOGRAM") == 0)) (void) FormatLocaleString(histogram_image->filename,MagickPathExtent, "miff:%s",write_info->filename); histogram_image->blob=DetachBlob(histogram_image->blob); histogram_image->blob=CloneBlobInfo(image->blob); status=WriteImage(write_info,histogram_image,exception); image->blob=DetachBlob(image->blob); image->blob=CloneBlobInfo(histogram_image->blob); histogram_image=DestroyImage(histogram_image); write_info=DestroyImageInfo(write_info); return(status);}
开发者ID:278443820,项目名称:ImageMagick,代码行数:101,
示例25: SetImageInfoBlobstatic Image *ReadPlasmaImage(const ImageInfo *image_info, ExceptionInfo *exception){ Image *image; ImageInfo *read_info; ssize_t y; MagickBooleanType status; register ssize_t x; register PixelPacket *q; register size_t i; SegmentInfo segment_info; size_t depth, max_depth; /* Recursively apply plasma to the image. */ read_info=CloneImageInfo(image_info); SetImageInfoBlob(read_info,(void *) NULL,0); (void) FormatMagickString(read_info->filename,MaxTextExtent, "gradient:%s",image_info->filename); image=ReadImage(read_info,exception); read_info=DestroyImageInfo(read_info); if (image == (Image *) NULL) return((Image *) NULL); image->storage_class=DirectClass; for (y=0; y < (ssize_t) image->rows; y++) { q=GetAuthenticPixels(image,0,y,image->columns,1,exception); if (q == (PixelPacket *) NULL) break; for (x=0; x < (ssize_t) image->columns; x++) { q->opacity=(Quantum) (QuantumRange/2); q++; } if (SyncAuthenticPixels(image,exception) == MagickFalse) break; } segment_info.x1=0; segment_info.y1=0; segment_info.x2=(double) image->columns-1; segment_info.y2=(double) image->rows-1; if (LocaleCompare(image_info->filename,"fractal") == 0) { RandomInfo *random_info; /* Seed pixels before recursion. */ random_info=AcquireRandomInfo(); PlasmaPixel(image,random_info,segment_info.x1,segment_info.y1); PlasmaPixel(image,random_info,segment_info.x1,(segment_info.y1+ segment_info.y2)/2); PlasmaPixel(image,random_info,segment_info.x1,segment_info.y2); PlasmaPixel(image,random_info,(segment_info.x1+segment_info.x2)/2, segment_info.y1); PlasmaPixel(image,random_info,(segment_info.x1+segment_info.x2)/2, (segment_info.y1+segment_info.y2)/2); PlasmaPixel(image,random_info,(segment_info.x1+segment_info.x2)/2, segment_info.y2); PlasmaPixel(image,random_info,segment_info.x2,segment_info.y1); PlasmaPixel(image,random_info,segment_info.x2,(segment_info.y1+ segment_info.y2)/2); PlasmaPixel(image,random_info,segment_info.x2,segment_info.y2); random_info=DestroyRandomInfo(random_info); } i=(size_t) MagickMax(image->columns,image->rows)/2; for (max_depth=0; i != 0; max_depth++) i>>=1; for (depth=1; ; depth++) { if (PlasmaImage(image,&segment_info,0,depth) != MagickFalse) break; status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) depth, max_depth); if (status == MagickFalse) break; } (void) SetImageAlphaChannel(image,DeactivateAlphaChannel); return(GetFirstImageInList(image));}
开发者ID:JasonGross,项目名称:characters,代码行数:100,
示例26: assert//.........这里部分代码省略......... number_files; MagickBooleanType status; MontageInfo *montage_info; RectangleInfo geometry; register ssize_t i; /* Expand the filename. */ assert(image_info != (const ImageInfo *) NULL); assert(image_info->signature == MagickCoreSignature); if (image_info->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s", image_info->filename); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickCoreSignature); image=AcquireImage(image_info,exception); filelist=(char **) AcquireMagickMemory(sizeof(*filelist)); if (filelist == (char **) NULL) ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); filelist[0]=ConstantString(image_info->filename); number_files=1; status=ExpandFilenames(&number_files,&filelist); if ((status == MagickFalse) || (number_files == 0)) ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); image=DestroyImage(image); /* Read each image and convert them to a tile. */ images=NewImageList(); read_info=CloneImageInfo(image_info); SetImageInfoBlob(read_info,(void *) NULL,0); (void) SetImageInfoProgressMonitor(read_info,(MagickProgressMonitor) NULL, (void *) NULL); if (read_info->size == (char *) NULL) (void) CloneString(&read_info->size,DefaultTileGeometry); for (i=0; i < (ssize_t) number_files; i++) { if (image_info->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(),"name: %s", filelist[i]); (void) CopyMagickString(read_info->filename,filelist[i],MagickPathExtent); filelist[i]=DestroyString(filelist[i]); *read_info->magick='/0'; next_image=ReadImage(read_info,exception); CatchException(exception); if (next_image == (Image *) NULL) break; label=InterpretImageProperties((ImageInfo *) image_info,next_image, DefaultTileLabel,exception); (void) SetImageProperty(next_image,"label",label,exception); label=DestroyString(label); if (image_info->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "geometry: %.20gx%.20g",(double) next_image->columns,(double) next_image->rows); SetGeometry(next_image,&geometry); (void) ParseMetaGeometry(read_info->size,&geometry.x,&geometry.y, &geometry.width,&geometry.height); thumbnail_image=ThumbnailImage(next_image,geometry.width,geometry.height, exception); if (thumbnail_image != (Image *) NULL) { next_image=DestroyImage(next_image); next_image=thumbnail_image; } if (image_info->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "thumbnail geometry: %.20gx%.20g",(double) next_image->columns,(double) next_image->rows); AppendImageToList(&images,next_image); status=SetImageProgress(images,LoadImagesTag,i,number_files); if (status == MagickFalse) break; } read_info=DestroyImageInfo(read_info); filelist=(char **) RelinquishMagickMemory(filelist); if (images == (Image *) NULL) ThrowReaderException(CorruptImageError, "ImageFileDoesNotContainAnyImageData"); /* Create the visual image directory. */ montage_info=CloneMontageInfo(image_info,(MontageInfo *) NULL); if (image_info->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(),"creating montage"); montage_image=MontageImageList(image_info,montage_info, GetFirstImageInList(images),exception); montage_info=DestroyMontageInfo(montage_info); images=DestroyImageList(images); return(montage_image);}
开发者ID:DINKIN,项目名称:ImageMagick,代码行数:101,
示例27: GlobExpression/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% %% %% G l o b E x p r e s s i o n %% %% %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GlobExpression() returns MagickTrue if the expression matches the pattern.%% The format of the GlobExpression function is:%% MagickBooleanType GlobExpression(const char *expression,% const char *pattern,const MagickBooleanType case_insensitive)%% A description of each parameter follows:%% o expression: Specifies a pointer to a text string containing a file name.%% o pattern: Specifies a pointer to a text string containing a pattern.%% o case_insensitive: set to MagickTrue to ignore the case when matching% an expression.%*/MagickExport MagickBooleanType GlobExpression(const char *expression, const char *pattern,const MagickBooleanType case_insensitive){ MagickBooleanType done, match; register const char *p; /* Return on empty pattern or '*'. */ if (pattern == (char *) NULL) return(MagickTrue); if (GetUTFCode(pattern) == 0) return(MagickTrue); if (LocaleCompare(pattern,"*") == 0) return(MagickTrue); p=pattern+strlen(pattern)-1; if ((GetUTFCode(p) == ']') && (strchr(pattern,'[') != (char *) NULL)) { ExceptionInfo *exception; ImageInfo *image_info; /* Determine if pattern is a scene, i.e. img0001.pcd[2]. */ image_info=AcquireImageInfo(); (void) CopyMagickString(image_info->filename,pattern,MagickPathExtent); exception=AcquireExceptionInfo(); (void) SetImageInfo(image_info,0,exception); exception=DestroyExceptionInfo(exception); if (LocaleCompare(image_info->filename,pattern) != 0) { image_info=DestroyImageInfo(image_info); return(MagickFalse); } image_info=DestroyImageInfo(image_info); } /* Evaluate glob expression. */ done=MagickFalse; while ((GetUTFCode(pattern) != 0) && (done == MagickFalse)) { if (GetUTFCode(expression) == 0) if ((GetUTFCode(pattern) != '{') && (GetUTFCode(pattern) != '*')) break; switch (GetUTFCode(pattern)) { case '*': { MagickBooleanType status; status=MagickFalse; pattern+=GetUTFOctets(pattern); while ((GetUTFCode(expression) != 0) && (status == MagickFalse)) { status=GlobExpression(expression,pattern,case_insensitive); expression+=GetUTFOctets(expression); } if (status != MagickFalse) { while (GetUTFCode(expression) != 0) expression+=GetUTFOctets(expression); while (GetUTFCode(pattern) != 0) pattern+=GetUTFOctets(pattern);//.........这里部分代码省略.........
开发者ID:riingo,项目名称:ImageMagick,代码行数:101,
示例28: WriteXTRNImagestatic unsigned int WriteXTRNImage(const ImageInfo *image_info,Image *image){ Image * p; ImageInfo *clone_info; int scene; void *param1, *param2, *param3; unsigned int status; param1 = param2 = param3 = (void *) NULL; if (LocaleCompare(image_info->magick,"XTRNFILE") == 0) { clone_info=CloneImageInfo(image_info); status=WriteImage(image_info,image); if (status == False) CatchImageException(image); DestroyImageInfo(clone_info); } else if (LocaleCompare(image_info->magick,"XTRNIMAGE") == 0) { Image **image_ptr; ImageInfo **image_info_ptr; clone_info=CloneImageInfo(image_info); if (clone_info->filename[0]) { (void) sscanf(clone_info->filename,"%lx,%lx",¶m1,¶m2); image_info_ptr=(ImageInfo **) param1; image_ptr=(Image **) param2; if ((image_info_ptr != (ImageInfo **) NULL) && (image_ptr != (Image **) NULL)) { *image_ptr=CloneImage(image,0,0,False,&(image->exception)); *image_info_ptr=clone_info; } } } else if (LocaleCompare(image_info->magick,"XTRNBLOB") == 0) { char **blob_data; ExceptionInfo exception; size_t *blob_length; char filename[MaxTextExtent]; clone_info=CloneImageInfo(image_info); if (clone_info->filename[0]) { (void) sscanf(clone_info->filename,"%lx,%lx,%s", ¶m1,¶m2,&filename); blob_data=(char **) param1; blob_length=(size_t *) param2; scene = 0; (void) strcpy(clone_info->filename, filename); for (p=image; p != (Image *) NULL; p=p->next) { (void) strcpy(p->filename, filename); p->scene=scene++; } SetImageInfo(clone_info,SETMAGICK_WRITE,&image->exception); (void) strcpy(image->magick,clone_info->magick); GetExceptionInfo(&exception); if (*blob_length == 0) *blob_length=8192; *blob_data=(char *) ImageToBlob(clone_info,image,blob_length,&exception); if (*blob_data == NULL) status=False; if (status == False) CatchImageException(image); } DestroyImageInfo(clone_info); } else if (LocaleCompare(image_info->magick,"XTRNARRAY") == 0) { char *blob_data; ExceptionInfo exception;//.........这里部分代码省略.........
开发者ID:CliffsDover,项目名称:graphicsmagick,代码行数:101,
示例29: main/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% %% %% M a i n %% %% %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/int main(int argc,char **argv){ char *option; double elapsed_time, user_time; ExceptionInfo *exception; ImageInfo *image_info; MagickBooleanType regard_warnings, status; register long i; TimerInfo timer; unsigned long iterations; MagickCoreGenesis(*argv,MagickTrue); exception=AcquireExceptionInfo(); iterations=1; status=MagickFalse; regard_warnings=MagickFalse; for (i=1; i < (long) (argc-1); i++) { option=argv[i]; if ((strlen(option) == 1) || ((*option != '-') && (*option != '+'))) continue; if (LocaleCompare("bench",option+1) == 0) iterations=(unsigned long) atol(argv[++i]); if (LocaleCompare("debug",option+1) == 0) (void) SetLogEventMask(argv[++i]); if (LocaleCompare("regard-warnings",option+1) == 0) regard_warnings=MagickTrue; } GetTimerInfo(&timer); for (i=0; i < (long) iterations; i++) { image_info=AcquireImageInfo(); status=ConvertImageCommand(image_info,argc,argv,(char **) NULL,exception); if (exception->severity != UndefinedException) { if ((exception->severity > ErrorException) || (regard_warnings != MagickFalse)) status=MagickTrue; CatchException(exception); } image_info=DestroyImageInfo(image_info); } if (iterations > 1) { elapsed_time=GetElapsedTime(&timer); user_time=GetUserTime(&timer); (void) fprintf(stderr,"Performance: %lui %gips %0.3fu %ld:%02ld/n", iterations,1.0*iterations/elapsed_time,user_time,(long) (elapsed_time/60.0+0.5),(long) ceil(fmod(elapsed_time,60.0))); } exception=DestroyExceptionInfo(exception); MagickCoreTerminus(); return(status == MagickFalse ? 0 : 1);}
开发者ID:0xPr0xy,项目名称:ImageMagick,代码行数:84,
注:本文中的DestroyImageInfo函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ DestroyImageList函数代码示例 C++ DestroyImage函数代码示例 |