Index: GraphicsMagick-1.2.5/coders/mvg.c
===================================================================
--- GraphicsMagick-1.2.5.orig/coders/mvg.c
+++ GraphicsMagick-1.2.5/coders/mvg.c
@@ -225,6 +225,7 @@ ModuleExport void RegisterMVGImage(void)
   entry->seekable_stream=True;
   entry->description=AcquireString("Magick Vector Graphics");
   entry->module=AcquireString("MVG");
+  entry->extension_treatment=IgnoreExtensionTreatment;
   (void) RegisterMagickInfo(entry);
 }
 
Index: GraphicsMagick-1.2.5/magick/magick.c
===================================================================
--- GraphicsMagick-1.2.5.orig/magick/magick.c
+++ GraphicsMagick-1.2.5/magick/magick.c
@@ -1207,6 +1207,7 @@ MagickExport MagickInfo *SetMagickInfo(c
   magick_info->adjoin=True;
   magick_info->blob_support=True;
   magick_info->thread_support=True;
+  magick_info->extension_treatment=HintExtensionTreatment;
   magick_info->signature=MagickSignature;
   return(magick_info);
 }
Index: GraphicsMagick-1.2.5/magick/magick.h
===================================================================
--- GraphicsMagick-1.2.5.orig/magick/magick.h
+++ GraphicsMagick-1.2.5/magick/magick.h
@@ -23,6 +23,16 @@ typedef unsigned int
   (*EncoderHandler)(const ImageInfo *,Image *),
   (*MagickHandler)(const unsigned char *,const size_t);
 
+/*
+How the file extension should be treated (e.g. in SetImageInfo()).
+*/
+typedef enum
+{
+  HintExtensionTreatment = 0, /* Extension is a useful hint to indicate format */
+  ObeyExtensionTreatment,     /* Extension must be obeyed as format indicator */
+  IgnoreExtensionTreatment    /* Format has no associated extension */
+} ExtensionTreatment;
+
 typedef struct _MagickInfo
 {
   char
@@ -57,6 +67,9 @@ typedef struct _MagickInfo
     blob_support,	/* coder uses BLOB APIs (default True) */
     thread_support;     /* coder is thread safe (default True) */
 
+  ExtensionTreatment
+    extension_treatment; /* How much faith should be placed on file extension? */
+
   unsigned long
     signature;          /* private, structure validator */
 
Index: GraphicsMagick-1.2.5/coders/caption.c
===================================================================
--- GraphicsMagick-1.2.5.orig/coders/caption.c
+++ GraphicsMagick-1.2.5/coders/caption.c
@@ -211,6 +211,7 @@ ModuleExport void RegisterCAPTIONImage(v
   entry->adjoin=False;
   entry->description=AcquireString("Image caption");
   entry->module=AcquireString("CAPTION");
+  entry->extension_treatment=IgnoreExtensionTreatment;
   (void) RegisterMagickInfo(entry);
 }
 
Index: GraphicsMagick-1.2.5/coders/clipboard.c
===================================================================
--- GraphicsMagick-1.2.5.orig/coders/clipboard.c
+++ GraphicsMagick-1.2.5/coders/clipboard.c
@@ -295,6 +295,7 @@ ModuleExport void RegisterCLIPBOARDImage
   entry->adjoin = False;
   entry->description=AcquireString("the system clipboard");
   entry->module=AcquireString("CLIPBOARD");
+  entry->extension_treatment=IgnoreExtensionTreatment;
   (void) RegisterMagickInfo(entry);
 #endif
 }
Index: GraphicsMagick-1.2.5/coders/gradient.c
===================================================================
--- GraphicsMagick-1.2.5.orig/coders/gradient.c
+++ GraphicsMagick-1.2.5/coders/gradient.c
@@ -154,6 +154,7 @@ ModuleExport void RegisterGRADIENTImage(
   entry->raw=True;
   entry->description=AcquireString("Gradual passing from one shade to another");
   entry->module=AcquireString("GRADIENT");
+  entry->extension_treatment=IgnoreExtensionTreatment;
   (void) RegisterMagickInfo(entry);
 }
 
Index: GraphicsMagick-1.2.5/coders/gray.c
===================================================================
--- GraphicsMagick-1.2.5.orig/coders/gray.c
+++ GraphicsMagick-1.2.5/coders/gray.c
@@ -264,6 +264,7 @@ ModuleExport void RegisterGRAYImage(void
   entry->raw=True;
   entry->description=AcquireString("Raw gray samples");
   entry->module=AcquireString("GRAY");
+  entry->extension_treatment=IgnoreExtensionTreatment;
   (void) RegisterMagickInfo(entry);
   entry=SetMagickInfo("R");
   entry->decoder=(DecoderHandler) ReadGRAYImage;
@@ -272,6 +273,7 @@ ModuleExport void RegisterGRAYImage(void
   entry->raw=True;
   entry->description=AcquireString("Raw red samples");
   entry->module=AcquireString("GRAY");
+  entry->extension_treatment=IgnoreExtensionTreatment;
   (void) RegisterMagickInfo(entry);
   entry=SetMagickInfo("C");
   entry->decoder=(DecoderHandler) ReadGRAYImage;
@@ -280,6 +282,7 @@ ModuleExport void RegisterGRAYImage(void
   entry->raw=True;
   entry->description=AcquireString("Raw cyan samples");
   entry->module=AcquireString("GRAY");
+  entry->extension_treatment=IgnoreExtensionTreatment;
   (void) RegisterMagickInfo(entry);
   entry=SetMagickInfo("G");
   entry->decoder=(DecoderHandler) ReadGRAYImage;
@@ -288,6 +291,7 @@ ModuleExport void RegisterGRAYImage(void
   entry->raw=True;
   entry->description=AcquireString("Raw green samples");
   entry->module=AcquireString("GRAY");
+  entry->extension_treatment=IgnoreExtensionTreatment;
   (void) RegisterMagickInfo(entry);
   entry=SetMagickInfo("M");
   entry->decoder=(DecoderHandler) ReadGRAYImage;
@@ -296,6 +300,7 @@ ModuleExport void RegisterGRAYImage(void
   entry->raw=True;
   entry->description=AcquireString("Raw magenta samples");
   entry->module=AcquireString("GRAY");
+  entry->extension_treatment=IgnoreExtensionTreatment;
   (void) RegisterMagickInfo(entry);
   entry=SetMagickInfo("B");
   entry->decoder=(DecoderHandler) ReadGRAYImage;
@@ -304,6 +309,7 @@ ModuleExport void RegisterGRAYImage(void
   entry->raw=True;
   entry->description=AcquireString("Raw blue samples");
   entry->module=AcquireString("GRAY");
+  entry->extension_treatment=IgnoreExtensionTreatment;
   (void) RegisterMagickInfo(entry);
   entry=SetMagickInfo("Y");
   entry->decoder=(DecoderHandler) ReadGRAYImage;
@@ -312,6 +318,7 @@ ModuleExport void RegisterGRAYImage(void
   entry->raw=True;
   entry->description=AcquireString("Raw yellow samples");
   entry->module=AcquireString("GRAY");
+  entry->extension_treatment=IgnoreExtensionTreatment;
   (void) RegisterMagickInfo(entry);
   entry=SetMagickInfo("O");
   entry->decoder=(DecoderHandler) ReadGRAYImage;
@@ -320,6 +327,7 @@ ModuleExport void RegisterGRAYImage(void
   entry->raw=True;
   entry->description=AcquireString("Raw opacity samples");
   entry->module=AcquireString("GRAY");
+  entry->extension_treatment=IgnoreExtensionTreatment;
   (void) RegisterMagickInfo(entry);
   entry=SetMagickInfo("K");
   entry->decoder=(DecoderHandler) ReadGRAYImage;
@@ -328,6 +336,7 @@ ModuleExport void RegisterGRAYImage(void
   entry->raw=True;
   entry->description=AcquireString("Raw black samples");
   entry->module=AcquireString("GRAY");
+  entry->extension_treatment=IgnoreExtensionTreatment;
   (void) RegisterMagickInfo(entry);
 }
 
Index: GraphicsMagick-1.2.5/coders/histogram.c
===================================================================
--- GraphicsMagick-1.2.5.orig/coders/histogram.c
+++ GraphicsMagick-1.2.5/coders/histogram.c
@@ -85,6 +85,7 @@ ModuleExport void RegisterHISTOGRAMImage
   entry->adjoin=False;
   entry->description=AcquireString("Histogram of the image");
   entry->module=AcquireString("HISTOGRAM");
+  entry->extension_treatment=IgnoreExtensionTreatment;
   (void) RegisterMagickInfo(entry);
 }
 
Index: GraphicsMagick-1.2.5/coders/mpr.c
===================================================================
--- GraphicsMagick-1.2.5.orig/coders/mpr.c
+++ GraphicsMagick-1.2.5/coders/mpr.c
@@ -138,6 +138,7 @@ ModuleExport void RegisterMPRImage(void)
   entry->stealth=True;
   entry->description=AcquireString("Magick Persistent Registry");
   entry->module=AcquireString("MPR");
+  entry->extension_treatment=IgnoreExtensionTreatment;
   (void) RegisterMagickInfo(entry);
   entry=SetMagickInfo("MPRI");
   entry->decoder=(DecoderHandler) ReadMPRImage;
@@ -147,6 +148,7 @@ ModuleExport void RegisterMPRImage(void)
   entry->stealth=True;
   entry->description=AcquireString("Magick Persistent Registry");
   entry->module=AcquireString("MPRI");
+  entry->extension_treatment=IgnoreExtensionTreatment;
   (void) RegisterMagickInfo(entry);
 }
 
Index: GraphicsMagick-1.2.5/coders/null.c
===================================================================
--- GraphicsMagick-1.2.5.orig/coders/null.c
+++ GraphicsMagick-1.2.5/coders/null.c
@@ -157,6 +157,7 @@ ModuleExport void RegisterNULLImage(void
   entry->adjoin=False;
   entry->description=AcquireString("Constant image of uniform color");
   entry->module=AcquireString("NULL");
+  entry->extension_treatment=IgnoreExtensionTreatment;
   (void) RegisterMagickInfo(entry);
 }
 
Index: GraphicsMagick-1.2.5/coders/plasma.c
===================================================================
--- GraphicsMagick-1.2.5.orig/coders/plasma.c
+++ GraphicsMagick-1.2.5/coders/plasma.c
@@ -209,12 +209,14 @@ ModuleExport void RegisterPLASMAImage(vo
   entry->adjoin=False;
   entry->description=AcquireString("Plasma fractal image");
   entry->module=AcquireString("PLASMA");
+  entry->extension_treatment=IgnoreExtensionTreatment;
   (void) RegisterMagickInfo(entry);
   entry=SetMagickInfo("FRACTAL");
   entry->decoder=(DecoderHandler) ReadPlasmaImage;
   entry->adjoin=False;
   entry->description=AcquireString("Plasma fractal image");
   entry->module=AcquireString("PLASMA");
+  entry->extension_treatment=IgnoreExtensionTreatment;
   (void) RegisterMagickInfo(entry);
 }
 
Index: GraphicsMagick-1.2.5/coders/pnm.c
===================================================================
--- GraphicsMagick-1.2.5.orig/coders/pnm.c
+++ GraphicsMagick-1.2.5/coders/pnm.c
@@ -762,6 +762,7 @@ ModuleExport void RegisterPNMImage(void)
   entry->encoder=(EncoderHandler) WritePNMImage;
   entry->description=AcquireString("Xv thumbnail format");
   entry->module=AcquireString("PNM");
+  entry->extension_treatment=IgnoreExtensionTreatment;
   (void) RegisterMagickInfo(entry);
   entry=SetMagickInfo("PBM");
   entry->decoder=(DecoderHandler) ReadPNMImage;
Index: GraphicsMagick-1.2.5/coders/preview.c
===================================================================
--- GraphicsMagick-1.2.5.orig/coders/preview.c
+++ GraphicsMagick-1.2.5/coders/preview.c
@@ -100,6 +100,7 @@ ModuleExport void RegisterPREVIEWImage(v
   entry->description=
     AcquireString("Show a preview an image enhancement, effect, or f/x");
   entry->module=AcquireString("PREVIEW");
+  entry->extension_treatment=IgnoreExtensionTreatment;
   (void) RegisterMagickInfo(entry);
 }
 
Index: GraphicsMagick-1.2.5/coders/stegano.c
===================================================================
--- GraphicsMagick-1.2.5.orig/coders/stegano.c
+++ GraphicsMagick-1.2.5/coders/stegano.c
@@ -226,6 +226,7 @@ ModuleExport void RegisterSTEGANOImage(v
   entry->decoder=(DecoderHandler) ReadSTEGANOImage;
   entry->description=AcquireString("Steganographic image");
   entry->module=AcquireString("STEGANO");
+  entry->extension_treatment=IgnoreExtensionTreatment;
   (void) RegisterMagickInfo(entry);
 }
 
Index: GraphicsMagick-1.2.5/coders/tiff.c
===================================================================
--- GraphicsMagick-1.2.5.orig/coders/tiff.c
+++ GraphicsMagick-1.2.5/coders/tiff.c
@@ -2706,6 +2706,7 @@ ModuleExport void RegisterTIFFImage(void
   entry->adjoin=False;
   entry->description=AcquireString(BIGTIFFDescription);
   entry->module=AcquireString("TIFF");
+  entry->extension_treatment=IgnoreExtensionTreatment;
   (void) RegisterMagickInfo(entry);
 #endif /* defined(HasBigTIFF) */
 
Index: GraphicsMagick-1.2.5/coders/tile.c
===================================================================
--- GraphicsMagick-1.2.5.orig/coders/tile.c
+++ GraphicsMagick-1.2.5/coders/tile.c
@@ -155,6 +155,7 @@ ModuleExport void RegisterTILEImage(void
   entry->description=AcquireString("Tile image with a texture");
   entry->note=AcquireString(TILENote);
   entry->module=AcquireString("TILE");
+  entry->extension_treatment=IgnoreExtensionTreatment;
   (void) RegisterMagickInfo(entry);
 }
 
Index: GraphicsMagick-1.2.5/coders/vid.c
===================================================================
--- GraphicsMagick-1.2.5.orig/coders/vid.c
+++ GraphicsMagick-1.2.5/coders/vid.c
@@ -253,6 +253,7 @@ ModuleExport void RegisterVIDImage(void)
   entry->encoder=(EncoderHandler) WriteVIDImage;
   entry->description=AcquireString("Visual Image Directory");
   entry->module=AcquireString("VID");
+  entry->extension_treatment=IgnoreExtensionTreatment;
   (void) RegisterMagickInfo(entry);
 }
 
