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

New Post: How to read CCITTFaxDecode Group 4 image

$
0
0
Hi,
I'm using nuget package Magick.Net-Q16-AnyCPU version 7.0.1.500 to read an image.
The image is a CCITTFaxDecode Group 4 image.

My basic code looks like this:
```
                org.pdfclown.bytes.IBuffer ibuf = args.xImage.BaseDataObject.GetBody(false);
                byte[] bytes = ibuf.GetByteArray(0, (int)ibuf.Length);
` int w = (int)args.xImage.Size.Width, h = (int) args.xImage.Size.Height;
                            MagickReadSettings readSettings = new MagickReadSettings();
                            readSettings.CompressionMethod = CompressionMethod.Group4;
                            readSettings.Format = MagickFormat.Fax;
                            readSettings.Width = w;
                            readSettings.Height = h;
                            using (MagickImage image = new MagickImage(bytes, readSettings))
                            {
                                image.Format = MagickFormat.Png;
                                // Write the image to the memorystream
                                image.Write(string.Format("img{0},png", args.pageNo));
                            }`
I'm not sure if I'm setting the readSettings correctly.
With the code as shown I get the error:
Unexpected end-of-file '': No such file or directory @ error/fax.c/ReadFAXImage/189
If I remove the line setting the read format, I get the error
no decode delegate for this image format
' @ error/blob.c/BlobToImage/355

The image is embedded in a pdf document which I'm reading with pdfclown. The pdf renders fine with adobe.

Any suggestions much appreciated.
Martin

Viewing all articles
Browse latest Browse all 3693

Trending Articles



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