本文整理汇总了C++中SetImageInfo函数的典型用法代码示例。如果您正苦于以下问题:C++ SetImageInfo函数的具体用法?C++ SetImageInfo怎么用?C++ SetImageInfo使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SetImageInfo函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FormatLocaleString
void Magick::Options::magick(const std::string &magick_)
{
if (magick_.empty())
{
_imageInfo->magick[0] = '\0';
return;
}
FormatLocaleString(_imageInfo->filename,MagickPathExtent,"%.1024s:",
magick_.c_str());
GetPPException;
SetImageInfo(_imageInfo,1,exceptionInfo);
if ( _imageInfo->magick[0] == '\0' )
throwExceptionExplicit(MagickCore::OptionError,"Unrecognized image format",
magick_.c_str());
ThrowPPException(_quiet);
}
示例2: WriteVIDImage
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% W r i t e V I D I m a g e %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% WriteVIDImage() writes an image to a file in VID X image format.
%
% The format of the WriteVIDImage method is:
%
% MagickBooleanType WriteVIDImage(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 WriteVIDImage(const ImageInfo *image_info,Image *image,
ExceptionInfo *exception)
{
Image
*montage_image;
ImageInfo
*write_info;
MagickBooleanType
status;
MontageInfo
*montage_info;
register Image
*p;
/*
Create the visual image directory.
*/
for (p=image; p != (Image *) NULL; p=GetNextImageInList(p))
(void) SetImageProperty(p,"label",DefaultTileLabel,exception);
montage_info=CloneMontageInfo(image_info,(MontageInfo *) NULL);
montage_image=MontageImageList(image_info,montage_info,image,exception);
montage_info=DestroyMontageInfo(montage_info);
if (montage_image == (Image *) NULL)
return(MagickFalse);
(void) CopyMagickString(montage_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,"VID") == 0))
(void) FormatLocaleString(montage_image->filename,MagickPathExtent,
"miff:%s",write_info->filename);
status=WriteImage(write_info,montage_image,exception);
montage_image=DestroyImage(montage_image);
write_info=DestroyImageInfo(write_info);
return(status);
}
示例3: WriteVIDImage
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% W r i t e V I D I m a g e %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% WriteVIDImage() writes an image to a file in VID X image format.
%
% The format of the WriteVIDImage method is:
%
% MagickBooleanType WriteVIDImage(const ImageInfo *image_info,Image *image)
%
% A description of each parameter follows.
%
% o image_info: the image info.
%
% o image: The image.
%
*/
static MagickBooleanType WriteVIDImage(const ImageInfo *image_info,Image *image)
{
Image
*montage_image;
ImageInfo
*write_info;
MagickBooleanType
status;
MontageInfo
*montage_info;
register Image
*p;
/*
Create the visual image directory.
*/
for (p=image; p != (Image *) NULL; p=GetNextImageInList(p))
(void) SetImageProperty(p,"label",DefaultTileLabel);
montage_info=CloneMontageInfo(image_info,(MontageInfo *) NULL);
montage_image=MontageImageList(image_info,montage_info,image,
&image->exception);
montage_info=DestroyMontageInfo(montage_info);
if (montage_image == (Image *) NULL)
ThrowWriterException(CorruptImageError,image->exception.reason);
(void) CopyMagickString(montage_image->filename,image_info->filename,
MaxTextExtent);
write_info=CloneImageInfo(image_info);
(void) SetImageInfo(write_info,1,&image->exception);
if (LocaleCompare(write_info->magick,"VID") == 0)
(void) FormatMagickString(montage_image->filename,MaxTextExtent,
"miff:%s",write_info->filename);
status=WriteImage(write_info,montage_image);
montage_image=DestroyImage(montage_image);
write_info=DestroyImageInfo(write_info);
return(status);
}
示例4: function
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% W r i t e P R E V I E W I m a g e %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% WritePreviewImage creates several tiles each with a varying
% stength of an image enhancement function (e.g. gamma). The image is written
% in the MIFF format.
%
% The format of the WritePreviewImage method is:
%
% MagickBooleanType WritePreviewImage(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 WritePreviewImage(const ImageInfo *image_info,
Image *image,ExceptionInfo *exception)
{
Image
*preview_image;
ImageInfo
*write_info;
MagickBooleanType
status;
/*
Open output image file.
*/
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);
preview_image=PreviewImage(image,image_info->preview_type,exception);
if (preview_image == (Image *) NULL)
return(MagickFalse);
(void) CopyMagickString(preview_image->filename,image_info->filename,
MagickPathExtent);
write_info=CloneImageInfo(image_info);
*write_info->magick='\0';
(void) SetImageInfo(write_info,1,exception);
if (LocaleCompare(write_info->magick,"PREVIEW") == 0)
(void) FormatLocaleString(preview_image->filename,MagickPathExtent,
"miff:%s",image_info->filename);
status=WriteImage(write_info,preview_image,exception);
preview_image=DestroyImage(preview_image);
write_info=DestroyImageInfo(write_info);
return(status);
}
示例5: 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,MaxTextExtent);
exception=AcquireExceptionInfo();
(void) SetImageInfo(image_info,MagickTrue,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 '\\':
{
pattern+=GetUTFOctets(pattern);
if (GetUTFCode(pattern) != 0)
pattern+=GetUTFOctets(pattern);
break;
}
case '*':
{
MagickBooleanType
status;
status=MagickFalse;
pattern+=GetUTFOctets(pattern);
while ((GetUTFCode(expression) != 0) && (status == MagickFalse))
{
status=GlobExpression(expression,pattern,case_insensitive);
expression+=GetUTFOctets(expression);
//.........这里部分代码省略.........
示例6: WriteXTRNImage
static 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;
//.........这里部分代码省略.........
示例7: WriteImages
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% W r i t e I m a g e s %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% WriteImages() writes an image sequence.
%
% The format of the WriteImages method is:
%
% MagickBooleanType WriteImages(const ImageInfo *image_info,Image *images,
% const char *filename,ExceptionInfo *exception)
%
% A description of each parameter follows:
%
% o image_info: the image info.
%
% o images: the image list.
%
% o filename: the image filename.
%
% o exception: return any errors or warnings in this structure.
%
*/
MagickExport MagickBooleanType WriteImages(const ImageInfo *image_info,
Image *images,const char *filename,ExceptionInfo *exception)
{
BlobInfo
*blob;
ExceptionInfo
*sans_exception;
ImageInfo
*write_info;
MagickStatusType
status;
register Image
*p;
assert(image_info != (const ImageInfo *) NULL);
assert(image_info->signature == MagickSignature);
assert(images != (Image *) NULL);
assert(images->signature == MagickSignature);
if (images->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",images->filename);
assert(exception != (ExceptionInfo *) NULL);
write_info=CloneImageInfo(image_info);
images=GetFirstImageInList(images);
blob=CloneBlobInfo(images->blob); /* thread specific I/O handler */
DestroyBlob(images);
images->blob=blob;
if (filename != (const char *) NULL)
for (p=images; p != (Image *) NULL; p=GetNextImageInList(p))
(void) CopyMagickString(p->filename,filename,MaxTextExtent);
(void) CopyMagickString(write_info->filename,images->filename,MaxTextExtent);
if (*write_info->magick == '\0')
(void) CopyMagickString(write_info->magick,images->magick,MaxTextExtent);
sans_exception=AcquireExceptionInfo();
(void) SetImageInfo(write_info,MagickTrue,sans_exception);
sans_exception=DestroyExceptionInfo(sans_exception);
p=images;
for ( ; GetNextImageInList(p) != (Image *) NULL; p=GetNextImageInList(p))
if (p->scene >= GetNextImageInList(p)->scene)
{
register long
i;
/*
Generate consistent scene numbers.
*/
i=(long) images->scene;
for (p=images; p != (Image *) NULL; p=GetNextImageInList(p))
p->scene=(unsigned long) i++;
break;
}
/*
Write images.
*/
status=MagickTrue;
for (p=images; p != (Image *) NULL; p=GetNextImageInList(p))
{
status&=WriteImage(write_info,p);
GetImageException(p,exception);
if (write_info->adjoin != MagickFalse)
break;
}
write_info=DestroyImageInfo(write_info);
return(status != 0 ? MagickTrue : MagickFalse);
}
示例8: WriteXTRNImage
static MagickBooleanType WriteXTRNImage(const ImageInfo *image_info,Image *image)
{
Image *
p;
ImageInfo
*clone_info;
int
scene;
MagickBooleanType
status;
void
*param1,
*param2,
*param3;
param1 = param2 = param3 = (void *) NULL;
if (LocaleCompare(image_info->magick,"XTRNFILE") == 0)
{
clone_info=CloneImageInfo(image_info);
status=WriteImage(image_info,image);
if (status == MagickFalse)
CatchImageException(image);
clone_info=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,MagickFalse,&(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) CopyMagickString(clone_info->filename,filename,MaxTextExtent);
for (p=image; p != (Image *) NULL; p=GetNextImageInList(p))
{
(void) CopyMagickString(p->filename,filename,MaxTextExtent);
p->scene=scene++;
}
SetImageInfo(clone_info,MagickTrue,&image->exception);
(void) CopyMagickString(image->magick,clone_info->magick,
MaxTextExtent);
GetExceptionInfo(&exception);
if (*blob_length == 0)
*blob_length=8192;
*blob_data=(char *) ImageToBlob(clone_info,image,blob_length,
&exception);
if (*blob_data == NULL)
status=MagickFalse;
if (status == MagickFalse)
CatchImageException(image);
}
clone_info=DestroyImageInfo(clone_info);
}
else if (LocaleCompare(image_info->magick,"XTRNSTREAM") == 0)
{
size_t
(*fifo)(const Image *,const void *,const size_t);
//.........这里部分代码省略.........
示例9: 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(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.
%
*/
MagickExport Image *ReadImages(const ImageInfo *image_info,
ExceptionInfo *exception)
{
char
filename[MaxTextExtent];
Image
*image,
*images;
ImageInfo
*read_info;
/*
Read image list from a file.
*/
assert(image_info != (ImageInfo *) NULL);
assert(image_info->signature == MagickSignature);
if (image_info->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
image_info->filename);
assert(exception != (ExceptionInfo *) NULL);
(void) InterpretImageFilename(image_info,(Image *) NULL,image_info->filename,
(int) image_info->scene,filename,exception);
if (LocaleCompare(filename,image_info->filename) != 0)
{
ExceptionInfo
*sans;
ssize_t
extent,
scene;
/*
Images of the form image-%d.png[1-5].
*/
read_info=CloneImageInfo(image_info);
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(filename,read_info->filename,MaxTextExtent);
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,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);
}
return(ReadImage(image_info,exception));
}
示例10: 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')
//.........这里部分代码省略.........
示例11: WriteXTRNImage
static MagickBooleanType WriteXTRNImage(const ImageInfo *image_info,
Image *image,ExceptionInfo *exception)
{
Image *
p;
ImageInfo
*clone_info;
int
scene;
MagickBooleanType
status;
void
*param1,
*param2,
*param3;
param1 = param2 = param3 = (void *) NULL;
status=MagickTrue;
if (LocaleCompare(image_info->magick,"XTRNFILE") == 0)
{
clone_info=CloneImageInfo(image_info);
*clone_info->magick='\0';
status=WriteImage(clone_info,image,exception);
if (status == MagickFalse)
CatchImageException(image);
clone_info=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,MagickFalse,exception);
*image_info_ptr=clone_info;
}
}
}
else if (LocaleCompare(image_info->magick,"XTRNBLOB") == 0)
{
char
**blob_data;
size_t
*blob_length;
char
filename[MagickPathExtent];
clone_info=CloneImageInfo(image_info);
if (clone_info->filename[0])
{
(void) sscanf(clone_info->filename,"%lx,%lx,%2048s",
¶m1,¶m2,filename);
blob_data=(char **) param1;
blob_length=(size_t *) param2;
scene = 0;
(void) CopyMagickString(clone_info->filename,filename,
MagickPathExtent);
for (p=image; p != (Image *) NULL; p=GetNextImageInList(p))
{
(void) CopyMagickString(p->filename,filename,MagickPathExtent);
p->scene=scene++;
}
SetImageInfo(clone_info,1,exception);
(void) CopyMagickString(image->magick,clone_info->magick,
MagickPathExtent);
if (*blob_length == 0)
*blob_length=8192;
*blob_data=(char *) ImageToBlob(clone_info,image,blob_length,
exception);
if (*blob_data == NULL)
status=MagickFalse;
if (status == MagickFalse)
CatchImageException(image);
}
clone_info=DestroyImageInfo(clone_info);
}
else if (LocaleCompare(image_info->magick,"XTRNARRAY") == 0)
{
char
filename[MagickPathExtent];
size_t
//.........这里部分代码省略.........
示例12: SetImageInfoBlob
static Image *ReadURLImage(const ImageInfo *image_info,ExceptionInfo *exception)
{
#define MaxBufferExtent 8192
char
filename[MaxTextExtent];
FILE
*file;
Image
*image;
ImageInfo
*read_info;
int
unique_file;
image=(Image *) NULL;
read_info=CloneImageInfo(image_info);
SetImageInfoBlob(read_info,(void *) NULL,0);
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,MaxTextExtent);
(void) ConcatenateMagickString(filename,":",MaxTextExtent);
LocaleLower(filename);
(void) ConcatenateMagickString(filename,image_info->filename,MaxTextExtent);
if (LocaleCompare(read_info->magick,"file") == 0)
{
(void) RelinquishUniqueFileResource(read_info->filename);
unique_file=(-1);
(void) CopyMagickString(read_info->filename,image_info->filename+2,
MaxTextExtent);
}
#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);
xmlFree(type);
xmlNanoHTTPCleanup();
//.........这里部分代码省略.........
示例13: WriteHISTOGRAMImage
//.........这里部分代码省略.........
maximum=histogram[0].red;
for (x=0; x < (long) histogram_image->columns; x++)
{
if (((channel & RedChannel) != 0) && (maximum < histogram[x].red))
maximum=histogram[x].red;
if (((channel & GreenChannel) != 0) && (maximum < histogram[x].green))
maximum=histogram[x].green;
if (((channel & BlueChannel) != 0) && (maximum < histogram[x].blue))
maximum=histogram[x].blue;
}
scale=(MagickRealType) histogram_image->rows/maximum;
/*
Initialize histogram image.
*/
exception=(&image->exception);
(void) QueryColorDatabase("#000000",&histogram_image->background_color,
&image->exception);
(void) SetImageBackgroundColor(histogram_image);
for (x=0; x < (long) histogram_image->columns; x++)
{
q=GetAuthenticPixels(histogram_image,x,0,1,histogram_image->rows,exception);
if (q == (PixelPacket *) NULL)
break;
if ((channel & RedChannel) != 0)
{
y=(long) (histogram_image->rows-scale*histogram[x].red+0.5);
r=q+y;
for ( ; y < (long) histogram_image->rows; y++)
{
r->red=(Quantum) QuantumRange;
r++;
}
}
if ((channel & GreenChannel) != 0)
{
y=(long) (histogram_image->rows-scale*histogram[x].green+0.5);
r=q+y;
for ( ; y < (long) histogram_image->rows; y++)
{
r->green=(Quantum) QuantumRange;
r++;
}
}
if ((channel & BlueChannel) != 0)
{
y=(long) (histogram_image->rows-scale*histogram[x].blue+0.5);
r=q+y;
for ( ; y < (long) histogram_image->rows; y++)
{
r->blue=(Quantum) QuantumRange;
r++;
}
}
if (SyncAuthenticPixels(histogram_image,exception) == MagickFalse)
break;
status=SetImageProgress(image,SaveImageTag,y,histogram_image->rows);
if (status == MagickFalse)
break;
}
/*
Relinquish resources.
*/
histogram=(MagickPixelPacket *) RelinquishMagickMemory(histogram);
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;
/*
Add a histogram as an image comment.
*/
(void) GetNumberColors(image,file,&image->exception);
(void) fclose(file);
property=FileToString(filename,~0UL,&image->exception);
if (property != (char *) NULL)
{
(void) SetImageProperty(histogram_image,"comment",property);
property=DestroyString(property);
}
}
(void) RelinquishUniqueFileResource(filename);
/*
Write Histogram image.
*/
(void) CopyMagickString(histogram_image->filename,image_info->filename,
MaxTextExtent);
write_info=CloneImageInfo(image_info);
(void) SetImageInfo(write_info,MagickTrue,&image->exception);
if (LocaleCompare(write_info->magick,"HISTOGRAM") == 0)
(void) FormatMagickString(histogram_image->filename,MaxTextExtent,
"miff:%s",write_info->filename);
status=WriteImage(write_info,histogram_image);
histogram_image=DestroyImage(histogram_image);
write_info=DestroyImageInfo(write_info);
return(status);
}
示例14: WriteImages
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% W r i t e I m a g e s %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% WriteImages() writes an image sequence into one or more files. While
% WriteImage() can write an image sequence, it is limited to writing
% the sequence into a single file using a format which supports multiple
% frames. WriteImages(), however, does not have this limitation, instead it
% generates multiple output files if necessary (or when requested). When
% ImageInfo's adjoin flag is set to MagickFalse, the file name is expected
% to include a printf-style formatting string for the frame number (e.g.
% "image%02d.png").
%
% The format of the WriteImages method is:
%
% MagickBooleanType WriteImages(const ImageInfo *image_info,Image *images,
% const char *filename,ExceptionInfo *exception)
%
% A description of each parameter follows:
%
% o image_info: the image info.
%
% o images: the image list.
%
% o filename: the image filename.
%
% o exception: return any errors or warnings in this structure.
%
*/
MagickExport MagickBooleanType WriteImages(const ImageInfo *image_info,
Image *images,const char *filename,ExceptionInfo *exception)
{
#define WriteImageTag "Write/Image"
BlobInfo
*blob;
ExceptionInfo
*sans_exception;
ImageInfo
*write_info;
MagickBooleanType
proceed;
MagickOffsetType
i;
MagickProgressMonitor
progress_monitor;
MagickSizeType
number_images;
MagickStatusType
status;
register Image
*p;
assert(image_info != (const ImageInfo *) NULL);
assert(image_info->signature == MagickSignature);
assert(images != (Image *) NULL);
assert(images->signature == MagickSignature);
if (images->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",images->filename);
assert(exception != (ExceptionInfo *) NULL);
write_info=CloneImageInfo(image_info);
images=GetFirstImageInList(images);
blob=CloneBlobInfo(images->blob); /* thread specific I/O handler */
DestroyBlob(images);
images->blob=blob;
if (filename != (const char *) NULL)
for (p=images; p != (Image *) NULL; p=GetNextImageInList(p))
(void) CopyMagickString(p->filename,filename,MaxTextExtent);
(void) CopyMagickString(write_info->filename,images->filename,MaxTextExtent);
if (*write_info->magick == '\0')
(void) CopyMagickString(write_info->magick,images->magick,MaxTextExtent);
sans_exception=AcquireExceptionInfo();
(void) SetImageInfo(write_info,(unsigned int) GetImageListLength(images),
sans_exception);
sans_exception=DestroyExceptionInfo(sans_exception);
p=images;
for ( ; GetNextImageInList(p) != (Image *) NULL; p=GetNextImageInList(p))
if (p->scene >= GetNextImageInList(p)->scene)
{
register ssize_t
i;
/*
Generate consistent scene numbers.
*/
//.........这里部分代码省略.........
示例15: 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[MaxTextExtent],
magick[MaxTextExtent],
magick_filename[MaxTextExtent];
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,
thread_support;
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 == MagickSignature);
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,MaxTextExtent);
(void) SetImageInfo(read_info,0,exception);
(void) CopyMagickString(filename,read_info->filename,MaxTextExtent);
(void) CopyMagickString(magick,read_info->magick,MaxTextExtent);
domain=CoderPolicyDomain;
rights=ReadPolicyRights;
if (IsRightsAuthorized(domain,rights,read_info->magick) == MagickFalse)
{
errno=EPERM;
(void) ThrowMagickException(exception,GetMagickModule(),PolicyError,
"NotAuthorized","`%s'",read_info->filename);
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)
{
//.........这里部分代码省略.........