This source file includes following definitions.
- ReadDNGImage
- RegisterDNGImage
- UnregisterDNGImage
#include "magick/studio.h"
#include "magick/blob.h"
#include "magick/blob-private.h"
#include "magick/constitute.h"
#include "magick/delegate.h"
#include "magick/exception.h"
#include "magick/exception-private.h"
#include "magick/geometry.h"
#include "magick/image.h"
#include "magick/image-private.h"
#include "magick/layer.h"
#include "magick/list.h"
#include "magick/log.h"
#include "magick/magick.h"
#include "magick/memory_.h"
#include "magick/pixel-accessor.h"
#include "magick/quantum-private.h"
#include "magick/resource_.h"
#include "magick/static.h"
#include "magick/string_.h"
#include "magick/module.h"
#include "magick/transform.h"
#include "magick/utility.h"
#include "magick/xml-tree.h"
static Image *ReadDNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
{
ExceptionInfo
*sans_exception;
Image
*image;
ImageInfo
*read_info;
MagickBooleanType
status;
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);
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);
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;
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);
}
ModuleExport size_t RegisterDNGImage(void)
{
MagickInfo
*entry;
entry=SetMagickInfo("3FR");
entry->decoder=(DecodeImageHandler *) ReadDNGImage;
entry->blob_support=MagickFalse;
entry->seekable_stream=MagickTrue;
entry->format_type=ExplicitFormatType;
entry->description=ConstantString("Hasselblad CFV/H3D39II");
entry->module=ConstantString("DNG");
(void) RegisterMagickInfo(entry);
entry=SetMagickInfo("ARW");
entry->decoder=(DecodeImageHandler *) ReadDNGImage;
entry->blob_support=MagickFalse;
entry->seekable_stream=MagickTrue;
entry->format_type=ExplicitFormatType;
entry->description=ConstantString("Sony Alpha Raw Image Format");
entry->module=ConstantString("DNG");
(void) RegisterMagickInfo(entry);
entry=SetMagickInfo("DNG");
entry->decoder=(DecodeImageHandler *) ReadDNGImage;
entry->blob_support=MagickFalse;
entry->seekable_stream=MagickTrue;
entry->format_type=ExplicitFormatType;
entry->description=ConstantString("Digital Negative");
entry->module=ConstantString("DNG");
(void) RegisterMagickInfo(entry);
entry=SetMagickInfo("CR2");
entry->decoder=(DecodeImageHandler *) ReadDNGImage;
entry->blob_support=MagickFalse;
entry->seekable_stream=MagickTrue;
entry->format_type=ExplicitFormatType;
entry->description=ConstantString("Canon Digital Camera Raw Image Format");
entry->module=ConstantString("DNG");
(void) RegisterMagickInfo(entry);
entry=SetMagickInfo("CRW");
entry->decoder=(DecodeImageHandler *) ReadDNGImage;
entry->blob_support=MagickFalse;
entry->seekable_stream=MagickTrue;
entry->format_type=ExplicitFormatType;
entry->description=ConstantString("Canon Digital Camera Raw Image Format");
entry->module=ConstantString("DNG");
(void) RegisterMagickInfo(entry);
entry=SetMagickInfo("DCR");
entry->decoder=(DecodeImageHandler *) ReadDNGImage;
entry->blob_support=MagickFalse;
entry->seekable_stream=MagickTrue;
entry->format_type=ExplicitFormatType;
entry->description=ConstantString("Kodak Digital Camera Raw Image File");
entry->module=ConstantString("DNG");
(void) RegisterMagickInfo(entry);
entry=SetMagickInfo("ERF");
entry->decoder=(DecodeImageHandler *) ReadDNGImage;
entry->blob_support=MagickFalse;
entry->seekable_stream=MagickTrue;
entry->format_type=ExplicitFormatType;
entry->description=ConstantString("Epson Raw Format");
entry->module=ConstantString("DNG");
(void) RegisterMagickInfo(entry);
entry=SetMagickInfo("IIQ");
entry->decoder=(DecodeImageHandler *) ReadDNGImage;
entry->blob_support=MagickFalse;
entry->seekable_stream=MagickTrue;
entry->format_type=ExplicitFormatType;
entry->description=ConstantString("Phase One Raw Image Format");
entry->module=ConstantString("DNG");
(void) RegisterMagickInfo(entry);
entry=SetMagickInfo("KDC");
entry->decoder=(DecodeImageHandler *) ReadDNGImage;
entry->blob_support=MagickFalse;
entry->seekable_stream=MagickTrue;
entry->format_type=ExplicitFormatType;
entry->description=ConstantString("Kodak Digital Camera Raw Image Format");
entry->module=ConstantString("DNG");
(void) RegisterMagickInfo(entry);
entry=SetMagickInfo("K25");
entry->decoder=(DecodeImageHandler *) ReadDNGImage;
entry->blob_support=MagickFalse;
entry->seekable_stream=MagickTrue;
entry->format_type=ExplicitFormatType;
entry->description=ConstantString("Kodak Digital Camera Raw Image Format");
entry->module=ConstantString("DNG");
(void) RegisterMagickInfo(entry);
entry=SetMagickInfo("MEF");
entry->decoder=(DecodeImageHandler *) ReadDNGImage;
entry->blob_support=MagickFalse;
entry->seekable_stream=MagickTrue;
entry->format_type=ExplicitFormatType;
entry->description=ConstantString("Mamiya Raw Image File");
entry->module=ConstantString("DNG");
(void) RegisterMagickInfo(entry);
entry=SetMagickInfo("MRW");
entry->decoder=(DecodeImageHandler *) ReadDNGImage;
entry->blob_support=MagickFalse;
entry->seekable_stream=MagickTrue;
entry->format_type=ExplicitFormatType;
entry->description=ConstantString("Sony (Minolta) Raw Image File");
entry->module=ConstantString("DNG");
(void) RegisterMagickInfo(entry);
entry=SetMagickInfo("NEF");
entry->decoder=(DecodeImageHandler *) ReadDNGImage;
entry->blob_support=MagickFalse;
entry->seekable_stream=MagickTrue;
entry->format_type=ExplicitFormatType;
entry->description=ConstantString("Nikon Digital SLR Camera Raw Image File");
entry->module=ConstantString("DNG");
(void) RegisterMagickInfo(entry);
entry=SetMagickInfo("NRW");
entry->decoder=(DecodeImageHandler *) ReadDNGImage;
entry->blob_support=MagickFalse;
entry->seekable_stream=MagickTrue;
entry->format_type=ExplicitFormatType;
entry->description=ConstantString("Nikon Digital SLR Camera Raw Image File");
entry->module=ConstantString("DNG");
(void) RegisterMagickInfo(entry);
entry=SetMagickInfo("ORF");
entry->decoder=(DecodeImageHandler *) ReadDNGImage;
entry->blob_support=MagickFalse;
entry->seekable_stream=MagickTrue;
entry->format_type=ExplicitFormatType;
entry->description=ConstantString("Olympus Digital Camera Raw Image File");
entry->module=ConstantString("DNG");
(void) RegisterMagickInfo(entry);
entry=SetMagickInfo("PEF");
entry->decoder=(DecodeImageHandler *) ReadDNGImage;
entry->blob_support=MagickFalse;
entry->seekable_stream=MagickTrue;
entry->format_type=ExplicitFormatType;
entry->description=ConstantString("Pentax Electronic File");
entry->module=ConstantString("DNG");
(void) RegisterMagickInfo(entry);
entry=SetMagickInfo("RAF");
entry->decoder=(DecodeImageHandler *) ReadDNGImage;
entry->blob_support=MagickFalse;
entry->seekable_stream=MagickTrue;
entry->format_type=ExplicitFormatType;
entry->description=ConstantString("Fuji CCD-RAW Graphic File");
entry->module=ConstantString("DNG");
(void) RegisterMagickInfo(entry);
entry=SetMagickInfo("RAW");
entry->decoder=(DecodeImageHandler *) ReadDNGImage;
entry->blob_support=MagickFalse;
entry->seekable_stream=MagickTrue;
entry->format_type=ExplicitFormatType;
entry->description=ConstantString("Raw");
entry->module=ConstantString("DNG");
(void) RegisterMagickInfo(entry);
entry=SetMagickInfo("RMF");
entry->decoder=(DecodeImageHandler *) ReadDNGImage;
entry->blob_support=MagickFalse;
entry->seekable_stream=MagickTrue;
entry->format_type=ExplicitFormatType;
entry->description=ConstantString("Raw Media Format");
entry->module=ConstantString("DNG");
(void) RegisterMagickInfo(entry);
entry=SetMagickInfo("RW2");
entry->decoder=(DecodeImageHandler *) ReadDNGImage;
entry->blob_support=MagickFalse;
entry->seekable_stream=MagickTrue;
entry->format_type=ExplicitFormatType;
entry->description=ConstantString("Panasonic Lumix Raw Image");
entry->module=ConstantString("DNG");
(void) RegisterMagickInfo(entry);
entry=SetMagickInfo("SRF");
entry->decoder=(DecodeImageHandler *) ReadDNGImage;
entry->blob_support=MagickFalse;
entry->seekable_stream=MagickTrue;
entry->format_type=ExplicitFormatType;
entry->description=ConstantString("Sony Raw Format");
entry->module=ConstantString("DNG");
(void) RegisterMagickInfo(entry);
entry=SetMagickInfo("SR2");
entry->decoder=(DecodeImageHandler *) ReadDNGImage;
entry->blob_support=MagickFalse;
entry->seekable_stream=MagickTrue;
entry->format_type=ExplicitFormatType;
entry->description=ConstantString("Sony Raw Format 2");
entry->module=ConstantString("DNG");
(void) RegisterMagickInfo(entry);
entry=SetMagickInfo("X3F");
entry->decoder=(DecodeImageHandler *) ReadDNGImage;
entry->blob_support=MagickFalse;
entry->seekable_stream=MagickTrue;
entry->format_type=ExplicitFormatType;
entry->description=ConstantString("Sigma Camera RAW Picture File");
entry->module=ConstantString("DNG");
(void) RegisterMagickInfo(entry);
return(MagickImageCoderSignature);
}
ModuleExport void UnregisterDNGImage(void)
{
(void) UnregisterMagickInfo("X3F");
(void) UnregisterMagickInfo("SR2");
(void) UnregisterMagickInfo("SRF");
(void) UnregisterMagickInfo("RW2");
(void) UnregisterMagickInfo("RMF");
(void) UnregisterMagickInfo("RAW");
(void) UnregisterMagickInfo("RAF");
(void) UnregisterMagickInfo("PEF");
(void) UnregisterMagickInfo("ORF");
(void) UnregisterMagickInfo("NRW");
(void) UnregisterMagickInfo("NEF");
(void) UnregisterMagickInfo("MRW");
(void) UnregisterMagickInfo("MEF");
(void) UnregisterMagickInfo("K25");
(void) UnregisterMagickInfo("KDC");
(void) UnregisterMagickInfo("IIQ");
(void) UnregisterMagickInfo("ERF");
(void) UnregisterMagickInfo("DCR");
(void) UnregisterMagickInfo("CRW");
(void) UnregisterMagickInfo("CR2");
(void) UnregisterMagickInfo("DNG");
(void) UnregisterMagickInfo("ARW");
(void) UnregisterMagickInfo("3FR");
}