Page 1 of 1

various kinds of color plane order of RGB raw image

Posted: 2008-11-27T04:30:10-07:00
by koshiji
Could you adopt the attached patch to rgb.c as formal
functionality in the next update, which supports various
kinds of color plane order of RGB raw image?
This work was motivated by a request to have G.B,R order
RGB raw file.

Code: Select all

--- ImageMagick-6.4.6/coders/rgb.c.gbr  2008-11-22 11:36:53.000000000 +0900
+++ ImageMagick-6.4.6/coders/rgb.c      2008-11-25 15:04:16.000000000 +0900
@@ -120,11 +120,15 @@
 
   register long
     i,
+    j,
     x;
 
   register PixelPacket
     *q;
 
+  Quantum
+    qx[3];
+
   ssize_t
     count;
 
@@ -134,6 +138,15 @@
   unsigned char
     *pixels;
 
+  QuantumType
+    quantum_types[4];
+
+  char
+    sfx[] = {0, 0};
+
+  int
+    channels = 3;
+
   /*
     Open image file.
   */
@@ -178,11 +191,13 @@
     {
       quantum_type=RGBAQuantum;
       image->matte=MagickTrue;
+      channels=4;
     }
   if (LocaleCompare(image_info->magick,"RGBO") == 0)
     {
       quantum_type=RGBOQuantum;
       image->matte=MagickTrue;
+      channels=4;
     }
   if (image_info->number_scenes != 0)
     while (image->scene < image_info->scene)
@@ -199,6 +214,17 @@
           break;
       }
     }
+  for (i=0; i < channels; i++)
+  {
+    switch(image_info->magick[i])
+    {
+      case 'R': quantum_types[i]=RedQuantum;     break;
+      case 'G': quantum_types[i]=GreenQuantum;   break;
+      case 'B': quantum_types[i]=BlueQuantum;    break;
+      case 'A': quantum_types[i]=AlphaQuantum;   break;
+      case 'O': quantum_types[i]=OpacityQuantum; break;
+    }
+  }
   count=0;
   length=0;
   scene=0;
@@ -247,9 +273,17 @@
                 break;
               for (x=0; x < (long) image->columns; x++)
               {
-                q->red=p->red;
-                q->green=p->green;
-                q->blue=p->blue;
+                qx[0]=p->red;
+                qx[1]=p->green;
+                qx[2]=p->blue;
+                for (i=0; i < 3; i++)
+                  switch(quantum_types[i])
+                  {
+                    case RedQuantum:   q->red=qx[i];   break;
+                    case GreenQuantum: q->green=qx[i]; break;
+                    case BlueQuantum:  q->blue=qx[i];  break;
+                    default:                           break;
+                  }
                 if (image->matte != MagickFalse)
                   q->opacity=p->opacity;
                 p++;
@@ -272,36 +306,26 @@
       }
       case LineInterlace:
       {
-        static QuantumType
-          quantum_types[4] =
-          {
-            RedQuantum,
-            GreenQuantum,
-            BlueQuantum,
-            OpacityQuantum
-          };
-
         /*
           Line interlacing:  RRR...GGG...BBB...RRR...GGG...BBB...
         */
         if (scene == 0)
           {
-            length=GetQuantumExtent(canvas_image,quantum_info,RedQuantum);
+            length=GetQuantumExtent(canvas_image,quantum_info,quantum_types[0]);
             count=ReadBlob(image,length,pixels);
             if (count != (ssize_t) length)
               break;
           }
         for (y=0; y < (long) image->extract_info.height; y++)
         {
-          for (i=0; i < (image->matte != MagickFalse ? 4 : 3); i++)
+          for (i=0; i < channels; i++)
           {
-            quantum_type=quantum_types[i];
             q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1,
               exception);
             if (q == (PixelPacket *) NULL)
               break;
             length=ImportQuantumPixels(canvas_image,(ViewInfo *) NULL,
-              quantum_info,quantum_type,pixels,exception);
+              quantum_info,quantum_types[i],pixels,exception);
             if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
               break;
             if (((y-image->extract_info.y) >= 0) && 
@@ -314,19 +338,16 @@
                 if ((p == (const PixelPacket *) NULL) ||
                     (q == (PixelPacket *) NULL))
                   break;
-                for (x=0; x < (long) image->columns; x++)
-                {
-                  switch (quantum_type)
+                if (i == (channels - 1))
+                  for (x=0; x < (long) image->columns; x++)
                   {
-                    case RedQuantum: q->red=p->red; break;
-                    case GreenQuantum: q->green=p->green; break;
-                    case BlueQuantum: q->blue=p->blue; break;
-                    case OpacityQuantum: q->opacity=p->opacity; break;
-                    default: break;
+                    q->red=p->red;
+                    q->green=p->green;
+                    q->blue=p->blue;
+                    q->opacity=p->opacity;
+                    p++;
+                    q++;
                   }
-                  p++;
-                  q++;
-                }
                 if (SyncAuthenticPixels(image,exception) == MagickFalse)
                   break;
               }
@@ -350,171 +371,61 @@
         */
         if (scene == 0)
           {
-            length=GetQuantumExtent(canvas_image,quantum_info,RedQuantum);
+            length=GetQuantumExtent(canvas_image,quantum_info,quantum_types[0]);
             count=ReadBlob(image,length,pixels);
             if (count != (ssize_t) length)
               break;
           }
-        for (y=0; y < (long) image->extract_info.height; y++)
+        for (i=0; i < channels; i++)
         {
-          q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1,
-            exception);
-          if (q == (PixelPacket *) NULL)
-            break;
-          length=ImportQuantumPixels(canvas_image,(ViewInfo *) NULL,
-            quantum_info,RedQuantum,pixels,exception);
-          if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
-            break;
-          if (((y-image->extract_info.y) >= 0) && 
-              ((y-image->extract_info.y) < (long) image->rows))
-            {
-              p=GetVirtualPixels(canvas_image,canvas_image->extract_info.x,0,
-                canvas_image->columns,1,exception);
-              q=GetAuthenticPixels(image,0,y-image->extract_info.y,
-                image->columns,1,exception);
-              if ((p == (const PixelPacket *) NULL) ||
-                  (q == (PixelPacket *) NULL))
-                break;
-              for (x=0; x < (long) image->columns; x++)
-              {
-                q->red=p->red;
-                p++;
-                q++;
-              }
-              if (SyncAuthenticPixels(image,exception) == MagickFalse)
-                break;
-            }
-          count=ReadBlob(image,length,pixels);
-          if (count != (ssize_t) length)
-            break;
-        }
-        if (image->previous == (Image *) NULL)
+          for (y=0; y < (long) image->extract_info.height; y++)
           {
-            status=SetImageProgress(image,LoadImageTag,1,5);
-            if (status == MagickFalse)
+            q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1,
+              exception);
+            if (q == (PixelPacket *) NULL)
               break;
-          }
-        for (y=0; y < (long) image->extract_info.height; y++)
-        {
-          q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1,
-            exception);
-          if (q == (PixelPacket *) NULL)
-            break;
-          length=ImportQuantumPixels(canvas_image,(ViewInfo *) NULL,
-            quantum_info,GreenQuantum,pixels,exception);
-          if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
-            break;
-          if (((y-image->extract_info.y) >= 0) && 
-              ((y-image->extract_info.y) < (long) image->rows))
-            {
-              p=GetVirtualPixels(canvas_image,canvas_image->extract_info.x,0,
-                canvas_image->columns,1,exception);
-              q=GetAuthenticPixels(image,0,y-image->extract_info.y,
-                image->columns,1,exception);
-              if ((p == (const PixelPacket *) NULL) ||
-                  (q == (PixelPacket *) NULL))
-                break;
-              for (x=0; x < (long) image->columns; x++)
-              {
-                q->green=p->green;
-                p++;
-                q++;
-              }
-              if (SyncAuthenticPixels(image,exception) == MagickFalse)
-                break;
-           }
-          count=ReadBlob(image,length,pixels);
-          if (count != (ssize_t) length)
-            break;
-        }
-        if (image->previous == (Image *) NULL)
-          {
-            status=SetImageProgress(image,LoadImageTag,2,5);
-            if (status == MagickFalse)
+            length=ImportQuantumPixels(canvas_image,(ViewInfo *) NULL,
+              quantum_info,quantum_types[i],pixels,exception);
+            if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
               break;
-          }
-        for (y=0; y < (long) image->extract_info.height; y++)
-        {
-          q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1,
-            exception);
-          if (q == (PixelPacket *) NULL)
-            break;
-          length=ImportQuantumPixels(canvas_image,(ViewInfo *) NULL,
-            quantum_info,BlueQuantum,pixels,exception);
-          if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
-            break;
-          if (((y-image->extract_info.y) >= 0) && 
-              ((y-image->extract_info.y) < (long) image->rows))
-            {
-              p=GetVirtualPixels(canvas_image,canvas_image->extract_info.x,0,
-                canvas_image->columns,1,exception);
-              q=GetAuthenticPixels(image,0,y-image->extract_info.y,
-                image->columns,1,exception);
-              if ((p == (const PixelPacket *) NULL) ||
-                  (q == (PixelPacket *) NULL))
-                break;
-              for (x=0; x < (long) image->columns; x++)
+            if (((y-image->extract_info.y) >= 0) && 
+                ((y-image->extract_info.y) < (long) image->rows))
               {
-                q->blue=p->blue;
-                p++;
-                q++;
-              }
-              if (SyncAuthenticPixels(image,exception) == MagickFalse)
-                break;
-            }
-          count=ReadBlob(image,length,pixels);
-          if (count != (ssize_t) length)
-            break;
-        }
-        if (image->previous == (Image *) NULL)
-          {
-            status=SetImageProgress(image,LoadImageTag,3,5);
-            if (status == MagickFalse)
-              break;
-          }
-        if (image->matte != MagickFalse)
-          {
-            for (y=0; y < (long) image->extract_info.height; y++)
-            {
-              q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1,
-                exception);
-              if (q == (PixelPacket *) NULL)
-                break;
-              length=ImportQuantumPixels(canvas_image,(ViewInfo *) NULL,
-                quantum_info,AlphaQuantum,pixels,exception);
-              if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
-                break;
-              if (((y-image->extract_info.y) >= 0) && 
-                  ((y-image->extract_info.y) < (long) image->rows))
+                p=GetVirtualPixels(canvas_image,canvas_image->extract_info.x,0,
+                  canvas_image->columns,1,exception);
+                q=GetAuthenticPixels(image,0,y-image->extract_info.y,
+                  image->columns,1,exception);
+                if ((p == (const PixelPacket *) NULL) ||
+                    (q == (PixelPacket *) NULL))
+                  break;
+                for (x=0; x < (long) image->columns; x++)
                 {
-                  p=GetVirtualPixels(canvas_image,
-                    canvas_image->extract_info.x,0,canvas_image->columns,1,
-                    exception);
-                  q=GetAuthenticPixels(image,0,y-image->extract_info.y,
-                    image->columns,1,exception);
-                  if ((p == (const PixelPacket *) NULL) ||
-                      (q == (PixelPacket *) NULL))
-                    break;
-                  for (x=0; x < (long) image->columns; x++)
+                  switch(quantum_types[i])
                   {
-                    q->opacity=p->opacity;
-                    p++;
-                    q++;
+                    case RedQuantum:    q->red=p->red;         break;
+                    case GreenQuantum:  q->green=p->green;     break;
+                    case BlueQuantum:   q->blue=p->blue;       break;
+                    case OpacityQuantum:
+                    case AlphaQuantum:  q->opacity=p->opacity; break;
+                    default:                                   break;
                   }
-                  if (SyncAuthenticPixels(image,exception) == MagickFalse)
-                    break;
+                  p++;
+                  q++;
                 }
-              count=ReadBlob(image,length,pixels);
-              if (count != (ssize_t) length)
-                break;
-            }
-            if (image->previous == (Image *) NULL)
-              {
-                status=SetImageProgress(image,LoadImageTag,4,5);
-                if (status == MagickFalse)
+                if (SyncAuthenticPixels(image,exception) == MagickFalse)
                   break;
               }
+            count=ReadBlob(image,length,pixels);
+            if (count != (ssize_t) length)
+              break;
           }
+          if (image->previous == (Image *) NULL)
+            {
+              status=SetImageProgress(image,LoadImageTag,(i+1),5);
+              if (status == MagickFalse)
+                break;
+            }
+        }
         if (image->previous == (Image *) NULL)
           {
             status=SetImageProgress(image,LoadImageTag,5,5);
@@ -528,256 +439,87 @@
         /*
           Partition interlacing:  RRRRRR..., GGGGGG..., BBBBBB...
         */
-        AppendImageFormat("R",image->filename);
-        status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
-        if (status == MagickFalse)
-          {
-            canvas_image=DestroyImageList(canvas_image);
-            image=DestroyImageList(image);
-            return((Image *) NULL);
-          }
-        for (i=0; i < image->offset; i++)
-          if (ReadBlobByte(image) == EOF)
-            {
-              ThrowFileException(exception,CorruptImageError,
-                "UnexpectedEndOfFile",image->filename);
-              break;
-            }
-        length=GetQuantumExtent(canvas_image,quantum_info,RedQuantum);
-        for (i=0; i < (long) scene; i++)
-          for (y=0; y < (long) image->extract_info.height; y++)
-            if (ReadBlob(image,length,pixels) != (ssize_t) length)
-              {
-                ThrowFileException(exception,CorruptImageError,
-                  "UnexpectedEndOfFile",image->filename);
-                break;
-              }
-        count=ReadBlob(image,length,pixels);
-        if (count != (ssize_t) length)
-          break;
-        for (y=0; y < (long) image->extract_info.height; y++)
-        {
-          q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1,
-            exception);
-          if (q == (PixelPacket *) NULL)
-            break;
-          length=ImportQuantumPixels(canvas_image,(ViewInfo *) NULL,
-            quantum_info,RedQuantum,pixels,exception);
-          if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
-            break;
-          if (((y-image->extract_info.y) >= 0) && 
-              ((y-image->extract_info.y) < (long) image->rows))
-            {
-              p=GetVirtualPixels(canvas_image,canvas_image->extract_info.x,0,
-                canvas_image->columns,1,exception);
-              q=GetAuthenticPixels(image,0,y-image->extract_info.y,
-                image->columns,1,exception);
-              if ((p == (const PixelPacket *) NULL) ||
-                  (q == (PixelPacket *) NULL))
-                break;
-              for (x=0; x < (long) image->columns; x++)
-              {
-                q->red=p->red;
-                p++;
-                q++;
-              }
-              if (SyncAuthenticPixels(image,exception) == MagickFalse)
-                break;
-            }
-          count=ReadBlob(image,length,pixels);
-          if (count != (ssize_t) length)
-            break;
-        }
-        if (image->previous == (Image *) NULL)
-          {
-            status=SetImageProgress(image,LoadImageTag,1,5);
-            if (status == MagickFalse)
-              break;
-          }
-        (void) CloseBlob(image);
-        AppendImageFormat("G",image->filename);
-        status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
-        if (status == MagickFalse)
-          {
-            canvas_image=DestroyImageList(canvas_image);
-            image=DestroyImageList(image);
-            return((Image *) NULL);
-          }
-        length=GetQuantumExtent(canvas_image,quantum_info,GreenQuantum);
-        for (i=0; i < (long) scene; i++)
-          for (y=0; y < (long) image->extract_info.height; y++)
-            if (ReadBlob(image,length,pixels) != (ssize_t) length)
-              {
-                ThrowFileException(exception,CorruptImageError,
-                  "UnexpectedEndOfFile",image->filename);
-                break;
-              }
-        count=ReadBlob(image,length,pixels);
-        if (count != (ssize_t) length)
-          break;
-        for (y=0; y < (long) image->extract_info.height; y++)
+        for(i=0; i < channels; i++)
         {
-          q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1,
-            exception);
-          if (q == (PixelPacket *) NULL)
-            break;
-          length=ImportQuantumPixels(canvas_image,(ViewInfo *) NULL,
-            quantum_info,GreenQuantum,pixels,exception);
-          if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
-            break;
-          if (((y-image->extract_info.y) >= 0) && 
-              ((y-image->extract_info.y) < (long) image->rows))
-            {
-              p=GetVirtualPixels(canvas_image,canvas_image->extract_info.x,0,
-                canvas_image->columns,1,exception);
-              q=GetAuthenticPixels(image,0,y-image->extract_info.y,
-                image->columns,1,exception);
-              if ((p == (const PixelPacket *) NULL) ||
-                  (q == (PixelPacket *) NULL))
-                break;
-              for (x=0; x < (long) image->columns; x++)
-              {
-                q->green=p->green;
-                p++;
-                q++;
-              }
-              if (SyncAuthenticPixels(image,exception) == MagickFalse)
-                break;
-           }
-          count=ReadBlob(image,length,pixels);
-          if (count != (ssize_t) length)
-            break;
-        }
-        if (image->previous == (Image *) NULL)
-          {
-            status=SetImageProgress(image,LoadImageTag,2,5);
-            if (status == MagickFalse)
-              break;
-          }
-        (void) CloseBlob(image);
-        AppendImageFormat("B",image->filename);
-        status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
-        if (status == MagickFalse)
-          {
-            canvas_image=DestroyImageList(canvas_image);
-            image=DestroyImageList(image);
-            return((Image *) NULL);
-          }
-        length=GetQuantumExtent(canvas_image,quantum_info,BlueQuantum);
-        for (i=0; i < (long) scene; i++)
-          for (y=0; y < (long) image->extract_info.height; y++)
-            if (ReadBlob(image,length,pixels) != (ssize_t) length)
-              {
-                ThrowFileException(exception,CorruptImageError,
-                  "UnexpectedEndOfFile",image->filename);
-                break;
-              }
-        count=ReadBlob(image,length,pixels);
-        if (count != (ssize_t) length)
-          break;
-        for (y=0; y < (long) image->extract_info.height; y++)
-        {
-          q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1,
-            exception);
-          if (q == (PixelPacket *) NULL)
-            break;
-          length=ImportQuantumPixels(canvas_image,(ViewInfo *) NULL,
-            quantum_info,BlueQuantum,pixels,exception);
-          if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
-            break;
-          if (((y-image->extract_info.y) >= 0) && 
-              ((y-image->extract_info.y) < (long) image->rows))
-            {
-              p=GetVirtualPixels(canvas_image,canvas_image->extract_info.x,0,
-                canvas_image->columns,1,exception);
-              q=GetAuthenticPixels(image,0,y-image->extract_info.y,
-                image->columns,1,exception);
-              if ((p == (const PixelPacket *) NULL) ||
-                  (q == (PixelPacket *) NULL))
-                break;
-              for (x=0; x < (long) image->columns; x++)
-              {
-                q->blue=p->blue;
-                p++;
-                q++;
-              }
-              if (SyncAuthenticPixels(image,exception) == MagickFalse)
-                break;
-           }
+          sfx[0]=image_info->magick[i];
+          AppendImageFormat(sfx,image->filename);
+          status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
+          if (status == MagickFalse)
+            {
+              canvas_image=DestroyImageList(canvas_image);
+              image=DestroyImageList(image);
+              return((Image *) NULL);
+            }
+          if (i == 0)
+            for (j=0; j < image->offset; j++)
+              if (ReadBlobByte(image) == EOF)
+                {
+                  ThrowFileException(exception,CorruptImageError,
+                    "UnexpectedEndOfFile",image->filename);
+                  break;
+                }
+          length=GetQuantumExtent(canvas_image,quantum_info,quantum_types[i]);
+          for (j=0; j < (long) scene; j++)
+            for (y=0; y < (long) image->extract_info.height; y++)
+              if (ReadBlob(image,length,pixels) != (ssize_t) length)
+                {
+                  ThrowFileException(exception,CorruptImageError,
+                    "UnexpectedEndOfFile",image->filename);
+                  break;
+                }
           count=ReadBlob(image,length,pixels);
           if (count != (ssize_t) length)
             break;
-        }
-        if (image->previous == (Image *) NULL)
+          for (y=0; y < (long) image->extract_info.height; y++)
           {
-            status=SetImageProgress(image,LoadImageTag,3,5);
-            if (status == MagickFalse)
+            q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1,
+              exception);
+            if (q == (PixelPacket *) NULL)
               break;
-          }
-        if (image->matte != MagickFalse)
-          {
-            (void) CloseBlob(image);
-            AppendImageFormat("A",image->filename);
-            status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
-            if (status == MagickFalse)
+            length=ImportQuantumPixels(canvas_image,(ViewInfo *) NULL,
+              quantum_info,quantum_types[i],pixels,exception);
+            if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
+              break;
+            if (((y-image->extract_info.y) >= 0) && 
+                ((y-image->extract_info.y) < (long) image->rows))
               {
-                canvas_image=DestroyImageList(canvas_image);
-                image=DestroyImageList(image);
-                return((Image *) NULL);
-              }
-            length=GetQuantumExtent(canvas_image,quantum_info,AlphaQuantum);
-            for (i=0; i < (long) scene; i++)
-              for (y=0; y < (long) image->extract_info.height; y++)
-                if (ReadBlob(image,length,pixels) != (ssize_t) length)
+                p=GetVirtualPixels(canvas_image,canvas_image->extract_info.x,0,
+                  canvas_image->columns,1,exception);
+                q=GetAuthenticPixels(image,0,y-image->extract_info.y,
+                  image->columns,1,exception);
+                if ((p == (const PixelPacket *) NULL) ||
+                    (q == (PixelPacket *) NULL))
+                  break;
+                for (x=0; x < (long) image->columns; x++)
+                {
+                  switch(quantum_types[i])
                   {
-                    ThrowFileException(exception,CorruptImageError,
-                      "UnexpectedEndOfFile",image->filename);
-                    break;
+                    case RedQuantum:    q->red=p->red;         break;
+                    case GreenQuantum:  q->green=p->green;     break;
+                    case BlueQuantum:   q->blue=p->blue;       break;
+                    case OpacityQuantum:
+                    case AlphaQuantum:  q->opacity=p->opacity; break;
+                    default:                                   break;
                   }
+                  p++;
+                  q++;
+                }
+                if (SyncAuthenticPixels(image,exception) == MagickFalse)
+                  break;
+              }
             count=ReadBlob(image,length,pixels);
             if (count != (ssize_t) length)
               break;
-            for (y=0; y < (long) image->extract_info.height; y++)
+          }
+          if (image->previous == (Image *) NULL)
             {
-              q=GetAuthenticPixels(canvas_image,0,0,canvas_image->columns,1,
-                exception);
-              if (q == (PixelPacket *) NULL)
-                break;
-              length=ImportQuantumPixels(canvas_image,(ViewInfo *) NULL,
-                quantum_info,BlueQuantum,pixels,exception);
-              if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
-                break;
-              if (((y-image->extract_info.y) >= 0) && 
-                  ((y-image->extract_info.y) < (long) image->rows))
-                {
-                  p=GetVirtualPixels(canvas_image,
-                    canvas_image->extract_info.x,0,canvas_image->columns,1,
-                    exception);
-                  q=GetAuthenticPixels(image,0,y-image->extract_info.y,
-                    image->columns,1,exception);
-                  if ((p == (const PixelPacket *) NULL) ||
-                      (q == (PixelPacket *) NULL))
-                    break;
-                  for (x=0; x < (long) image->columns; x++)
-                  {
-                    q->opacity=p->opacity;
-                    p++;
-                    q++;
-                  }
-                  if (SyncAuthenticPixels(image,exception) == MagickFalse)
-                    break;
-               }
-              count=ReadBlob(image,length,pixels);
-              if (count != (ssize_t) length)
+              status=SetImageProgress(image,LoadImageTag,(i+1),5);
+              if (status == MagickFalse)
                 break;
             }
-            if (image->previous == (Image *) NULL)
-              {
-                status=SetImageProgress(image,LoadImageTag,4,5);
-                if (status == MagickFalse)
-                  break;
-              }
-          }
+          if(i != (channels-1))
+            (void) CloseBlob(image);
+        }
         if (image->previous == (Image *) NULL)
           {
             status=SetImageProgress(image,LoadImageTag,5,5);
@@ -857,6 +599,51 @@
   entry->description=ConstantString("Raw red, green, and blue samples");
   entry->module=ConstantString("RGB");
   (void) RegisterMagickInfo(entry);
+  entry=SetMagickInfo("RBG");
+  entry->decoder=(DecodeImageHandler *) ReadRGBImage;
+  entry->encoder=(EncodeImageHandler *) WriteRGBImage;
+  entry->raw=MagickTrue;
+  entry->endian_support=MagickTrue;
+  entry->format_type=ExplicitFormatType;
+  entry->description=ConstantString("Raw red, blue, and green samples");
+  entry->module=ConstantString("RGB");
+  (void) RegisterMagickInfo(entry);
+  entry=SetMagickInfo("GRB");
+  entry->decoder=(DecodeImageHandler *) ReadRGBImage;
+  entry->encoder=(EncodeImageHandler *) WriteRGBImage;
+  entry->raw=MagickTrue;
+  entry->endian_support=MagickTrue;
+  entry->format_type=ExplicitFormatType;
+  entry->description=ConstantString("Raw green, red, and blue samples");
+  entry->module=ConstantString("RGB");
+  (void) RegisterMagickInfo(entry);
+  entry=SetMagickInfo("GBR");
+  entry->decoder=(DecodeImageHandler *) ReadRGBImage;
+  entry->encoder=(EncodeImageHandler *) WriteRGBImage;
+  entry->raw=MagickTrue;
+  entry->endian_support=MagickTrue;
+  entry->format_type=ExplicitFormatType;
+  entry->description=ConstantString("Raw green, blue, and red samples");
+  entry->module=ConstantString("RGB");
+  (void) RegisterMagickInfo(entry);
+  entry=SetMagickInfo("BRG");
+  entry->decoder=(DecodeImageHandler *) ReadRGBImage;
+  entry->encoder=(EncodeImageHandler *) WriteRGBImage;
+  entry->raw=MagickTrue;
+  entry->endian_support=MagickTrue;
+  entry->format_type=ExplicitFormatType;
+  entry->description=ConstantString("Raw blue, red, and green samples");
+  entry->module=ConstantString("RGB");
+  (void) RegisterMagickInfo(entry);
+  entry=SetMagickInfo("BGR");
+  entry->decoder=(DecodeImageHandler *) ReadRGBImage;
+  entry->encoder=(EncodeImageHandler *) WriteRGBImage;
+  entry->raw=MagickTrue;
+  entry->endian_support=MagickTrue;
+  entry->format_type=ExplicitFormatType;
+  entry->description=ConstantString("Raw blue, green, and red samples");
+  entry->module=ConstantString("RGB");
+  (void) RegisterMagickInfo(entry);
   entry=SetMagickInfo("RGBA");
   entry->decoder=(DecodeImageHandler *) ReadRGBImage;
   entry->encoder=(EncodeImageHandler *) WriteRGBImage;
@@ -902,6 +689,11 @@
 {
   (void) UnregisterMagickInfo("RGBO");
   (void) UnregisterMagickInfo("RGBA");
+  (void) UnregisterMagickInfo("BGR");
+  (void) UnregisterMagickInfo("BRG");
+  (void) UnregisterMagickInfo("GBR");
+  (void) UnregisterMagickInfo("GRB");
+  (void) UnregisterMagickInfo("RBG");
   (void) UnregisterMagickInfo("RGB");
 }
 

@@ -950,6 +742,13 @@
   register const PixelPacket
     *p;
 
+  register long
+    i,
+    x;
+
+  register PixelPacket
+    *q;
+
   ssize_t
     count;
 
@@ -959,6 +758,21 @@
   unsigned char
     *pixels;
 
+  QuantumType
+    quantum_types[4];
+
+  Quantum
+    *qx[3];
+
+  char
+    sfx[] = {0, 0};
+
+  int
+    channels = 3;
+
+  ExceptionInfo
+    exception;
+
   /*
     Allocate memory for pixels.
   */
@@ -982,12 +796,25 @@
     {
       quantum_type=RGBAQuantum;
       image->matte=MagickTrue;
+      channels=4;
     }
   if (LocaleCompare(image_info->magick,"RGBO") == 0)
     {
       quantum_type=RGBOQuantum;
       image->matte=MagickTrue;
+      channels=4;
+    }
+  for (i=0; i < channels; i++)
+  {
+    switch(image_info->magick[i])
+    {
+      case 'R': quantum_types[i]=RedQuantum;     break;
+      case 'G': quantum_types[i]=GreenQuantum;   break;
+      case 'B': quantum_types[i]=BlueQuantum;    break;
+      case 'A': quantum_types[i]=AlphaQuantum;   break;
+      case 'O': quantum_types[i]=OpacityQuantum; break;
     }
+  }
   scene=0;
   do
   {
@@ -1001,7 +828,7 @@
       (void) SetImageAlphaChannel(image,ResetAlphaChannel);
     quantum_info=AcquireQuantumInfo(image_info,image);
     if (quantum_info == (QuantumInfo *) NULL)
-      ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
+      ThrowWriterExeption(ResourceLimitError,"MemoryAllocationFailed");
     pixels=GetQuantumPixels(quantum_info);
     switch (image_info->interlace)
     {
@@ -1011,11 +838,32 @@
         /*
           No interlacing:  RGBRGBRGBRGBRGBRGB...
         */
+        register PixelPacket
+          px;
+
         for (y=0; y < (long) image->rows; y++)
         {
           p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);
-          if (p == (const PixelPacket *) NULL)
-            break;
+          q=QueueAuthenticPixels(image,0,y,image->columns,1,&exception);
+          if ((p == (const PixelPacket *) NULL) ||
+              (q == (PixelPacket *) NULL))
+            break;
+          for (x=0; x < (long)image->columns; x++)
+          {
+            px=*q;
+            qx[0]=&(q->red);
+            qx[1]=&(q->green);
+            qx[2]=&(q->blue);
+            for(i=0; i < 3; i++)
+              switch(quantum_types[i])
+              {
+                case RedQuantum:   *qx[i]=px.red;   break;
+                case GreenQuantum: *qx[i]=px.green; break;
+                case BlueQuantum:  *qx[i]=px.blue;  break;
+                default:                            break;
+              }
+            q++;
+          }
           length=ExportQuantumPixels(image,(const ViewInfo *) NULL,quantum_info,
             quantum_type,pixels,&image->exception);
           count=WriteBlob(image,length,pixels);
@@ -1040,37 +888,14 @@
           p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);
           if (p == (const PixelPacket *) NULL)
             break;
-          length=ExportQuantumPixels(image,(const ViewInfo *) NULL,quantum_info,
-            RedQuantum,pixels,&image->exception);
-          count=WriteBlob(image,length,pixels);
-          if (count != (ssize_t) length)
-            break;
-          length=ExportQuantumPixels(image,(const ViewInfo *) NULL,quantum_info,
-            GreenQuantum,pixels,&image->exception);
-          count=WriteBlob(image,length,pixels);
-          if (count != (ssize_t) length)
-            break;
-          length=ExportQuantumPixels(image,(const ViewInfo *) NULL,quantum_info,
-            BlueQuantum,pixels,&image->exception);
-          count=WriteBlob(image,length,pixels);
-          if (count != (ssize_t) length)
-            break;
-          if (quantum_type == RGBAQuantum)
-            {
-              length=ExportQuantumPixels(image,(const ViewInfo *) NULL,
-                quantum_info,AlphaQuantum,pixels,&image->exception);
-              count=WriteBlob(image,length,pixels);
-              if (count != (ssize_t) length)
-                break;
-            }
-          if (quantum_type == RGBOQuantum)
-            {
-              length=ExportQuantumPixels(image,(const ViewInfo *) NULL,
-                quantum_info,OpacityQuantum,pixels,&image->exception);
-              count=WriteBlob(image,length,pixels);
-              if (count != (ssize_t) length)
-                break;
-            }
+          for (i=0; i < channels; i++)
+          {
+            length=ExportQuantumPixels(image,(const ViewInfo *) NULL,quantum_info,
+              quantum_types[i],pixels,&image->exception);
+            count=WriteBlob(image,length,pixels);
+            if (count != (ssize_t) length)
+              break;
+          }
           if (image->previous == (Image *) NULL)
             {
               status=SetImageProgress(image,SaveImageTag,y,image->rows);
@@ -1085,96 +910,26 @@
         /*
           Plane interlacing:  RRRRRR...GGGGGG...BBBBBB...
         */
-        for (y=0; y < (long) image->rows; y++)
-        {
-          p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);
-          if (p == (const PixelPacket *) NULL)
-            break;
-          length=ExportQuantumPixels(image,(const ViewInfo *) NULL,quantum_info,
-            RedQuantum,pixels,&image->exception);
-          count=WriteBlob(image,length,pixels);
-          if (count != (ssize_t) length)
-            break;
-        }
-        if (image->previous == (Image *) NULL)
-          {
-            status=SetImageProgress(image,SaveImageTag,1,5);
-            if (status == MagickFalse)
-              break;
-          }
-        for (y=0; y < (long) image->rows; y++)
-        {
-          p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);
-          if (p == (const PixelPacket *) NULL)
-            break;
-          length=ExportQuantumPixels(image,(const ViewInfo *) NULL,quantum_info,
-            GreenQuantum,pixels,&image->exception);
-          count=WriteBlob(image,length,pixels);
-          if (count != (ssize_t) length)
-            break;
-        }
-        if (image->previous == (Image *) NULL)
-          {
-            status=SetImageProgress(image,SaveImageTag,2,5);
-            if (status == MagickFalse)
-              break;
-          }
-        for (y=0; y < (long) image->rows; y++)
+        for (i=0; i < channels; i++)
         {
-          p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);
-          if (p == (const PixelPacket *) NULL)
-            break;
-          length=ExportQuantumPixels(image,(const ViewInfo *) NULL,quantum_info,
-            BlueQuantum,pixels,&image->exception);
-          count=WriteBlob(image,length,pixels);
-          if (count != (ssize_t) length)
-            break;
-        }
-        if (image->previous == (Image *) NULL)
+          for (y=0; y < (long) image->rows; y++)
           {
-            status=SetImageProgress(image,SaveImageTag,3,5);
-            if (status == MagickFalse)
+            p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);
+            if (p == (const PixelPacket *) NULL)
               break;
-          }
-        if (quantum_type == RGBAQuantum)
-          {
-            for (y=0; y < (long) image->rows; y++)
-            {
-              p=GetVirtualPixels(image,0,y,image->columns,1,
-                &image->exception);
-              if (p == (const PixelPacket *) NULL)
-                break;
-              length=ExportQuantumPixels(image,(const ViewInfo *) NULL,
-                quantum_info,AlphaQuantum,pixels,&image->exception);
-              count=WriteBlob(image,length,pixels);
-              if (count != (ssize_t) length)
+            length=ExportQuantumPixels(image,(const ViewInfo *) NULL,quantum_info,
+              quantum_types[i],pixels,&image->exception);
+            count=WriteBlob(image,length,pixels);
+            if (count != (ssize_t) length)
               break;
-            }
           }
-        if (quantum_type == RGBOQuantum)
-          {
-            if (image->previous == (Image *) NULL)
-              {
-                status=SetImageProgress(image,SaveImageTag,4,5);
-                if (status == MagickFalse)
-                  break;
-              }
-            for (y=0; y < (long) image->rows; y++)
+          if (image->previous == (Image *) NULL)
             {
-              p=GetVirtualPixels(image,0,y,image->columns,1,
-                &image->exception);
-              if (p == (const PixelPacket *) NULL)
+              status=SetImageProgress(image,SaveImageTag,(i+1),5);
+              if (status == MagickFalse)
                 break;
-              length=ExportQuantumPixels(image,(const ViewInfo *) NULL,
-                quantum_info,OpacityQuantum,pixels,&image->exception);
-              count=WriteBlob(image,length,pixels);
-              if (count != (ssize_t) length)
-              break;
             }
-          }
-        if (image_info->interlace == PartitionInterlace)
-          (void) CopyMagickString(image->filename,image_info->filename,
-            MaxTextExtent);
+        }
         if (image->previous == (Image *) NULL)
           {
             status=SetImageProgress(image,SaveImageTag,5,5);
@@ -1188,135 +943,33 @@
         /*
           Partition interlacing:  RRRRRR..., GGGGGG..., BBBBBB...
         */
-        AppendImageFormat("R",image->filename);
-        status=OpenBlob(image_info,image,scene == 0 ? WriteBinaryBlobMode :
-          AppendBinaryBlobMode,&image->exception);
-        if (status == MagickFalse)
-          return(status);
-        for (y=0; y < (long) image->rows; y++)
-        {
-          p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);
-          if (p == (const PixelPacket *) NULL)
-            break;
-          length=ExportQuantumPixels(image,(const ViewInfo *) NULL,quantum_info,
-            RedQuantum,pixels,&image->exception);
-          count=WriteBlob(image,length,pixels);
-          if (count != (ssize_t) length)
-            break;
-        }
-        if (image->previous == (Image *) NULL)
-          {
-            status=SetImageProgress(image,SaveImageTag,1,5);
-            if (status == MagickFalse)
-              break;
-          }
-        (void) CloseBlob(image);
-        AppendImageFormat("G",image->filename);
-        status=OpenBlob(image_info,image,scene == 0 ? WriteBinaryBlobMode :
-          AppendBinaryBlobMode,&image->exception);
-        if (status == MagickFalse)
-          return(status);
-        for (y=0; y < (long) image->rows; y++)
-        {
-          p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);
-          if (p == (const PixelPacket *) NULL)
-            break;
-          length=ExportQuantumPixels(image,(const ViewInfo *) NULL,quantum_info,
-            GreenQuantum,pixels,&image->exception);
-          count=WriteBlob(image,length,pixels);
-          if (count != (ssize_t) length)
-            break;
-        }
-        if (image->previous == (Image *) NULL)
-          {
-            status=SetImageProgress(image,SaveImageTag,2,5);
-            if (status == MagickFalse)
-              break;
-          }
-        (void) CloseBlob(image);
-        AppendImageFormat("B",image->filename);
-        status=OpenBlob(image_info,image,scene == 0 ? WriteBinaryBlobMode :
-          AppendBinaryBlobMode,&image->exception);
-        if (status == MagickFalse)
-          return(status);
-        for (y=0; y < (long) image->rows; y++)
+        for (i=0; i < channels; i++)
         {
-          p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);
-          if (p == (const PixelPacket *) NULL)
-            break;
-          length=ExportQuantumPixels(image,(const ViewInfo *) NULL,quantum_info,
-            BlueQuantum,pixels,&image->exception);
-          count=WriteBlob(image,length,pixels);
-          if (count != (ssize_t) length)
-            break;
-        }
-        if (image->previous == (Image *) NULL)
-          {
-            status=SetImageProgress(image,SaveImageTag,3,5);
-            if (status == MagickFalse)
+          sfx[0]=image_info->magick[i];
+          AppendImageFormat(sfx,image->filename);
+          status=OpenBlob(image_info,image,scene == 0 ? WriteBinaryBlobMode :
+            AppendBinaryBlobMode,&image->exception);
+          if (status == MagickFalse)
+            return(status);
+          for (y=0; y < (long) image->rows; y++)
+          {
+            p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);
+            if (p == (const PixelPacket *) NULL)
+              break;
+            length=ExportQuantumPixels(image,(const ViewInfo *) NULL,quantum_info,
+              quantum_types[i],pixels,&image->exception);
+            count=WriteBlob(image,length,pixels);
+            if (count != (ssize_t) length)
               break;
           }
-        if (quantum_type == RGBAQuantum)
-          {
-            (void) CloseBlob(image);
-            AppendImageFormat("A",image->filename);
-            status=OpenBlob(image_info,image,scene == 0 ? WriteBinaryBlobMode :
-              AppendBinaryBlobMode,&image->exception);
-            if (status == MagickFalse)
-              return(status);
-            for (y=0; y < (long) image->rows; y++)
-            {
-              p=GetVirtualPixels(image,0,y,image->columns,1,
-                &image->exception);
-              if (p == (const PixelPacket *) NULL)
-                break;
-              length=ExportQuantumPixels(image,(const ViewInfo *) NULL,
-                quantum_info,AlphaQuantum,pixels,&image->exception);
-              count=WriteBlob(image,length,pixels);
-              if (count != (ssize_t) length)
-                break;
-            }
-            if (image->previous == (Image *) NULL)
-              {
-                status=SetImageProgress(image,SaveImageTag,4,5);
-                if (status == MagickFalse)
-                  break;
-              }
-          }
-        if (quantum_type == RGBOQuantum)
-          {
-            if (image->previous == (Image *) NULL)
-              {
-                status=SetImageProgress(image,SaveImageTag,4,5);
-                if (status == MagickFalse)
-                  break;
-              }
-            (void) CloseBlob(image);
-            AppendImageFormat("O",image->filename);
-            status=OpenBlob(image_info,image,scene == 0 ? WriteBinaryBlobMode :
-              AppendBinaryBlobMode,&image->exception);
-            if (status == MagickFalse)
-              return(status);
-            for (y=0; y < (long) image->rows; y++)
+          if (image->previous == (Image *) NULL)
             {
-              p=GetVirtualPixels(image,0,y,image->columns,1,
-                &image->exception);
-              if (p == (const PixelPacket *) NULL)
-                break;
-              length=ExportQuantumPixels(image,(const ViewInfo *) NULL,
-                quantum_info,OpacityQuantum,pixels,&image->exception);
-              count=WriteBlob(image,length,pixels);
-              if (count != (ssize_t) length)
+              status=SetImageProgress(image,SaveImageTag,(i+1),5);
+              if (status == MagickFalse)
                 break;
             }
-            if (image->previous == (Image *) NULL)
-              {
-                status=SetImageProgress(image,SaveImageTag,4,5);
-                if (status == MagickFalse)
-                  break;
-              }
-          }
-        (void) CloseBlob(image);
+          (void) CloseBlob(image);
+        }
         (void) CopyMagickString(image->filename,image_info->filename,
           MaxTextExtent);
         if (image->previous == (Image *) NULL)
--- ImageMagick-6.4.6/config/coder.xml.gbr      2008-10-04 22:17:10.000000000 +0900
+++ ImageMagick-6.4.6/config/coder.xml  2008-11-20 19:27:53.000000000 +0900
@@ -19,6 +19,8 @@
   <coder magick="BMP3" name="BMP"/>
   <coder magick="B" name="RAW"/>
   <coder magick="BRF" name="BRAILLE"/>
+  <coder magick="BGR" name="RGB"/>
+  <coder magick="BRG" name="RGB"/>
   <coder magick="CMYKA" name="CMYK"/>
   <coder magick="C" name="RAW"/>
   <coder magick="CR2" name="DNG"/>
@@ -44,6 +46,8 @@
   <coder magick="G3" name="FAX"/>
   <coder magick="GIF87" name="GIF"/>
   <coder magick="G" name="RAW"/>
+  <coder magick="GBR" name="RGB"/>
+  <coder magick="GRB" name="RGB"/>
   <coder magick="GRANITE" name="MAGICK"/>
   <coder magick="H" name="MAGICK"/>
   <coder magick="HTM" name="HTML"/>
@@ -103,6 +107,7 @@
   <coder magick="RADIAL-GRADIENT" name="GRADIENT"/>
   <coder magick="RAF" name="DNG"/>
   <coder magick="RAS" name="SUN"/>
+  <coder magick="RBG" name="RGB"/>
   <coder magick="RGBA" name="RGB"/>
   <coder magick="RGBO" name="RGB"/>
   <coder magick="R" name="RAW"/>

Re: various kinds of color plane order of RGB raw image

Posted: 2008-11-27T07:19:55-07:00
by magick
Your patch is malformed:
File to patch: coders/rgb.c
patching file coders/rgb.c
Hunk #6 succeeded at 306 with fuzz 1.
Hunk #8 FAILED at 371.
Hunk #9 FAILED at 439.
patch: **** malformed patch at line 743: {
Post a URL for a proper patch or a URL for the updated source module, rgb.c. Thanks.

Re: various kinds of color plane order of RGB raw image

Posted: 2008-11-27T18:33:00-07:00
by koshiji
Sorry. I have no WebPages that has been opened to the public.

this is rgb.c after it applies patch.
source is compressed by Gzip. and encoded with Base64

this confirms the operation in ImageMagick-6.4.6-3

Code: Select all

H4sICHtDL0kAA3JnYi5jAO1de3PbuBH/39MPgbpzqZTIsp3rzfSc6jqWY6tqnThnOXdzk8lkaAmS
kFAkw4ctNc137y4WJAES1MOWnTgR73KxCWCxwL5+AIG93cdbP6z32fqBrfN54PTO4cG/O/Aw1obn
l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VM/I+zlPy3ihHrpEHVlbJPrHqOXSz
D/LqmwV+3yG27zmdrt5GdlD+oK5XWSVB713k5lWEjYO7t0pNqx2TkHmN/SQOkvSIRJreWCpGejZi
4bF/afCFc//27+3SMBYfB1BLNaqlGuKZgE02z1txtMkgeY8ZJBekijzyvStwMuxF9+QEQQfCDIIX
mlssH8aSB2PV/+oFrR2aHWUvUgMq5AXOK6hjPWaj/LDVigbEHj3KLNZMVFWw6wq+5OQfkRamnHGI
4/p7xd0K6Yn1E06rZSZW9y+kN7tFbuIVshM/iCyaldiFnoAQDj0r5dE1D8NZjuKTTuzl6Sfyk+3V
4UWqy4IMghZ61ffUbnBIfunj8fZbL4Uj8SazpRPxnwyKwbSFmFJ/RVkBH9XoLHu9VLivCuXGbLn4
qSrGDdtCqXE10Z4RcMlT+Z8Kv1tP4z+WKfhawbSpDuNXnCK3HMHPm6rz9/Oamufu86bq1H1F02VO
vy9xgLxwqt1yc472vUzXQqqtlLR0Pci4D2T2Zsl8Ot+26IA7Qb67vgN25yfae84VfUL5urLcfKHk
fF+J98aZXuRzl/Ciq2bKuwPrKi6/88t382dgdSt7UPdIvlKru+/cUmvNtGSxzxI0WKON3sBK5115
3Rjd/RrdN5ITxBjTd5YTZDXX8QWTguTp89g/mWWrkJlXUomDpXcTV5CzbVdRm86NY904Vpt0vyrH
utKd17SqH8zUdws6N1Uw54buFbKXWpcvnOkFn8aUp6Vwse8b8+3035WvBd74Sqh+3RXLF17aXHLS
5IVNdYEyFWVHtUGap9KQzLuaC6c0Y/az8T/8UprjDN77wit+/NLOnMy5CZl/v5DHT/4PcEJRVMmH
AAA=

Re: various kinds of color plane order of RGB raw image

Posted: 2008-11-27T18:47:17-07:00
by magick
Your patch will be available sometime tomorrow the Subversion trunk and next point release of ImageMagick. Thanks.

Re: various kinds of color plane order of RGB raw image

Posted: 2008-11-29T01:50:06-07:00
by koshiji
I checked Subversion's code.

Here, the application of the following patches to recognize a new format seems to
have come off.

Code: Select all

--- ImageMagick-6.4.6/config/coder.xml.gbr      2008-10-04 22:17:10.000000000 +0900
+++ ImageMagick-6.4.6/config/coder.xml  2008-11-20 19:27:53.000000000 +0900
@@ -19,6 +19,8 @@
   <coder magick="BMP3" name="BMP"/>
   <coder magick="B" name="RAW"/>
   <coder magick="BRF" name="BRAILLE"/>
+  <coder magick="BGR" name="RGB"/>
+  <coder magick="BRG" name="RGB"/>
   <coder magick="CMYKA" name="CMYK"/>
   <coder magick="C" name="RAW"/>
   <coder magick="CR2" name="DNG"/>
@@ -44,6 +46,8 @@
   <coder magick="G3" name="FAX"/>
   <coder magick="GIF87" name="GIF"/>
   <coder magick="G" name="RAW"/>
+  <coder magick="GBR" name="RGB"/>
+  <coder magick="GRB" name="RGB"/>
   <coder magick="GRANITE" name="MAGICK"/>
   <coder magick="H" name="MAGICK"/>
   <coder magick="HTM" name="HTML"/>
@@ -103,6 +107,7 @@
   <coder magick="RADIAL-GRADIENT" name="GRADIENT"/>
   <coder magick="RAF" name="DNG"/>
   <coder magick="RAS" name="SUN"/>
+  <coder magick="RBG" name="RGB"/>
   <coder magick="RGBA" name="RGB"/>
   <coder magick="RGBO" name="RGB"/>
   <coder magick="R" name="RAW"/>