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-2019 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://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 
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)
InitializeDcrawOpenCL(ExceptionInfo * exception)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
InitializeDcrawOpenCL(ExceptionInfo * magick_unused (exception))150 static void InitializeDcrawOpenCL(ExceptionInfo *magick_unused(exception))
151 {
152   magick_unreferenced(exception);
153 #if defined(MAGICKCORE_WINDOWS_SUPPORT)
154   (void) SetEnvironmentVariable("DCR_CL_DISABLED","1");
155 #endif
156 }
157 #endif
158 
159 #if defined(MAGICKCORE_RAW_R_DELEGATE)
SetDNGProperties(Image * image,const libraw_data_t * raw_info,ExceptionInfo * exception)160 static void SetDNGProperties(Image *image,const libraw_data_t *raw_info,
161   ExceptionInfo *exception)
162 {
163   char
164     property[MagickPathExtent],
165     timestamp[MagickPathExtent];
166 
167   (void) SetImageProperty(image,"dng:make",raw_info->idata.make,exception);
168   (void) SetImageProperty(image,"dng:camera.model.name",raw_info->idata.model,
169     exception);
170   (void) FormatMagickTime(raw_info->other.timestamp,MagickPathExtent,timestamp);
171   (void) SetImageProperty(image,"dng:create.date",timestamp,exception);
172   (void) FormatLocaleString(property,MagickPathExtent,"%0.1f",
173     raw_info->other.iso_speed);
174   (void) SetImageProperty(image,"dng:iso.setting",property,exception);
175 #if LIBRAW_COMPILE_CHECK_VERSION_NOTLESS(0,18)
176   (void) SetImageProperty(image,"dng:software",raw_info->idata.software,
177     exception);
178   if (*raw_info->shootinginfo.BodySerial != '\0')
179     (void) SetImageProperty(image,"dng:serial.number",
180       raw_info->shootinginfo.BodySerial,exception);
181   (void) FormatLocaleString(property,MagickPathExtent,"%0.2f",
182     raw_info->other.FlashEC);
183   (void) SetImageProperty(image,"dng:flash.exposure.compensation",property,
184     exception);
185   (void) FormatLocaleString(property,MagickPathExtent,"1/%0.1f",
186     1.0/raw_info->other.shutter);
187   (void) SetImageProperty(image,"dng:exposure.time",property,exception);
188   (void) FormatLocaleString(property,MagickPathExtent,"%0.1f",
189     raw_info->other.aperture);
190   (void) SetImageProperty(image,"dng:f.number",property,exception);
191   (void) FormatLocaleString(property,MagickPathExtent,"%0.1f",
192     raw_info->lens.EXIF_MaxAp);
193   (void) SetImageProperty(image,"dng:max.aperture.value",property,exception);
194   (void) FormatLocaleString(property,MagickPathExtent,"%0.1f",
195     raw_info->other.focal_len);
196   (void) SetImageProperty(image,"dng:focal.length",property,exception);
197   (void) FormatLocaleString(property,MagickPathExtent,"%f %f %f %f",
198     raw_info->color.cam_mul[0],raw_info->color.cam_mul[2],
199     raw_info->color.cam_mul[1],raw_info->color.cam_mul[3]);
200   (void) SetImageProperty(image,"dng:wb.rb.levels",property,exception);
201   (void) SetImageProperty(image,"dng:lens.type",
202     raw_info->lens.makernotes.LensFeatures_suf,exception);
203   (void) FormatLocaleString(property,MagickPathExtent,
204     "%0.1f-%0.1fmm f/%0.1f-%0.1f",raw_info->lens.makernotes.MinFocal,
205     raw_info->lens.makernotes.MaxFocal,raw_info->lens.makernotes.MaxAp4MinFocal,
206     raw_info->lens.makernotes.MaxAp4MaxFocal);
207   (void) SetImageProperty(image,"dng:lens",property,exception);
208   (void) FormatLocaleString(property,MagickPathExtent,"%0.2f",
209     raw_info->lens.makernotes.LensFStops);
210   (void) SetImageProperty(image,"dng:lens.f.stops",property,exception);
211   (void) FormatLocaleString(property,MagickPathExtent,"%0.1f mm",
212     raw_info->lens.makernotes.MinFocal);
213   (void) SetImageProperty(image,"dng:min.focal.length",property,exception);
214   (void) FormatLocaleString(property,MagickPathExtent,"%0.1f mm",
215     raw_info->lens.makernotes.MaxFocal);
216   (void) SetImageProperty(image,"dng:max.focal.length",property,exception);
217   (void) FormatLocaleString(property,MagickPathExtent,"%0.1f",
218     raw_info->lens.makernotes.MaxAp4MinFocal);
219   (void) SetImageProperty(image,"dng:max.aperture.at.min.focal",property,
220     exception);
221   (void) FormatLocaleString(property,MagickPathExtent,"%0.1f",
222     raw_info->lens.makernotes.MaxAp4MaxFocal);
223   (void) SetImageProperty(image,"dng:max.aperture.at.max.focal",property,
224     exception);
225   (void) FormatLocaleString(property,MagickPathExtent,"%d mm",
226     raw_info->lens.FocalLengthIn35mmFormat);
227   (void) SetImageProperty(image,"dng:focal.length.in.35mm.format",property,
228     exception);
229 #endif
230 }
231 #endif
232 
InvokeDNGDelegate(const ImageInfo * image_info,Image * image,ExceptionInfo * exception)233 static Image *InvokeDNGDelegate(const ImageInfo *image_info,Image *image,
234   ExceptionInfo *exception)
235 {
236   ExceptionInfo
237     *sans_exception;
238 
239   ImageInfo
240     *read_info;
241 
242   /*
243     Convert DNG to PPM with delegate.
244   */
245   (void) DestroyImageList(image);
246   InitializeDcrawOpenCL(exception);
247   image=AcquireImage(image_info,exception);
248   read_info=CloneImageInfo(image_info);
249   SetImageInfoBlob(read_info,(void *) NULL,0);
250   (void) InvokeDelegate(read_info,image,"dng:decode",(char *) NULL,exception);
251   image=DestroyImage(image);
252   (void) FormatLocaleString(read_info->filename,MagickPathExtent,"%s.png",
253     read_info->unique);
254   sans_exception=AcquireExceptionInfo();
255   image=ReadImage(read_info,sans_exception);
256   sans_exception=DestroyExceptionInfo(sans_exception);
257   if (image == (Image *) NULL)
258     {
259       (void) FormatLocaleString(read_info->filename,MagickPathExtent,"%s.ppm",
260         read_info->unique);
261       image=ReadImage(read_info,exception);
262     }
263   (void) RelinquishUniqueFileResource(read_info->filename);
264   if (image != (Image *) NULL)
265     {
266       char
267         filename[MagickPathExtent],
268         *xml;
269 
270       ExceptionInfo
271         *sans;
272 
273       (void) CopyMagickString(image->magick,read_info->magick,
274         MagickPathExtent);
275       (void) FormatLocaleString(filename,MagickPathExtent,"%s.ufraw",
276         read_info->unique);
277       sans=AcquireExceptionInfo();
278       xml=FileToString(filename,MagickPathExtent,sans);
279       (void) RelinquishUniqueFileResource(filename);
280       if (xml != (char *) NULL)
281         {
282           XMLTreeInfo
283             *ufraw;
284 
285           /*
286             Inject.
287           */
288           ufraw=NewXMLTree(xml,sans);
289           if (ufraw != (XMLTreeInfo *) NULL)
290             {
291               char
292                 *content,
293                 property[MagickPathExtent];
294 
295               const char
296                 *tag;
297 
298               XMLTreeInfo
299                 *next;
300 
301               if (image->properties == (void *) NULL)
302                 image->properties=NewSplayTree(CompareSplayTreeString,
303                   RelinquishMagickMemory,RelinquishMagickMemory);
304               next=GetXMLTreeChild(ufraw,(const char *) NULL);
305               while (next != (XMLTreeInfo *) NULL)
306               {
307                 tag=GetXMLTreeTag(next);
308                 if (tag == (char *) NULL)
309                   tag="unknown";
310                 (void) FormatLocaleString(property,MagickPathExtent,"dng:%s",
311                   tag);
312                 content=ConstantString(GetXMLTreeContent(next));
313                 StripString(content);
314                 if ((LocaleCompare(tag,"log") != 0) &&
315                     (LocaleCompare(tag,"InputFilename") != 0) &&
316                     (LocaleCompare(tag,"OutputFilename") != 0) &&
317                     (LocaleCompare(tag,"OutputType") != 0) &&
318                     (strlen(content) != 0))
319                   (void) AddValueToSplayTree((SplayTreeInfo *)
320                     image->properties,ConstantString(property),content);
321                 next=GetXMLTreeSibling(next);
322               }
323               ufraw=DestroyXMLTree(ufraw);
324             }
325           xml=DestroyString(xml);
326         }
327       sans=DestroyExceptionInfo(sans);
328     }
329   read_info=DestroyImageInfo(read_info);
330   return(image);
331 }
332 
ReadDNGImage(const ImageInfo * image_info,ExceptionInfo * exception)333 static Image *ReadDNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
334 {
335   Image
336     *image;
337 
338   MagickBooleanType
339     status;
340 
341   /*
342     Open image file.
343   */
344   assert(image_info != (const ImageInfo *) NULL);
345   assert(image_info->signature == MagickCoreSignature);
346   if (image_info->debug != MagickFalse)
347     (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
348       image_info->filename);
349   assert(exception != (ExceptionInfo *) NULL);
350   assert(exception->signature == MagickCoreSignature);
351   image=AcquireImage(image_info,exception);
352   status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
353   if (status == MagickFalse)
354     {
355       image=DestroyImageList(image);
356       return((Image *) NULL);
357     }
358   (void) CloseBlob(image);
359   if (LocaleCompare(image_info->magick,"DCRAW") == 0)
360     return(InvokeDNGDelegate(image_info,image,exception));
361 #if defined(MAGICKCORE_RAW_R_DELEGATE)
362   {
363     int
364       errcode;
365 
366     libraw_data_t
367       *raw_info;
368 
369     libraw_processed_image_t
370       *raw_image;
371 
372     register ssize_t
373       y;
374 
375     StringInfo
376       *profile;
377 
378     unsigned short
379       *p;
380 
381     errcode=0;
382     raw_info=libraw_init(0);
383     if (raw_info == (libraw_data_t *) NULL)
384       {
385         (void) ThrowMagickException(exception,GetMagickModule(),CoderError,
386           libraw_strerror(errcode),"`%s'",image->filename);
387         libraw_close(raw_info);
388         return(DestroyImageList(image));
389       }
390 #if defined(MAGICKCORE_WINDOWS_SUPPORT) && defined(_MSC_VER) && (_MSC_VER > 1310)
391     {
392       wchar_t
393         fileName[MagickPathExtent];
394 
395       MultiByteToWideChar(CP_UTF8,0,image->filename,-1,fileName,
396         MagickPathExtent);
397       errcode=libraw_open_wfile(raw_info,fileName);
398     }
399 #else
400     errcode=libraw_open_file(raw_info,image->filename);
401 #endif
402     if (errcode != LIBRAW_SUCCESS)
403       {
404         (void) ThrowMagickException(exception,GetMagickModule(),CoderError,
405           libraw_strerror(errcode),"`%s'",image->filename);
406         libraw_close(raw_info);
407         return(DestroyImageList(image));
408       }
409     image->columns=raw_info->sizes.width;
410     image->rows=raw_info->sizes.height;
411     image->page.width=raw_info->sizes.raw_width;
412     image->page.height=raw_info->sizes.raw_height;
413     image->page.x=raw_info->sizes.left_margin;
414     image->page.y=raw_info->sizes.top_margin;
415     if (image_info->ping != MagickFalse)
416       {
417         libraw_close(raw_info);
418         return(image);
419       }
420     status=SetImageExtent(image,image->columns,image->rows,exception);
421     if (status == MagickFalse)
422       {
423         libraw_close(raw_info);
424         return(image);
425       }
426     errcode=libraw_unpack(raw_info);
427     if (errcode != LIBRAW_SUCCESS)
428       {
429         (void) ThrowMagickException(exception,GetMagickModule(),CoderError,
430           libraw_strerror(errcode),"`%s'",image->filename);
431         libraw_close(raw_info);
432         return(DestroyImageList(image));
433       }
434     raw_info->params.output_bps=16;
435     errcode=libraw_dcraw_process(raw_info);
436     if (errcode != LIBRAW_SUCCESS)
437       {
438         (void) ThrowMagickException(exception,GetMagickModule(),CoderError,
439           libraw_strerror(errcode),"`%s'",image->filename);
440         libraw_close(raw_info);
441         return(DestroyImageList(image));
442       }
443     raw_image=libraw_dcraw_make_mem_image(raw_info,&errcode);
444     if ((errcode != LIBRAW_SUCCESS) ||
445         (raw_image == (libraw_processed_image_t *) NULL) ||
446         (raw_image->type != LIBRAW_IMAGE_BITMAP) || (raw_image->bits != 16) ||
447         (raw_image->colors < 3) || (raw_image->colors > 4))
448       {
449         if (raw_image != (libraw_processed_image_t *) NULL)
450           libraw_dcraw_clear_mem(raw_image);
451         (void) ThrowMagickException(exception,GetMagickModule(),CoderError,
452           libraw_strerror(errcode),"`%s'",image->filename);
453         libraw_close(raw_info);
454         return(DestroyImageList(image));
455       }
456     image->columns=raw_image->width;
457     image->rows=raw_image->height;
458     image->depth=raw_image->bits;
459     status=SetImageExtent(image,image->columns,image->rows,exception);
460     if (status == MagickFalse)
461       {
462         libraw_dcraw_clear_mem(raw_image);
463         libraw_close(raw_info);
464         return(DestroyImageList(image));
465       }
466     p=(unsigned short *) raw_image->data;
467     for (y=0; y < (ssize_t) image->rows; y++)
468     {
469       register Quantum
470         *q;
471 
472       register ssize_t
473         x;
474 
475       q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
476       if (q == (Quantum *) NULL)
477         break;
478       for (x=0; x < (ssize_t) image->columns; x++)
479       {
480         SetPixelRed(image,ScaleShortToQuantum(*p++),q);
481         SetPixelGreen(image,ScaleShortToQuantum(*p++),q);
482         SetPixelBlue(image,ScaleShortToQuantum(*p++),q);
483         if (raw_image->colors > 3)
484           SetPixelAlpha(image,ScaleShortToQuantum(*p++),q);
485         q+=GetPixelChannels(image);
486       }
487       if (SyncAuthenticPixels(image,exception) == MagickFalse)
488         break;
489       if (image->previous == (Image *) NULL)
490         {
491           status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,
492             image->rows);
493           if (status == MagickFalse)
494             break;
495         }
496     }
497     libraw_dcraw_clear_mem(raw_image);
498     /*
499       Set DNG image metadata.
500     */
501     if (raw_info->color.profile != NULL)
502       {
503         profile=BlobToStringInfo(raw_info->color.profile,
504           raw_info->color.profile_length);
505         if (profile != (StringInfo *) NULL)
506           {
507             SetImageProfile(image,"ICC",profile,exception);
508             profile=DestroyStringInfo(profile);
509           }
510       }
511 #if LIBRAW_COMPILE_CHECK_VERSION_NOTLESS(0,18)
512     if (raw_info->idata.xmpdata != NULL)
513       {
514         profile=BlobToStringInfo(raw_info->idata.xmpdata,
515           raw_info->idata.xmplen);
516         if (profile != (StringInfo *) NULL)
517           {
518             SetImageProfile(image,"XMP",profile,exception);
519             profile=DestroyStringInfo(profile);
520           }
521       }
522 #endif
523     SetDNGProperties(image,raw_info,exception);
524     libraw_close(raw_info);
525     return(image);
526   }
527 #else
528   return(InvokeDNGDelegate(image_info,image,exception));
529 #endif
530 }
531 
532 /*
533 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
534 %                                                                             %
535 %                                                                             %
536 %                                                                             %
537 %   R e g i s t e r D N G I m a g e                                           %
538 %                                                                             %
539 %                                                                             %
540 %                                                                             %
541 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
542 %
543 %  RegisterDNGImage() adds attributes for the DNG image format to
544 %  the list of supported formats.  The attributes include the image format
545 %  tag, a method to read and/or write the format, whether the format
546 %  supports the saving of more than one frame to the same file or blob,
547 %  whether the format supports native in-memory I/O, and a brief
548 %  description of the format.
549 %
550 %  The format of the RegisterDNGImage method is:
551 %
552 %      size_t RegisterDNGImage(void)
553 %
554 */
RegisterDNGImage(void)555 ModuleExport size_t RegisterDNGImage(void)
556 {
557   MagickInfo
558     *entry;
559 
560   entry=AcquireMagickInfo("DNG","3FR","Hasselblad CFV/H3D39II");
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","ARW","Sony Alpha 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","DNG","Digital Negative");
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","CR2","Canon Digital Camera Raw Image Format");
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","CRW","Canon Digital Camera Raw Image 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","DCR","Kodak Digital Camera Raw Image File");
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","DCRAW","Raw Photo Decoder (dcraw)");
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","ERF","Epson RAW 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","IIQ","Phase One Raw Image Format");
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","KDC","Kodak Digital Camera Raw Image Format");
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","K25","Kodak Digital Camera Raw Image Format");
621   entry->decoder=(DecodeImageHandler *) ReadDNGImage;
622   entry->flags|=CoderDecoderSeekableStreamFlag;
623   entry->flags^=CoderBlobSupportFlag;
624   entry->format_type=ExplicitFormatType;
625   (void) RegisterMagickInfo(entry);
626   entry=AcquireMagickInfo("DNG","MEF","Mamiya Raw Image File");
627   entry->decoder=(DecodeImageHandler *) ReadDNGImage;
628   entry->flags|=CoderDecoderSeekableStreamFlag;
629   entry->flags^=CoderBlobSupportFlag;
630   entry->format_type=ExplicitFormatType;
631   (void) RegisterMagickInfo(entry);
632   entry=AcquireMagickInfo("DNG","MRW","Sony (Minolta) Raw Image File");
633   entry->decoder=(DecodeImageHandler *) ReadDNGImage;
634   entry->flags|=CoderDecoderSeekableStreamFlag;
635   entry->flags^=CoderBlobSupportFlag;
636   entry->format_type=ExplicitFormatType;
637   (void) RegisterMagickInfo(entry);
638   entry=AcquireMagickInfo("DNG","NEF",
639     "Nikon Digital SLR Camera Raw Image File");
640   entry->decoder=(DecodeImageHandler *) ReadDNGImage;
641   entry->flags|=CoderDecoderSeekableStreamFlag;
642   entry->flags^=CoderBlobSupportFlag;
643   entry->format_type=ExplicitFormatType;
644   (void) RegisterMagickInfo(entry);
645   entry=AcquireMagickInfo("DNG","NRW",
646     "Nikon Digital SLR Camera Raw Image 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","ORF","Olympus Digital Camera Raw Image File");
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","PEF","Pentax Electronic File");
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","RAF","Fuji CCD-RAW Graphic File");
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","RAW","Raw");
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","RMF","Raw Media Format");
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","RW2","Panasonic Lumix Raw Image");
683   entry->decoder=(DecodeImageHandler *) ReadDNGImage;
684   entry->flags|=CoderDecoderSeekableStreamFlag;
685   entry->flags^=CoderBlobSupportFlag;
686   entry->format_type=ExplicitFormatType;
687   (void) RegisterMagickInfo(entry);
688   entry=AcquireMagickInfo("DNG","SRF","Sony Raw Format");
689   entry->decoder=(DecodeImageHandler *) ReadDNGImage;
690   entry->flags|=CoderDecoderSeekableStreamFlag;
691   entry->flags^=CoderBlobSupportFlag;
692   entry->format_type=ExplicitFormatType;
693   (void) RegisterMagickInfo(entry);
694   entry=AcquireMagickInfo("DNG","SR2","Sony Raw Format 2");
695   entry->decoder=(DecodeImageHandler *) ReadDNGImage;
696   entry->flags|=CoderDecoderSeekableStreamFlag;
697   entry->flags^=CoderBlobSupportFlag;
698   entry->format_type=ExplicitFormatType;
699   (void) RegisterMagickInfo(entry);
700   entry=AcquireMagickInfo("DNG","X3F","Sigma Camera RAW Picture File");
701   entry->decoder=(DecodeImageHandler *) ReadDNGImage;
702   entry->flags|=CoderDecoderSeekableStreamFlag;
703   entry->flags^=CoderBlobSupportFlag;
704   entry->format_type=ExplicitFormatType;
705   (void) RegisterMagickInfo(entry);
706   return(MagickImageCoderSignature);
707 }
708 
709 /*
710 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
711 %                                                                             %
712 %                                                                             %
713 %                                                                             %
714 %   U n r e g i s t e r D N G I m a g e                                       %
715 %                                                                             %
716 %                                                                             %
717 %                                                                             %
718 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
719 %
720 %  UnregisterDNGImage() removes format registrations made by the
721 %  BIM module from the list of supported formats.
722 %
723 %  The format of the UnregisterBIMImage method is:
724 %
725 %      UnregisterDNGImage(void)
726 %
727 */
UnregisterDNGImage(void)728 ModuleExport void UnregisterDNGImage(void)
729 {
730   (void) UnregisterMagickInfo("X3F");
731   (void) UnregisterMagickInfo("SR2");
732   (void) UnregisterMagickInfo("SRF");
733   (void) UnregisterMagickInfo("RW2");
734   (void) UnregisterMagickInfo("RMF");
735   (void) UnregisterMagickInfo("RAF");
736   (void) UnregisterMagickInfo("PEF");
737   (void) UnregisterMagickInfo("ORF");
738   (void) UnregisterMagickInfo("NRW");
739   (void) UnregisterMagickInfo("NEF");
740   (void) UnregisterMagickInfo("MRW");
741   (void) UnregisterMagickInfo("MEF");
742   (void) UnregisterMagickInfo("K25");
743   (void) UnregisterMagickInfo("KDC");
744   (void) UnregisterMagickInfo("IIQ");
745   (void) UnregisterMagickInfo("ERF");
746   (void) UnregisterMagickInfo("DCR");
747   (void) UnregisterMagickInfo("CRW");
748   (void) UnregisterMagickInfo("CR2");
749   (void) UnregisterMagickInfo("DNG");
750   (void) UnregisterMagickInfo("ARW");
751   (void) UnregisterMagickInfo("3FR");
752 }
753