This project has moved. For the latest updates, please go here.

Converting 2 pages TIF Files to jpg

Mar 14, 2014 at 9:03 AM
Edited Mar 14, 2014 at 11:21 AM
Hi, I am having an error when converting/reading 2 pages .tif files. But no problem when converting/reading normal(single paged) .tif files. What is the right approach for this?

Here's the error
ImageMagick.MagickCoderErrorException: Magick: C:\DigitalAssets\Saucisses Expo 008.tif: Null count for "Tag 33426" (type 4, writecount -3, passcount 1). `_TIFFVSetField' @ error/tiff.c/TIFFErrors/561
   at ImageMagick.MagickImage.HandleReadException(MagickException exception)
   at ImageMagick.MagickImage.Read(String fileName, MagickReadSettings readSettings)
   at Digital_Asset_Converter_Service.Service.EPSFolderWatcher_Created(Object sender, FileSystemEventArgs e)
and the code: (I just provided the code for reading the file but it still gives an error.)
 MagickReadSettings settings = new MagickReadSettings();
                settings.ColorSpace = ColorSpace.RGB;
                settings.FrameIndex = 0; 
               
               

              string fileName = @"C:\DigitalAssets\Saucisses Expo 008.tif";
                    try
                    {
                        using (MagickImageCollection image = new MagickImageCollection())
                        {                       
                                image.Read(fileName,settings);
                        }
                    }
Coordinator
Mar 14, 2014 at 11:10 AM
It looks like your image is corrupt. But it is also possible there is a bug in the tiff reader that is being used by ImageMagick. Can you post a link to your image? Feel free to contact me through Codeplex if you don't want to publicly share your image.
Mar 14, 2014 at 11:19 AM
Hi dlemstra thank you for your response. I sent you a message.
Coordinator
Mar 17, 2014 at 9:22 PM
Edited Mar 17, 2014 at 9:22 PM
Thank you for the image. Your image contains a corrupt tiff tag that causes a MagickCoderErrorException. We made a change to ImageMagick that will allow you to ignore a specific tiff tag. Below is an example that will prevent the MagickCoderErrorException:
using (MagickImage image = new MagickImage())
{
  image.SetDefine(MagickFormat.Tiff, "ignore-tags", "33426");
  // Or if you want to ignore multiple tags:
  image.SetDefine(MagickFormat.Tiff, "ignore-tags", "33426,33428");
  image.Read("Saucisses-Expo-008.tif");
}
Apr 8, 2014 at 1:52 AM
Hi dlemstra,

Thanks for the new release. I'm gonna try it now. Thanks again.
Apr 8, 2014 at 2:03 AM
workstation22 wrote:
Hi dlemstra,

Thanks for the new release. I'm gonna try it now. Thanks again.
It worked! Thank you so much dlmenstra!