GraphicsMagick: coders/wpg.c Fixed Monochromatic bilevel WPG sho...

GraphicsMagick Commits <[email protected]>
Newsgroups gmane.comp.video.graphicsmagick.cvs
Message-ID <mailman.333.1673427066.1727.graphicsmagick-commit@lists.sourceforge.net>
changeset 1d0fd7d1152c in /hg/GraphicsMagick
details: http://hg.GraphicsMagick.org/hg/GraphicsMagick?cmd=changeset;node=1d0fd7d1152c
summary: coders/wpg.c Fixed Monochromatic bilevel WPG should answer to gm identify file.wpg ..... PseudoClass 2c 8-bit

diffstat:

 ChangeLog    |   5 +++++
 coders/wpg.c |  10 +++++++++-
 2 files changed, 14 insertions(+), 1 deletions(-)

diffs (32 lines):

diff -r d2698b7e3232 -r 1d0fd7d1152c ChangeLog
--- a/ChangeLog	Mon Jan 09 08:23:29 2023 -0600
+++ b/ChangeLog	Wed Jan 11 09:50:33 2023 +0100
@@ -1,3 +1,8 @@
+2023-01-11  Fojtik Jaroslav  <[email protected]>
+
+	* coders/wpg.c Fixed Monochromatic bilevel WPG should answer to 
+	gm identify file.wpg ..... PseudoClass 2c 8-bit
+
 2023-01-08  Fojtik Jaroslav  <[email protected]>
 
 	* coders/wpg.c Fixed deffect in WPG header reading.
diff -r d2698b7e3232 -r 1d0fd7d1152c coders/wpg.c
--- a/coders/wpg.c	Mon Jan 09 08:23:29 2023 -0600
+++ b/coders/wpg.c	Wed Jan 11 09:50:33 2023 +0100
@@ -1339,7 +1339,15 @@
               image->rows=BitmapHeader1.Heigth;
               bpp=BitmapHeader1.Depth;
 				// Whole palette is useless for bilevel image.
-              if(bpp==1) image->storage_class=DirectClass;
+              if(bpp==1)
+              {
+                image->storage_class = PseudoClass;
+                image->colors = 2;
+                if (!AllocateImageColormap(image,2)) goto NoMemory;
+                image->colormap[0].red = image->colormap[0].green = image->colormap[0].blue = 0;
+                image->colormap[1].red = image->colormap[1].green = image->colormap[1].blue = MaxRGB;
+                image->colormap[0].opacity = image->colormap[1].opacity = OpaqueOpacity;
+              }
               goto UnpackRaster;
 
             case 0x0E:  /*Color palette */
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.