/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% M M GGGG K K %
% MM MM G K K %
% M M M G GG KKK %
% M M G G K K %
% M M GGG K K %
% %
% %
% Read/Write MGK Image Format. %
% %
% Software Design %
% John Cristy %
% July 1992 %
% %
% %
% Copyright 1999-2021 ImageMagick Studio LLC, a non-profit organization %
% dedicated to making software imaging solutions freely available. %
% %
% You may not use this file except in compliance with the License. You may %
% obtain a copy of the License at %
% %
% https://imagemagick.org/script/license.php %
% %
% Unless required by applicable law or agreed to in writing, software %
% distributed under the License is distributed on an "AS IS" BASIS, %
% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. %
% See the License for the specific language governing permissions and %
% limitations under the License. %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%
*/
/*
Include declarations.
*/
#include <MagickCore/studio.h>
#include <MagickCore/blob.h>
#include <MagickCore/cache.h>
#include <MagickCore/colorspace.h>
#include <MagickCore/exception.h>
#include <MagickCore/image.h>
#include <MagickCore/list.h>
#include <MagickCore/magick.h>
#include <MagickCore/memory_.h>
#include <MagickCore/monitor.h>
#include <MagickCore/pixel-accessor.h>
#include <MagickCore/string_.h>
#include <MagickCore/module.h>
/*
Forward declarations.
*/
static MagickBooleanType
WriteMGKImage(const ImageInfo *,Image *,ExceptionInfo *);
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% I s M G K %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% IsMGK() returns MagickTrue if the image format type, identified by the
% magick string, is MGK.
%
% The format of the IsMGK method is:
%
% MagickBooleanType IsMGK(const unsigned char *magick,const size_t length)
%
% A description of each parameter follows:
%
% o magick: This string is generally the first few bytes of an image file
% or blob.
%
% o length: Specifies the length of the magick string.
%
*/
static MagickBooleanType IsMGK(const unsigned char *magick,const size_t length)
{
if (length < 7)
return(MagickFalse);
if (LocaleNCompare((char *) magick,"id=mgk",7) == 0)
return(MagickTrue);
return(MagickFalse);
}
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% R e a d M G K I m a g e %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% ReadMGKImage() reads a MGK 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 ReadMGKImage method is:
%
% Image *ReadMGKImage(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 *ReadMGKImage(const ImageInfo *image_info,ExceptionInfo *exception)
{
char
buffer[MaxTextExtent];
Image
*image;
long
y;
MagickBooleanType
status;
register long
x;
register Quantum
*q;
register unsigned char
*p;
ssize_t
count;
unsigned char
*pixels;
unsigned long
columns,
rows;
/*
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);
image=AcquireImage(image_info,exception);
status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
if (status == MagickFalse)
{
image=DestroyImageList(image);
return((Image *) NULL);
}
/*
Read MGK image.
*/
(void) ReadBlobString(image,buffer); /* read magic number */
if (IsMGK(buffer,7) == MagickFalse)
ThrowReaderException(CorruptImageError,"ImproperImageHeader");
(void) ReadBlobString(image,buffer);
count=(ssize_t) sscanf(buffer,"%lu %lu\n",&columns,&rows);
if (count <= 0)
ThrowReaderException(CorruptImageError,"ImproperImageHeader");
do
{
/*
Initialize image structure.
*/
image->columns=columns;
image->rows=rows;
image->depth=8;
if ((image_info->ping != MagickFalse) && (image_info->number_scenes != 0))
if (image->scene >= (image_info->scene+image_info->number_scenes-1))
break;
/*
Convert MGK raster image to pixel packets.
*/
if (SetImageExtent(image,image->columns,image->rows,exception) == MagickFalse)
return(DestroyImageList(image));
pixels=(unsigned char *) AcquireQuantumMemory((size_t) image->columns,
3UL*sizeof(*pixels));
if (pixels == (unsigned char *) NULL)
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
for (y=0; y < (ssize_t) image->rows; y++)
{
count=(ssize_t) ReadBlob(image,(size_t) (3*image->columns),pixels);
if (count != (ssize_t) (3*image->columns))
没有合适的资源?快使用搜索试试~ 我知道了~
Linux系统的imagemagick 7.1.0,支持exr格式转换
共542个文件
html:156个
h:137个
png:91个
需积分: 39 4 下载量 35 浏览量
2022-09-13
14:47:23
上传
评论
收藏 39.18MB ZIP 举报
温馨提示
ImageMagick是一个免费的创建、编辑、合成图片的软件。它可以读取、转换、写入多种格式的图片。图片切割、颜色替换、各种效果的应用,图片的旋转、组合,文本,直线,多边形,椭圆,曲线,附加到图片伸展旋转。ImageMagick是免费软件:全部源码开放,可以自由使用,复制,修改,发布。它遵守GPL许可协议。它可以运行于大多数的操作系统。ImageMagick的大多数功能的使用都来源于命令行工具。 由本人手动编译,添加了exr格式的支持。
资源详情
资源评论
资源推荐
收起资源包目录
Linux系统的imagemagick 7.1.0,支持exr格式转换 (542个子文件)
libMagickCore-7.Q16HDRI.so.10.0.0 16.99MB
libMagickWand-7.Q16HDRI.so.10.0.0 3.69MB
libMagick++-7.Q16HDRI.so.5.0.0 1.07MB
convert.1 19KB
mogrify.1 18KB
magick.1 15KB
magick-script.1 15KB
montage.1 8KB
display.1 8KB
ImageMagick.1 6KB
composite.1 6KB
compare.1 6KB
import.1 5KB
animate.1 5KB
identify.1 5KB
stream.1 3KB
Magick++-config.1 3KB
MagickCore-config.1 2KB
conjure.1 2KB
MagickWand-config.1 2KB
libMagickCore-7.Q16HDRI.so.10 16.99MB
libMagickWand-7.Q16HDRI.so.10 3.69MB
libMagick++-7.Q16HDRI.so.5 1.07MB
libMagickCore-7.Q16HDRI.a 35.1MB
libMagickWand-7.Q16HDRI.a 7.5MB
libMagick++-7.Q16HDRI.a 1.51MB
animate 34KB
mgk.c 16KB
analyze.c 10KB
contrast.c 3KB
core.c 2KB
wand.c 1KB
compare 34KB
composite 34KB
conjure 34KB
convert 34KB
magick.css 153KB
magick.css 11KB
display 34KB
logo.eps 597KB
Image.fig 4KB
thumbnail-anatomy-framed.fig 1KB
Cache.fig 1KB
thumbnail-anatomy-plain.fig 1KB
color-thresholding-gray.gif 7KB
color-thresholding-hsv-rgb.gif 3KB
color-thresholding-hsv.gif 3KB
color-thresholding.gif 3KB
color-thresholding-rgb.gif 3KB
button.gif 2KB
label.gif 1KB
smile.gif 1KB
atop.gif 1KB
objects.gif 1013B
over.gif 771B
right.gif 82B
methods.h 80KB
STL.h 70KB
Drawable.h 67KB
Image.h 63KB
Include.h 55KB
magick-baseconfig.h 46KB
pixel-accessor.h 29KB
magick-image.h 20KB
image.h 14KB
Exception.h 12KB
Color.h 12KB
drawing-wand.h 10KB
studio.h 9KB
magick-config.h 9KB
static.h 9KB
nt-base.h 8KB
pixel.h 7KB
Statistic.h 7KB
Geometry.h 7KB
option.h 6KB
draw.h 6KB
magick-type.h 6KB
magick-property.h 5KB
quantum.h 5KB
MagickCore.h 5KB
pixel-wand.h 5KB
morphology.h 4KB
statistic.h 4KB
exception.h 4KB
magick.h 4KB
geometry.h 4KB
method-attribute.h 4KB
Pixels.h 4KB
Montage.h 4KB
MagickWand.h 4KB
string_.h 4KB
cache-view.h 4KB
method-attribute.h 4KB
blob.h 3KB
memory_.h 3KB
version.h 3KB
effect.h 3KB
composite.h 3KB
log.h 3KB
共 542 条
- 1
- 2
- 3
- 4
- 5
- 6
vincentmmc
- 粉丝: 0
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0