Page 1 of 1

How to read Multipage-TIFFs? (MagickMissingDelegateErrorException)

Posted: 2018-08-09T09:49:33-07:00
by hans.hauer
Hi!

I hope someone can help me! I try to read Multipage-TIFFs but I get this error:

Code: Select all

ImageMagick.MagickMissingDelegateErrorException: no decode delegate for this image format `' @ error/blob.c/CustomStreamToImage/770
   bei ImageMagick.MagickImageCollection.NativeMagickImageCollection.ReadStream(MagickSettings settings, ReadWriteStreamDelegate reader, SeekStreamDelegate seeker, TellStreamDelegate teller)
   bei ImageMagick.MagickImageCollection.AddImages(Stream stream, MagickReadSettings readSettings, Boolean ping)
   bei ImageMagick.MagickImageCollection.AddRange(Stream stream)
   bei ***.cs:Zeile 184.
My code:

Code: Select all

                            // Try To Read Multipage-TIFF
                            using (MagickImageCollection tiffImageCollection = new MagickImageCollection())
                            {
                                tiffImageCollection.AddRange(att.ContentStream);

                                foreach (var img in tiffImageCollection)
                                {
                                    // Add binarized Image to Collection                                    
                                    img.Depth = 1;
                                    img.Settings.Compression = Compression.Fax;
                                    collection.Add(img);
                                }
                                
                                [...]
                                
                            }
With this code I am able to read the first page, but I need all of them:

Code: Select all

                   var img = new MagickImage(att.ContentStream);
                   img.Depth = 1;
                   img.Settings.Compression = Compression.Fax;
                   collection.Add(img);

Re: How to read Multipage-TIFFs? (MagickMissingDelegateErrorException)

Posted: 2018-08-10T04:17:42-07:00
by hans.hauer
Sorry, beginner's mistake... I used two times att.ContentStream, so the stream was empty :lol: Everything is fine.