]> granicus.if.org Git - imagemagick/blob - coders/dng.c
https://github.com/ImageMagick/ImageMagick/issues/888
[imagemagick] / coders / dng.c
1 /*
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %                                                                             %
4 %                                                                             %
5 %                                                                             %
6 %                            DDDD   N   N   GGGG                              %
7 %                            D   D  NN  N  GS                                 %
8 %                            D   D  N N N  G  GG                              %
9 %                            D   D  N  NN  G   G                              %
10 %                            DDDD   N   N   GGGG                              %
11 %                                                                             %
12 %                                                                             %
13 %                  Read the Digital Negative Image Format                     %
14 %                                                                             %
15 %                              Software Design                                %
16 %                                   Cristy                                    %
17 %                                 July 1999                                   %
18 %                                                                             %
19 %                                                                             %
20 %  Copyright 1999-2017 ImageMagick Studio LLC, a non-profit organization      %
21 %  dedicated to making software imaging solutions freely available.           %
22 %                                                                             %
23 %  You may not use this file except in compliance with the License.  You may  %
24 %  obtain a copy of the License at                                            %
25 %                                                                             %
26 %    https://www.imagemagick.org/script/license.php                           %
27 %                                                                             %
28 %  Unless required by applicable law or agreed to in writing, software        %
29 %  distributed under the License is distributed on an "AS IS" BASIS,          %
30 %  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   %
31 %  See the License for the specific language governing permissions and        %
32 %  limitations under the License.                                             %
33 %                                                                             %
34 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
35 %
36 %
37 */
38 /*
39   Include declarations.
40 */
41 #include "MagickCore/studio.h"
42 #include "MagickCore/blob.h"
43 #include "MagickCore/blob-private.h"
44 #include "MagickCore/constitute.h"
45 #include "MagickCore/delegate.h"
46 #include "MagickCore/exception.h"
47 #include "MagickCore/exception-private.h"
48 #include "MagickCore/geometry.h"
49 #include "MagickCore/image.h"
50 #include "MagickCore/image-private.h"
51 #include "MagickCore/layer.h"
52 #include "MagickCore/list.h"
53 #include "MagickCore/log.h"
54 #include "MagickCore/magick.h"
55 #include "MagickCore/memory_.h"
56 #include "MagickCore/monitor.h"
57 #include "MagickCore/monitor-private.h"
58 #include "MagickCore/opencl.h"
59 #include "MagickCore/pixel-accessor.h"
60 #include "MagickCore/profile.h"
61 #include "MagickCore/property.h"
62 #include "MagickCore/quantum-private.h"
63 #include "MagickCore/resource_.h"
64 #include "MagickCore/static.h"
65 #include "MagickCore/string_.h"
66 #include "MagickCore/module.h"
67 #include "MagickCore/transform.h"
68 #include "MagickCore/utility.h"
69 #include "MagickCore/xml-tree.h"
70 #include "MagickCore/xml-tree-private.h"
71 #if defined(MAGICKCORE_RAW_R_DELEGATE)
72 #include <libraw.h>
73 #endif
74 \f
75 /*
76 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
77 %                                                                             %
78 %                                                                             %
79 %                                                                             %
80 %   R e a d D N G I m a g e                                                   %
81 %                                                                             %
82 %                                                                             %
83 %                                                                             %
84 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
85 %
86 %  ReadDNGImage() reads an binary file in the Digital Negative format and
87 %  returns it.  It allocates the memory necessary for the new Image structure
88 %  and returns a pointer to the new image.
89 %
90 %  The format of the ReadDNGImage method is:
91 %
92 %      Image *ReadDNGImage(const ImageInfo *image_info,
93 %        ExceptionInfo *exception)
94 %
95 %  A description of each parameter follows:
96 %
97 %    o image_info: the image info.
98 %
99 %    o exception: return any errors or warnings in this structure.
100 %
101 */
102
103 #if defined(MAGICKCORE_WINDOWS_SUPPORT) && defined(MAGICKCORE_OPENCL_SUPPORT)
104 static void InitializeDcrawOpenCL(ExceptionInfo *exception)
105 {
106   MagickBooleanType
107     opencl_disabled;
108
109   MagickCLDevice
110     *devices;
111
112   size_t
113     length;
114
115   ssize_t
116     i;
117
118   (void) SetEnvironmentVariable("DCR_CL_PLATFORM",NULL);
119   (void) SetEnvironmentVariable("DCR_CL_DEVICE",NULL);
120   (void) SetEnvironmentVariable("DCR_CL_DISABLED",NULL);
121   if (GetOpenCLEnabled() == MagickFalse)
122     {
123       (void) SetEnvironmentVariable("DCR_CL_DISABLED","1");
124       return;
125     }
126   devices=GetOpenCLDevices(&length,exception);
127   if (devices == (MagickCLDevice *) NULL)
128     return;
129   for (i=0; i < (ssize_t) length; i++)
130   {
131     const char
132       *name;
133
134     MagickCLDevice
135       device;
136
137     device=devices[i];
138     if (GetOpenCLDeviceEnabled(device) == MagickFalse)
139       continue;
140     name=GetOpenCLDeviceVendorName(device);
141     if (name != (const char *) NULL)
142       (void) SetEnvironmentVariable("DCR_CL_PLATFORM",name);
143     name=GetOpenCLDeviceName(device);
144     if (name != (const char *) NULL)
145       (void) SetEnvironmentVariable("DCR_CL_DEVICE",name);
146     return;
147   }
148 }
149 #else
150 #if !defined(MAGICKCORE_RAW_R_DELEGATE)
151 static void InitializeDcrawOpenCL(ExceptionInfo *magick_unused(exception))
152 {
153   magick_unreferenced(exception);
154 #if defined(MAGICKCORE_WINDOWS_SUPPORT)
155   (void) SetEnvironmentVariable("DCR_CL_DISABLED","1");
156 #endif
157 }
158 #endif
159 #endif
160
161 #if defined(MAGICKCORE_RAW_R_DELEGATE)
162 static void SetDNGProperties(Image *image,const libraw_data_t *raw_info,
163   ExceptionInfo *exception)
164 {
165   char
166     property[MagickPathExtent],
167     timestamp[MagickPathExtent];
168
169   (void) SetImageProperty(image,"dng:make",raw_info->idata.make,exception);
170   (void) SetImageProperty(image,"dng:camera.model.name",raw_info->idata.model,
171     exception);
172   (void) FormatMagickTime(raw_info->other.timestamp,MagickPathExtent,timestamp);
173   (void) SetImageProperty(image,"dng:create.date",timestamp,exception);
174 #if LIBRAW_COMPILE_CHECK_VERSION_NOTLESS(0,18)
175   (void) SetImageProperty(image,"dng:software",raw_info->idata.software,
176     exception);
177   if (*raw_info->shootinginfo.BodySerial != '\0')
178     (void) SetImageProperty(image,"dng:serial.number",
179       raw_info->shootinginfo.BodySerial,exception);
180   (void) FormatLocaleString(property,MagickPathExtent,"%0.2f",
181     raw_info->other.FlashEC);
182   (void) SetImageProperty(image,"dng:flash.exposure.compensation",property,
183     exception);
184   (void) FormatLocaleString(property,MagickPathExtent,"1/%0.1f",
185     1.0/raw_info->other.shutter);
186   (void) SetImageProperty(image,"dng:exposure.time",property,exception);
187   (void) FormatLocaleString(property,MagickPathExtent,"%0.1f",
188     raw_info->other.aperture);
189   (void) SetImageProperty(image,"dng:f.number",property,exception);
190   (void) FormatLocaleString(property,MagickPathExtent,"%0.1f",
191     raw_info->other.iso_speed);
192   (void) SetImageProperty(image,"dng:iso.setting",property,exception);
193   (void) FormatLocaleString(property,MagickPathExtent,"%0.1f",
194     raw_info->lens.EXIF_MaxAp);
195   (void) SetImageProperty(image,"dng:max.aperture.value",property,exception);
196   (void) FormatLocaleString(property,MagickPathExtent,"%0.1f",
197     raw_info->other.focal_len);
198   (void) SetImageProperty(image,"dng:focal.length",property,exception);
199   (void) FormatLocaleString(property,MagickPathExtent,"%f %f %f %f",
200     raw_info->color.cam_mul[0],raw_info->color.cam_mul[2],
201     raw_info->color.cam_mul[1],raw_info->color.cam_mul[3]);
202   (void) SetImageProperty(image,"dng:wb.rb.levels",property,exception);
203   (void) SetImageProperty(image,"dng:lens.type",
204     raw_info->lens.makernotes.LensFeatures_suf,exception);
205   (void) FormatLocaleString(property,MagickPathExtent,
206     "%0.1f-%0.1fmm f/%0.1f-%0.1f",raw_info->lens.makernotes.MinFocal,
207     raw_info->lens.makernotes.MaxFocal,
208     raw_info->lens.makernotes.MaxAp4MinFocal,
209     raw_info->lens.makernotes.MaxAp4MaxFocal);
210   (void) SetImageProperty(image,"dng:lens",property,exception);
211   (void) FormatLocaleString(property,MagickPathExtent,"%0.2f",
212     raw_info->lens.makernotes.LensFStops);
213   (void) SetImageProperty(image,"dng:lens.f.stops",property,exception);
214   (void) FormatLocaleString(property,MagickPathExtent,"%0.1f mm",
215     raw_info->lens.makernotes.MinFocal);
216   (void) SetImageProperty(image,"dng:min.focal.length",property,exception);
217   (void) FormatLocaleString(property,MagickPathExtent,"%0.1f mm",
218     raw_info->lens.makernotes.MaxFocal);
219   (void) SetImageProperty(image,"dng:max.focal.length",property,exception);
220   (void) FormatLocaleString(property,MagickPathExtent,"%0.1f",
221     raw_info->lens.makernotes.MaxAp4MinFocal);
222   (void) SetImageProperty(image,"dng:max.aperture.at.min.focal",property,
223     exception);
224   (void) FormatLocaleString(property,MagickPathExtent,"%0.1f",
225     raw_info->lens.makernotes.MaxAp4MaxFocal);
226   (void) SetImageProperty(image,"dng:max.aperture.at.max.focal",property,
227     exception);
228   (void) FormatLocaleString(property,MagickPathExtent,"%d mm",
229     raw_info->lens.FocalLengthIn35mmFormat);
230   (void) SetImageProperty(image,"dng:focal.length.in.35mm.format",property,
231     exception);
232 #endif
233 }
234 #endif
235
236 static Image *ReadDNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
237 {
238   Image
239     *image;
240
241   MagickBooleanType
242     status;
243
244   /*
245     Open image file.
246   */
247   assert(image_info != (const ImageInfo *) NULL);
248   assert(image_info->signature == MagickCoreSignature);
249   if (image_info->debug != MagickFalse)
250     (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
251       image_info->filename);
252   assert(exception != (ExceptionInfo *) NULL);
253   assert(exception->signature == MagickCoreSignature);
254   image=AcquireImage(image_info,exception);
255   status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
256   if (status == MagickFalse)
257     {
258       image=DestroyImageList(image);
259       return((Image *) NULL);
260     }
261   (void) CloseBlob(image);
262 #if defined(MAGICKCORE_RAW_R_DELEGATE)
263   {
264     int
265       errcode;
266
267     libraw_data_t
268       *raw_info;
269
270     libraw_processed_image_t
271       *raw_image;
272
273     register ssize_t
274       y;
275
276     StringInfo
277       *profile;
278
279     unsigned short
280       *p;
281
282     errcode=0;
283     raw_info=libraw_init(0);
284     if (raw_info == (libraw_data_t *) NULL)
285       {
286         (void) ThrowMagickException(exception,GetMagickModule(),CoderError,
287           libraw_strerror(errcode),"`%s'",image->filename);
288         return(DestroyImageList(image));
289       }
290 #if defined(MAGICKCORE_WINDOWS_SUPPORT) && defined(_MSC_VER) && (_MSC_VER > 1310)
291     {
292       wchar_t
293         fileName[MagickPathExtent];
294
295       MultiByteToWideChar(CP_UTF8,0,image->filename,-1,fileName,
296         MagickPathExtent);
297       errcode=libraw_open_wfile(raw_info,fileName);
298     }
299 #else
300     errcode=libraw_open_file(raw_info,image->filename);
301 #endif
302     if (errcode != LIBRAW_SUCCESS)
303       {
304         (void) ThrowMagickException(exception,GetMagickModule(),CoderError,
305           libraw_strerror(errcode),"`%s'",image->filename);
306         return(DestroyImageList(image));
307       }
308     errcode=libraw_unpack(raw_info);
309     if (errcode != LIBRAW_SUCCESS)
310       {
311         (void) ThrowMagickException(exception,GetMagickModule(),CoderError,
312           libraw_strerror(errcode),"`%s'",image->filename);
313         libraw_close(raw_info);
314         return(DestroyImageList(image));
315       }
316     raw_info->params.output_bps=16;
317     errcode=libraw_dcraw_process(raw_info);
318     if (errcode != LIBRAW_SUCCESS)
319       {
320         (void) ThrowMagickException(exception,GetMagickModule(),CoderError,
321           libraw_strerror(errcode),"`%s'",image->filename);
322         libraw_close(raw_info);
323         return(DestroyImageList(image));
324       }
325     raw_image=libraw_dcraw_make_mem_image(raw_info,&errcode);
326     if ((errcode != LIBRAW_SUCCESS) ||
327         (raw_image == (libraw_processed_image_t *) NULL) ||
328         (raw_image->type != LIBRAW_IMAGE_BITMAP) || (raw_image->bits != 16) ||
329         (raw_image->colors < 3) || (raw_image->colors > 4))
330       {
331         if (raw_image != (libraw_processed_image_t *) NULL)
332           libraw_dcraw_clear_mem(raw_image);
333         (void) ThrowMagickException(exception,GetMagickModule(),CoderError,
334           libraw_strerror(errcode),"`%s'",image->filename);
335         libraw_close(raw_info);
336         return(DestroyImageList(image));
337       }
338     image->columns=raw_image->width;
339     image->rows=raw_image->height;
340     image->depth=raw_image->bits;
341     image->page.width=raw_info->sizes.width;
342     image->page.height=raw_info->sizes.height;
343     image->page.x=raw_info->sizes.left_margin;
344     image->page.y=raw_info->sizes.top_margin;
345     status=SetImageExtent(image,image->columns,image->rows,exception);
346     if (status == MagickFalse)
347       {
348         libraw_dcraw_clear_mem(raw_image);
349         libraw_close(raw_info);
350         return(DestroyImageList(image));
351       }
352     if (image_info->ping != MagickFalse)
353       {
354         libraw_dcraw_clear_mem(raw_image);
355         libraw_close(raw_info);
356         return(image);
357       }
358     p=(unsigned short *) raw_image->data;
359     for (y=0; y < (ssize_t) image->rows; y++)
360     {
361       register Quantum
362         *q;
363
364       register ssize_t
365         x;
366
367       q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
368       if (q == (Quantum *) NULL)
369         break;
370       for (x=0; x < (ssize_t) image->columns; x++)
371       {
372         SetPixelRed(image,ScaleShortToQuantum(*p++),q);
373         SetPixelGreen(image,ScaleShortToQuantum(*p++),q);
374         SetPixelBlue(image,ScaleShortToQuantum(*p++),q);
375         if (raw_image->colors > 3)
376           SetPixelAlpha(image,ScaleShortToQuantum(*p++),q);
377         q+=GetPixelChannels(image);
378       }
379       if (SyncAuthenticPixels(image,exception) == MagickFalse)
380         break;
381       if (image->previous == (Image *) NULL)
382         {
383           status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,
384             image->rows);
385           if (status == MagickFalse)
386             break;
387         }
388     }
389     libraw_dcraw_clear_mem(raw_image);
390     /*
391       Set DNG image metadata.
392     */
393     if (raw_info->color.profile)
394       {
395         profile=BlobToStringInfo(raw_info->color.profile,
396           raw_info->color.profile_length);
397         if (profile != (StringInfo *) NULL)
398           {
399             SetImageProfile(image,"ICC",profile,exception);
400             profile=DestroyStringInfo(profile);
401           }
402       }
403     if (raw_info->idata.xmpdata)
404       {
405         profile=BlobToStringInfo(raw_info->idata.xmpdata,
406           raw_info->idata.xmplen);
407         if (profile != (StringInfo *) NULL)
408           {
409             SetImageProfile(image,"XMP",profile,exception);
410             profile=DestroyStringInfo(profile);
411           }
412       }
413     SetDNGProperties(image,raw_info,exception);
414     libraw_close(raw_info);
415     return(image);
416   }
417 #else
418   {
419     ExceptionInfo
420       *sans_exception;
421
422     ImageInfo
423       *read_info;
424
425     /*
426       Convert DNG to PPM with delegate.
427     */
428     (void) DestroyImageList(image);
429     InitializeDcrawOpenCL(exception);
430     image=AcquireImage(image_info,exception);
431     read_info=CloneImageInfo(image_info);
432     SetImageInfoBlob(read_info,(void *) NULL,0);
433     (void) InvokeDelegate(read_info,image,"dng:decode",(char *) NULL,exception);
434     image=DestroyImage(image);
435     (void) FormatLocaleString(read_info->filename,MagickPathExtent,"%s.png",
436       read_info->unique);
437     sans_exception=AcquireExceptionInfo();
438     image=ReadImage(read_info,sans_exception);
439     sans_exception=DestroyExceptionInfo(sans_exception);
440     if (image == (Image *) NULL)
441       {
442         (void) FormatLocaleString(read_info->filename,MagickPathExtent,"%s.ppm",
443           read_info->unique);
444         image=ReadImage(read_info,exception);
445       }
446     (void) RelinquishUniqueFileResource(read_info->filename);
447     if (image != (Image *) NULL)
448       {
449         char
450           filename[MagickPathExtent],
451           *xml;
452
453         ExceptionInfo
454           *sans;
455
456         (void) CopyMagickString(image->magick,read_info->magick,
457           MagickPathExtent);
458         (void) FormatLocaleString(filename,MagickPathExtent,"%s.ufraw",
459           read_info->unique);
460         sans=AcquireExceptionInfo();
461         xml=FileToString(filename,MagickPathExtent,sans);
462         (void) RelinquishUniqueFileResource(filename);
463         if (xml != (char *) NULL)
464           {
465             XMLTreeInfo
466               *ufraw;
467
468             /*
469               Inject.
470             */
471             ufraw=NewXMLTree(xml,sans);
472             if (ufraw != (XMLTreeInfo *) NULL)
473               {
474                 char
475                   *content,
476                   property[MagickPathExtent];
477
478                 const char
479                   *tag;
480
481                 XMLTreeInfo
482                   *next;
483
484                 if (image->properties == (void *) NULL)
485                   ((Image *) image)->properties=NewSplayTree(
486                     CompareSplayTreeString,RelinquishMagickMemory,
487                     RelinquishMagickMemory);
488                 next=GetXMLTreeChild(ufraw,(const char *) NULL);
489                 while (next != (XMLTreeInfo *) NULL)
490                 {
491                   tag=GetXMLTreeTag(next);
492                   if (tag == (char *) NULL)
493                     tag="unknown";
494                   (void) FormatLocaleString(property,MagickPathExtent,"dng:%s",
495                     tag);
496                   content=ConstantString(GetXMLTreeContent(next));
497                   StripString(content);
498                   if ((LocaleCompare(tag,"log") != 0) &&
499                       (LocaleCompare(tag,"InputFilename") != 0) &&
500                       (LocaleCompare(tag,"OutputFilename") != 0) &&
501                       (LocaleCompare(tag,"OutputType") != 0) &&
502                       (strlen(content) != 0))
503                     (void) AddValueToSplayTree((SplayTreeInfo *)
504                       ((Image *) image)->properties,ConstantString(property),
505                       content);
506                   next=GetXMLTreeSibling(next);
507                 }
508                 ufraw=DestroyXMLTree(ufraw);
509               }
510             xml=DestroyString(xml);
511           }
512         sans=DestroyExceptionInfo(sans);
513       }
514     read_info=DestroyImageInfo(read_info);
515     return(image);
516   }
517 #endif
518 }
519 \f
520 /*
521 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
522 %                                                                             %
523 %                                                                             %
524 %                                                                             %
525 %   R e g i s t e r D N G I m a g e                                           %
526 %                                                                             %
527 %                                                                             %
528 %                                                                             %
529 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
530 %
531 %  RegisterDNGImage() adds attributes for the DNG image format to
532 %  the list of supported formats.  The attributes include the image format
533 %  tag, a method to read and/or write the format, whether the format
534 %  supports the saving of more than one frame to the same file or blob,
535 %  whether the format supports native in-memory I/O, and a brief
536 %  description of the format.
537 %
538 %  The format of the RegisterDNGImage method is:
539 %
540 %      size_t RegisterDNGImage(void)
541 %
542 */
543 ModuleExport size_t RegisterDNGImage(void)
544 {
545   MagickInfo
546     *entry;
547
548   entry=AcquireMagickInfo("DNG","3FR","Hasselblad CFV/H3D39II");
549   entry->decoder=(DecodeImageHandler *) ReadDNGImage;
550   entry->flags|=CoderDecoderSeekableStreamFlag;
551   entry->flags^=CoderBlobSupportFlag;
552   entry->format_type=ExplicitFormatType;
553   (void) RegisterMagickInfo(entry);
554   entry=AcquireMagickInfo("DNG","ARW","Sony Alpha Raw Image Format");
555   entry->decoder=(DecodeImageHandler *) ReadDNGImage;
556   entry->flags|=CoderDecoderSeekableStreamFlag;
557   entry->flags^=CoderBlobSupportFlag;
558   entry->format_type=ExplicitFormatType;
559   (void) RegisterMagickInfo(entry);
560   entry=AcquireMagickInfo("DNG","DNG","Digital Negative");
561   entry->decoder=(DecodeImageHandler *) ReadDNGImage;
562   entry->flags|=CoderDecoderSeekableStreamFlag;
563   entry->flags^=CoderBlobSupportFlag;
564   entry->format_type=ExplicitFormatType;
565   (void) RegisterMagickInfo(entry);
566   entry=AcquireMagickInfo("DNG","CR2","Canon Digital Camera Raw Image Format");
567   entry->decoder=(DecodeImageHandler *) ReadDNGImage;
568   entry->flags|=CoderDecoderSeekableStreamFlag;
569   entry->flags^=CoderBlobSupportFlag;
570   entry->format_type=ExplicitFormatType;
571   (void) RegisterMagickInfo(entry);
572   entry=AcquireMagickInfo("DNG","CRW","Canon Digital Camera Raw Image Format");
573   entry->decoder=(DecodeImageHandler *) ReadDNGImage;
574   entry->flags|=CoderDecoderSeekableStreamFlag;
575   entry->flags^=CoderBlobSupportFlag;
576   entry->format_type=ExplicitFormatType;
577   (void) RegisterMagickInfo(entry);
578   entry=AcquireMagickInfo("DNG","DCR","Kodak Digital Camera Raw Image File");
579   entry->decoder=(DecodeImageHandler *) ReadDNGImage;
580   entry->flags|=CoderDecoderSeekableStreamFlag;
581   entry->flags^=CoderBlobSupportFlag;
582   entry->format_type=ExplicitFormatType;
583   (void) RegisterMagickInfo(entry);
584   entry=AcquireMagickInfo("DNG","ERF","Epson RAW Format");
585   entry->decoder=(DecodeImageHandler *) ReadDNGImage;
586   entry->flags|=CoderDecoderSeekableStreamFlag;
587   entry->flags^=CoderBlobSupportFlag;
588   entry->format_type=ExplicitFormatType;
589   (void) RegisterMagickInfo(entry);
590   entry=AcquireMagickInfo("DNG","IIQ","Phase One Raw Image Format");
591   entry->decoder=(DecodeImageHandler *) ReadDNGImage;
592   entry->flags|=CoderDecoderSeekableStreamFlag;
593   entry->flags^=CoderBlobSupportFlag;
594   entry->format_type=ExplicitFormatType;
595   (void) RegisterMagickInfo(entry);
596   entry=AcquireMagickInfo("DNG","KDC","Kodak Digital Camera Raw Image Format");
597   entry->decoder=(DecodeImageHandler *) ReadDNGImage;
598   entry->flags|=CoderDecoderSeekableStreamFlag;
599   entry->flags^=CoderBlobSupportFlag;
600   entry->format_type=ExplicitFormatType;
601   (void) RegisterMagickInfo(entry);
602   entry=AcquireMagickInfo("DNG","K25","Kodak Digital Camera Raw Image Format");
603   entry->decoder=(DecodeImageHandler *) ReadDNGImage;
604   entry->flags|=CoderDecoderSeekableStreamFlag;
605   entry->flags^=CoderBlobSupportFlag;
606   entry->format_type=ExplicitFormatType;
607   (void) RegisterMagickInfo(entry);
608   entry=AcquireMagickInfo("DNG","MEF","Mamiya Raw Image File");
609   entry->decoder=(DecodeImageHandler *) ReadDNGImage;
610   entry->flags|=CoderDecoderSeekableStreamFlag;
611   entry->flags^=CoderBlobSupportFlag;
612   entry->format_type=ExplicitFormatType;
613   (void) RegisterMagickInfo(entry);
614   entry=AcquireMagickInfo("DNG","MRW","Sony (Minolta) Raw Image File");
615   entry->decoder=(DecodeImageHandler *) ReadDNGImage;
616   entry->flags|=CoderDecoderSeekableStreamFlag;
617   entry->flags^=CoderBlobSupportFlag;
618   entry->format_type=ExplicitFormatType;
619   (void) RegisterMagickInfo(entry);
620   entry=AcquireMagickInfo("DNG","NEF",
621     "Nikon Digital SLR Camera Raw Image File");
622   entry->decoder=(DecodeImageHandler *) ReadDNGImage;
623   entry->flags|=CoderDecoderSeekableStreamFlag;
624   entry->flags^=CoderBlobSupportFlag;
625   entry->format_type=ExplicitFormatType;
626   (void) RegisterMagickInfo(entry);
627   entry=AcquireMagickInfo("DNG","NRW",
628     "Nikon Digital SLR Camera Raw Image File");
629   entry->decoder=(DecodeImageHandler *) ReadDNGImage;
630   entry->flags|=CoderDecoderSeekableStreamFlag;
631   entry->flags^=CoderBlobSupportFlag;
632   entry->format_type=ExplicitFormatType;
633   (void) RegisterMagickInfo(entry);
634   entry=AcquireMagickInfo("DNG","ORF","Olympus Digital Camera Raw Image File");
635   entry->decoder=(DecodeImageHandler *) ReadDNGImage;
636   entry->flags|=CoderDecoderSeekableStreamFlag;
637   entry->flags^=CoderBlobSupportFlag;
638   entry->format_type=ExplicitFormatType;
639   (void) RegisterMagickInfo(entry);
640   entry=AcquireMagickInfo("DNG","PEF","Pentax Electronic File");
641   entry->decoder=(DecodeImageHandler *) ReadDNGImage;
642   entry->flags|=CoderDecoderSeekableStreamFlag;
643   entry->flags^=CoderBlobSupportFlag;
644   entry->format_type=ExplicitFormatType;
645   (void) RegisterMagickInfo(entry);
646   entry=AcquireMagickInfo("DNG","RAF","Fuji CCD-RAW Graphic File");
647   entry->decoder=(DecodeImageHandler *) ReadDNGImage;
648   entry->flags|=CoderDecoderSeekableStreamFlag;
649   entry->flags^=CoderBlobSupportFlag;
650   entry->format_type=ExplicitFormatType;
651   (void) RegisterMagickInfo(entry);
652   entry=AcquireMagickInfo("DNG","RAW","Raw");
653   entry->decoder=(DecodeImageHandler *) ReadDNGImage;
654   entry->flags|=CoderDecoderSeekableStreamFlag;
655   entry->flags^=CoderBlobSupportFlag;
656   entry->format_type=ExplicitFormatType;
657   (void) RegisterMagickInfo(entry);
658   entry=AcquireMagickInfo("DNG","RMF","Raw Media Format");
659   entry->decoder=(DecodeImageHandler *) ReadDNGImage;
660   entry->flags|=CoderDecoderSeekableStreamFlag;
661   entry->flags^=CoderBlobSupportFlag;
662   entry->format_type=ExplicitFormatType;
663   (void) RegisterMagickInfo(entry);
664   entry=AcquireMagickInfo("DNG","RW2","Panasonic Lumix Raw Image");
665   entry->decoder=(DecodeImageHandler *) ReadDNGImage;
666   entry->flags|=CoderDecoderSeekableStreamFlag;
667   entry->flags^=CoderBlobSupportFlag;
668   entry->format_type=ExplicitFormatType;
669   (void) RegisterMagickInfo(entry);
670   entry=AcquireMagickInfo("DNG","SRF","Sony Raw Format");
671   entry->decoder=(DecodeImageHandler *) ReadDNGImage;
672   entry->flags|=CoderDecoderSeekableStreamFlag;
673   entry->flags^=CoderBlobSupportFlag;
674   entry->format_type=ExplicitFormatType;
675   (void) RegisterMagickInfo(entry);
676   entry=AcquireMagickInfo("DNG","SR2","Sony Raw Format 2");
677   entry->decoder=(DecodeImageHandler *) ReadDNGImage;
678   entry->flags|=CoderDecoderSeekableStreamFlag;
679   entry->flags^=CoderBlobSupportFlag;
680   entry->format_type=ExplicitFormatType;
681   (void) RegisterMagickInfo(entry);
682   entry=AcquireMagickInfo("DNG","X3F","Sigma Camera RAW Picture File");
683   entry->decoder=(DecodeImageHandler *) ReadDNGImage;
684   entry->flags|=CoderDecoderSeekableStreamFlag;
685   entry->flags^=CoderBlobSupportFlag;
686   entry->format_type=ExplicitFormatType;
687   (void) RegisterMagickInfo(entry);
688   return(MagickImageCoderSignature);
689 }
690 \f
691 /*
692 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
693 %                                                                             %
694 %                                                                             %
695 %                                                                             %
696 %   U n r e g i s t e r D N G I m a g e                                       %
697 %                                                                             %
698 %                                                                             %
699 %                                                                             %
700 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
701 %
702 %  UnregisterDNGImage() removes format registrations made by the
703 %  BIM module from the list of supported formats.
704 %
705 %  The format of the UnregisterBIMImage method is:
706 %
707 %      UnregisterDNGImage(void)
708 %
709 */
710 ModuleExport void UnregisterDNGImage(void)
711 {
712   (void) UnregisterMagickInfo("X3F");
713   (void) UnregisterMagickInfo("SR2");
714   (void) UnregisterMagickInfo("SRF");
715   (void) UnregisterMagickInfo("RW2");
716   (void) UnregisterMagickInfo("RMF");
717   (void) UnregisterMagickInfo("RAF");
718   (void) UnregisterMagickInfo("PEF");
719   (void) UnregisterMagickInfo("ORF");
720   (void) UnregisterMagickInfo("NRW");
721   (void) UnregisterMagickInfo("NEF");
722   (void) UnregisterMagickInfo("MRW");
723   (void) UnregisterMagickInfo("MEF");
724   (void) UnregisterMagickInfo("K25");
725   (void) UnregisterMagickInfo("KDC");
726   (void) UnregisterMagickInfo("IIQ");
727   (void) UnregisterMagickInfo("ERF");
728   (void) UnregisterMagickInfo("DCR");
729   (void) UnregisterMagickInfo("CRW");
730   (void) UnregisterMagickInfo("CR2");
731   (void) UnregisterMagickInfo("DNG");
732   (void) UnregisterMagickInfo("ARW");
733   (void) UnregisterMagickInfo("3FR");
734 }