Quantcast
Channel: magick Discussions Rss Feed
Viewing all articles
Browse latest Browse all 3693

New Post: problems using group4 compression

$
0
0
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 ?

Viewing all articles
Browse latest Browse all 3693

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>