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"))
using (MagickImage image = new MagickImage(@"C:\Users\DXD\Desktop\compresion\test.jpg"))
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 ?
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 secondusing (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 ?