problems using group4 compression

Mar 21, 2014 at 6:24 PM

In command line I found two ways to convert jpg to pdf with group4 compression:
First ( with two commands ):
$ convert desktop.jpg desktop.pbm
$ convert -monochrome -compress group4 desktop.pbm desktop-mono-grp4-2.pdf

Second ( with one single command and best compression ):
$ convert -thereshold 80% -compress group4 desktop.jpg desktop-mono-grp4-2.pdf

With first the source I try is
using (MagickImage image = new MagickImage(@"C:\Users\DXD\Desktop\compresion\test.jpg"))
            image.Format = ImageMagick.MagickFormat.Pbm;  

        using (MagickImage image = new MagickImage(@"C:\Users\DXD\Desktop\compresion\test4.pbm"))
            image.IsMonochrome = true;
            image.CompressionMethod = CompressionMethod.Group4; 
and with second
using (MagickImage image = new MagickImage(@"C:\Users\DXD\Desktop\compresion\test.jpg"))
            image.CompressionMethod = CompressionMethod.Group4;
In both cases I get this error:
{"Attempted to read or write protected memory. This is often an indication that other memory is corrupt."}

at Magick.Image.write(Image* , basic_string<char\,std::char_traits<char>\,std::allocator<char> > )
at ImageMagick.MagickWriter.Write(Image
image, String fileName)
at ImageMagick.MagickImage.Write(String fileName)

What I'm doing wrong ?
Mar 21, 2014 at 9:10 PM
Edited Mar 21, 2014 at 11:29 PM
You are not doing anything wrong, you are doing it correctly. But you just found a bug in ImageMagick. I will look into it directly!

Edit: Found the bug. I will publish a release this weekend to fix this issue.
Mar 24, 2014 at 3:11 PM
Thanks dlemstra.

If I can help you in our side tell me, I can provide you the file I'm using for testing and the expected results on each conversion process.
Mar 24, 2014 at 4:05 PM
The new release has been published this weekend. Can you download Magick.NET and test if this has resolved your problem?