This project has moved. For the latest updates, please go here.

problems using group4 compression

Mar 21, 2014 at 7:24 PM
Hi,

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;  
            image.Write(@"C:\Users\DXD\Desktop\compresion\test4.pbm");
        }

        using (MagickImage image = new MagickImage(@"C:\Users\DXD\Desktop\compresion\test4.pbm"))
        {
            image.IsMonochrome = true;
            image.CompressionMethod = CompressionMethod.Group4; 
            image.Write(@"C:\Users\DXD\Desktop\compresion\testpdf4.pdf");
        }
and with second
using (MagickImage image = new MagickImage(@"C:\Users\DXD\Desktop\compresion\test.jpg"))
        {
            image.Threshold(80);
            image.CompressionMethod = CompressionMethod.Group4;
            image.Write(@"C:\Users\DXD\Desktop\compresion\test10.pdf");
        }
In both cases I get this error:
System.AccessViolationException
{"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 ?
Coordinator
Mar 21, 2014 at 10:10 PM
Edited Mar 22, 2014 at 12:29 AM
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 4: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.
Coordinator
Mar 24, 2014 at 5:05 PM
The new release has been published this weekend. Can you download Magick.NET 6.8.8.901 and test if this has resolved your problem?