I'm using imageresizer.net in a console app to pull pages out of tiff images, but when the tiff contains pages of differing image types, what imageresizer extracts does not always represent the original page.
I am using the managed API, with this code:
ImageBuilder.Current.Build(sourceImagePath, destinationImagePath, new ResizeSettings("page=[whatever]"));
The TIFF image contains...
The behaviour I am getting is...
I have also used libtiff.net to extract the same images using this method, which does not exhibit the same fault.
Edit - using this code to test with the Wic decoder:
var settings = new ResizeSettings("decoder=wic&page=" + pageNumber);
Config.Current.Plugins.GetOrInstall<WicDecoderPlugin>();
ImageBuilder.Current.Build(sourceImagePath, destImagePath, settings);
This works for page 1 & 4 (no change there), but I get an 'Object reference not set to an instance of an object.' error for page 2 & 3 when using the Wic decoder.
Edit 2 - converted the bit that's failing to an MVC project to get /resizer.debug:
Image resizer diagnostic sheet 29/06/2012 4:08:14 a.m.
4 Issues detected:
(Warning): To potentially see additional errors here, perform an image resize request.
(Warning): You are running a hotfix version of the ImageResizer.
You should upgrade to a released version with an equal or higher version number as soon as possible. Hotfix and release DLLs with the same version number are not the same - the release DLL should be used instead.
Assemblies marked as hotfix versions: ImageResizer, ImageResizer.Mvc
(Warning): NoCache is only for development usage, and cannot scale to production use.
Add DiskCache or CloudFront for production use
(Warning): Potentially incompatible ImageResizer assemblies were detected.
Please make sure all ImageResizer assemblies are from the same version. Compatibility issues are possible if you mix plugins from different releases.
3.2.3 assemblies: ImageResizer, ImageResizer.Mvc
3.2.2 assemblies: ImageResizer.Plugins.Logging, ImageResizer.Plugins.Wic
You are using paid bundles: Design Bundle
Registered plugins:
ImageResizer.Plugins.Basic.DefaultEncoder
ImageResizer.Plugins.Basic.NoCache
ImageResizer.Plugins.Basic.ClientCache
ImageResizer.Plugins.Basic.Diagnostic
ImageResizer.Plugins.Basic.SizeLimiting
ImageResizer.Plugins.MvcRoutingShim.MvcRoutingShimPlugin
ImageResizer.Plugins.WicDecoder.WicDecoderPlugin
ImageResizer.Plugins.Logging.LoggingPlugin
Configuration:
<resizer>
<plugins>
<add name="MvcRoutingShim" />
<add name="WicDecoder" />
<add name="Logging" />
</plugins>
</resizer>
Accepted querystring keys:
quality, format, thumbnail, maxwidth, maxheight, width, height, w, h, scale, stretch, crop, cropxunits, cropyunits, page, bgcolor, rotate, flip, sourceFlip, sFlip, sRotate, borderWidth, borderColor, paddingWidth, paddingColor, ignoreicc, frame, useresizingpipeline, cache, process, margin, anchor, dpi, mode, zoom,
Accepted file extensions:
bmp, gif, exif, png, tif, tiff, tff, jpg, jpeg, jpe, jif, jfif, jfi,
Environment information:
Running Microsoft Windows NT 6.1.7601 Service Pack 1 and CLR 4.0.30319.269
Trust level: Unrestricted
OS bitness: x86 !! Warning, running as 32-bit on a 64-bit OS(AMD64). This will limit ram usage !!
Executing assembly: C:\Program Files (x86)\Common Files\Microsoft Shared\DevServer\10.0\WebDev.WebServer40.exe
IntegratedPipeline: False
Loaded assemblies:
mscorlib Assembly: 4.0.0.0 File: 4.0.30319.269 Info: 4.0.30319.269
System.Web Assembly: 4.0.0.0 File: 4.0.30319.272 Info: 4.0.30319.272
System Assembly: 4.0.0.0 File: 4.0.30319.269 Info: 4.0.30319.269
System.Core Assembly: 4.0.0.0 File: 4.0.30319.233 Info: 4.0.30319.233
System.Configuration Assembly: 4.0.0.0 File: 4.0.30319.1 Info: 4.0.30319.1
System.Xml Assembly: 4.0.0.0 File: 4.0.30319.233 Info: 4.0.30319.233
System.Runtime.Caching Assembly: 4.0.0.0 File: 4.0.30319.237 Info: 4.0.30319.237
Microsoft.Build.Utilities.v4.0 Assembly: 4.0.0.0 File: 4.0.30319.1 Info: 4.0.30319.1
System.Web.RegularExpressions Assembly: 4.0.0.0 File: 4.0.30319.1 Info: 4.0.30319.1
Microsoft.Build.Framework Assembly: 4.0.0.0 File: 4.0.30319.1 Info: 4.0.30319.1
System.Data Assembly: 4.0.0.0 File: 4.0.30319.237 Info: 4.0.30319.237
Microsoft.JScript Assembly: 10.0.0.0 File: 10.0.30319.1 Info: 10.0.30319.1
CppCodeProvider Assembly: 10.0.0.0 File: 10.0.30319.1 Info: 10.0.30319.1
System.Web.WebPages.Deployment Assembly: 1.0.0.0 File: 1.0.20105.407
System.Web.WebPages Assembly: 1.0.0.0 File: 1.0.20105.407
System.Web.Mvc Assembly: 3.0.0.0 File: 3.0.20105.0
Microsoft.Web.Infrastructure Assembly: 1.0.0.0 File: 1.0.20105.407
System.Web.WebPages.Razor Assembly: 1.0.0.0 File: 1.0.20105.407
System.Web.Razor Assembly: 1.0.0.0 File: 1.0.20105.407
App_global.asax.ijrgfwnu Assembly: 0.0.0.0
PNCC.LimDocumentBuilder.ImageResizerTest Assembly: 1.0.0.0 File: 1.0.0.0
WebDev.WebHost40 Assembly: 10.0.0.0 File: 10.0.40219.1 Info: 10.0.40219.1
System.Web.Mobile Assembly: 4.0.0.0 File: 4.0.30319.1 Info: 4.0.30319.1
System.ServiceModel.Activation Assembly: 4.0.0.0 File: 4.0.30319.233 Info: 4.0.30319.233
System.ServiceModel Assembly: 4.0.0.0 File: 4.0.30319.233 Info: 4.0.30319.233
System.Runtime.DurableInstancing Assembly: 4.0.0.0 File: 4.0.30319.1 Info: 4.0.30319.1
SMDiagnostics Assembly: 4.0.0.0 File: 4.0.30319.1 Info: 4.0.30319.1
System.Xaml.Hosting Assembly: 4.0.0.0 File: 4.0.30319.1 Info: 4.0.30319.1
System.Web.Extensions Assembly: 4.0.0.0 File: 4.0.30319.272 Info: 4.0.30319.272
Microsoft.CSharp Assembly: 4.0.0.0 File: 4.0.30319.1 Info: 4.0.30319.1
System.Web.Services Assembly: 4.0.0.0 File: 4.0.30319.1 Info: 4.0.30319.1
System.Drawing Assembly: 4.0.0.0 File: 4.0.30319.282 Info: 4.0.30319.282
System.EnterpriseServices Assembly: 4.0.0.0 File: 4.0.30319.1 Info: 4.0.30319.1
System.IdentityModel Assembly: 4.0.0.0 File: 4.0.30319.1 Info: 4.0.30319.1
System.Runtime.Serialization Assembly: 4.0.0.0 File: 4.0.30319.1 Info: 4.0.30319.1
System.ServiceModel.Web Assembly: 4.0.0.0 File: 4.0.30319.233 Info: 4.0.30319.233
System.Activities Assembly: 4.0.0.0 File: 4.0.30319.1 Info: 4.0.30319.1
System.ServiceModel.Activities Assembly: 4.0.0.0 File: 4.0.30319.1 Info: 4.0.30319.1
System.WorkflowServices Assembly: 4.0.0.0 File: 4.0.30319.1 Info: 4.0.30319.1
System.Data.DataSetExtensions Assembly: 4.0.0.0 File: 4.0.30319.1 Info: 4.0.30319.1
System.Xml.Linq Assembly: 4.0.0.0 File: 4.0.30319.1 Info: 4.0.30319.1
System.ComponentModel.DataAnnotations Assembly: 4.0.0.0 File: 4.0.30319.1 Info: 4.0.30319.1
System.Web.DynamicData Assembly: 4.0.0.0 File: 4.0.30319.1 Info: 4.0.30319.1
System.Web.ApplicationServices Assembly: 4.0.0.0 File: 4.0.30319.1 Info: 4.0.30319.1
EntityFramework Assembly: 4.1.0.0 File: 4.1.10331.0 Info: 4.1.10331.0
ImageResizer Assembly: 3.2.3.766 File: 3.2.3.766 Info: 3-2-beta-3-temp-hotfix-jun-27-2012-9am Commit: a0f4f1e
ImageResizer.Mvc Assembly: 3.2.3.766 File: 3.2.3.766 Info: 3-2-beta-3-temp-hotfix-jun-27-2012-9am Commit: a0f4f1e
ImageResizer.Plugins.Logging Assembly: 3.2.2.0 File: 3.2.2.0 Info: 3-2-beta-2 Commit: 3704dd6
ImageResizer.Plugins.Wic Assembly: 3.2.2.0 File: 3.2.2.0 Info: 3-2-beta-2 Commit: 3704dd6
NLog Assembly: 2.0.0.0
System.Web.Abstractions Assembly: 4.0.0.0 File: 4.0.30319.1 Info: 4.0.30319.1
System.Web.Helpers Assembly: 1.0.0.0 File: 1.0.20105.407
System.Web.Routing Assembly: 4.0.0.0 File: 4.0.30319.1 Info: 4.0.30319.1
The FreeImageDecoder plugin now supports multi-page TIFF files, and uses libtiff internally. This is the suggested way to deal with very complex/rare .TIFF files.
The TIFF format is extremely complex and poorly standardized. Most libraries (like GDI+ (System.Drawing) and WIC (WPF)) only implement a fraction of the standard, let alone the de-facto features and additions.
To get this level of .TIFF support, you need to use a library dedicated to .TIFF support such as libtiff or libtiff.net.
ImageResizer does integrate with LibTiff via FreeImage and the FreeImageDecoder plugin, but multi-page support hasn't been implemented yet.
You're not up a creek without a paddle - there are many ways to solve your dilemma:
There are already 4 example implementations of decoders: ImageBuilder.DecodeStream, PsdReader, WicDecoder, FreeImageDeocoder, and PdfRenderer. The source code for them is included in the download. The average decoder requires less than 80 lines of code.