How to read Multipage-TIFFs? (MagickMissingDelegateErrorException)

Magick.NET is an object-oriented C# interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning Magick.NET
Post Reply
hans.hauer
Posts: 2
Joined: 2018-08-09T09:40:33-07:00
Authentication code: 1152

How to read Multipage-TIFFs? (MagickMissingDelegateErrorException)

Post 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);
Last edited by hans.hauer on 2018-08-10T04:18:54-07:00, edited 1 time in total.
hans.hauer
Posts: 2
Joined: 2018-08-09T09:40:33-07:00
Authentication code: 1152

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

Post by hans.hauer »

Sorry, beginner's mistake... I used two times att.ContentStream, so the stream was empty :lol: Everything is fine.
Post Reply