Bug for RGBO image

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
koshiji

Bug for RGBO image

Post by koshiji »

I found bug for RGBO image @ line, plane and prtition interlace.

this is patch for 6.4.5-8

Code: Select all

--- coders/rgb.c.orig   2008-11-12 10:58:15.000000000 +0900
+++ coders/rgb.c        2008-11-19 11:32:06.000000000 +0900
@@ -178,7 +178,10 @@
       image->matte=MagickTrue;
     }
   if (LocaleCompare(image_info->magick,"RGBO") == 0)
-    quantum_type=RGBOQuantum;
+    {
+      quantum_type=RGBOQuantum;
+      image->matte=MagickTrue;
+    }
   if (image_info->number_scenes != 0)
     while (image->scene < image_info->scene)
     {

Code: Select all

--- magick/quantum-export.c.orig        2008-11-19 10:34:24.000000000 +0900
+++ magick/quantum-export.c     2008-11-19 10:38:50.000000000 +0900
@@ -1341,6 +1341,90 @@
       }
       break;
     }
+    case OpacityQuantum:
+    {
+      switch (quantum_info->depth)
+      {
+        case 8:
+        {
+          register unsigned char
+            pixel;
+
+          for (x=0; x < (long) number_pixels; x++)
+          {
+            pixel=ScaleQuantumToChar(p->opacity);
+            q=PopCharPixel(pixel,q);
+            p++;
+            q+=quantum_info->pad;
+          }
+          break;
+        }
+        case 16:
+        {
+          register unsigned short
+            pixel;
+
+          for (x=0; x < (long) number_pixels; x++)
+          {
+            pixel=ScaleQuantumToShort(p->opacity);
+            q=PopShortPixel(endian,pixel,q);
+            p++;
+            q+=quantum_info->pad;
+          }
+          break;
+        }
+        case 32:
+        {
+          register unsigned long
+            pixel;
+
+          if (quantum_info->format == FloatingPointQuantumFormat)
+            {
+              for (x=0; x < (long) number_pixels; x++)
+              {
+                q=PopFloatPixel(&quantum_state,(float) p->opacity,q);
+                p++;
+                q+=quantum_info->pad;
+              }
+              break;
+            }
+          for (x=0; x < (long) number_pixels; x++)
+          {
+            pixel=ScaleQuantumToLong(p->opacity);
+            q=PopLongPixel(endian,pixel,q);
+            p++;
+            q+=quantum_info->pad;
+          }
+          break;
+        }
+        case 64:
+        {
+          if (quantum_info->format == FloatingPointQuantumFormat)
+            {
+              for (x=0; x < (long) number_pixels; x++)
+              {
+                q=PopDoublePixel(&quantum_state,(double) p->opacity,q);
+                p++;
+                q+=quantum_info->pad;
+              }
+              break;
+            }
+        }
+        default:
+        {
+          scale=GetQuantumScale(image->depth);
+          for (x=0; x < (long) number_pixels; x++)
+          {
+            q=PopQuantumPixel(&quantum_state,image->depth,ScaleQuantumToAny(
+              p->opacity,image->depth,scale),q);
+            p++;
+            q+=quantum_info->pad;
+          }
+          break;
+        }
+      }
+      break;
+    }
     case BlackQuantum:
     {
       if (image->colorspace != CMYKColorspace)
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Bug for RGBO image

Post by magick »

We committed your patch to the ImageMagick Subversion repository. Thanks.
koshiji

Re: Bug for RGBO image

Post by koshiji »

I'm sorry.
The above-mentioned patches were able to correspond only to writing RGBO Images.
To read RGBO Images, the following patch is needed.

Code: Select all

--- magick/quantum-import.c.orig        2008-11-25 15:42:01.000000000 +0900
+++ magick/quantum-import.c     2008-11-25 15:49:44.000000000 +0900
@@ -1535,6 +1535,98 @@
       }
       break;
     }
+    case OpacityQuantum:
+    {
+      switch (quantum_info->depth)
+      {
+        case 8:
+        {
+          unsigned char
+            pixel;
+
+          for (x=0; x < (long) number_pixels; x++)
+          {
+            p=PushCharPixel(p,&pixel);
+            q->opacity=ScaleCharToQuantum(pixel);
+            p+=quantum_info->pad;
+            q++;
+          }
+          break;
+        }
+        case 16:
+        {
+          unsigned short
+            pixel;
+
+          for (x=0; x < (long) number_pixels; x++)
+          {
+            p=PushShortPixel(endian,p,&pixel);
+            q->opacity=ScaleShortToQuantum(pixel);
+            p+=quantum_info->pad;
+            q++;
+          }
+          break;
+        }
+        case 32:
+        {
+          unsigned long
+            pixel;
+
+          if (quantum_info->format == FloatingPointQuantumFormat)
+            {
+              float
+                pixel;
+
+              for (x=0; x < (long) number_pixels; x++)
+              {
+                p=PushFloatPixel(&quantum_state,p,&pixel);
+                q->opacity=RoundToQuantum(pixel);
+                p+=quantum_info->pad;
+                q++;
+              }
+              break;
+            }
+          for (x=0; x < (long) number_pixels; x++)
+          {
+            p=PushLongPixel(endian,p,&pixel);
+            q->opacity=ScaleLongToQuantum(pixel);
+            p+=quantum_info->pad;
+            q++;
+          }
+          break;
+        }
+        case 64:
+        {
+          if (quantum_info->format == FloatingPointQuantumFormat)
+            {
+              double
+                pixel;
+
+              for (x=0; x < (long) number_pixels; x++)
+              {
+                p=PushDoublePixel(&quantum_state,p,&pixel);
+                q->opacity=RoundToQuantum(pixel);
+                p+=quantum_info->pad;
+                q++;
+              }
+              break;
+            }
+        }
+        default:
+        {
+          scale=GetQuantumScale(image->depth);
+          for (x=0; x < (long) number_pixels; x++)
+          {
+            p=PushQuantumPixel(&quantum_state,image->depth,p,&pixel);
+            q->opacity=ScaleAnyToQuantum(pixel,image->depth,scale);
+            p+=quantum_info->pad;
+            q++;
+          }
+          break;
+        }
+      }
+      break;
+    }
     case BlackQuantum:
     {
       if (image->colorspace != CMYKColorspace)
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Bug for RGBO image

Post by magick »

Thanks. We'll get your patch into the Subversion repository by sometime tomorrow.
Post Reply