我在控制台应用程序中使用 imageresizer.net 从 tiff 图像中提取页面,但是当 tiff 包含不同图像类型的页面时,imageresizer 提取的内容并不总是代表原始页面。
我正在使用托管 API,代码如下:
ImageBuilder.Current.Build(sourceImagePath, destinationImagePath, new ResizeSettings("page=[whatever]"));
TIFF 图像包含...
- 第 1 页,图像类型“Bilevel(白色为零)”,压缩“Group 3”,大小“485kb”。
- 第 2 页,图像类型“YCbCr(2,1 二次采样)”,压缩“JPEG(旧式)”,大小“11MB”。
- 第 3 页,图像类型“YCbCr(2,1 二次采样)”,压缩“JPEG(旧式)”,大小“11MB”。
- 第 4 页,图像类型“灰度(256 灰度,黑色为零)”,压缩“JPEG(旧式)”,大小“4MB”。
我得到的行为是......
- 提取第 1 页工作正常。
- 提取第 2 页最终会提取第 1 页的图像。
- 提取第 3 页最终提取了第 1 页的图像,但在图像左侧压缩成约 1 厘米宽的带,剩余图像为黑色。
- 提取第 4 页工作正常。
我还使用 libtiff.net 使用这种方法提取了相同的图像,它没有表现出相同的错误。
编辑 - 使用此代码测试 Wic 解码器:
var settings = new ResizeSettings("decoder=wic&page=" + pageNumber);
Config.Current.Plugins.GetOrInstall<WicDecoderPlugin>();
ImageBuilder.Current.Build(sourceImagePath, destImagePath, settings);
这适用于第 1 页和第 4 页(那里没有变化),但我得到一个“对象引用未设置为对象的实例”。使用 Wic 解码器时,第 2 页和第 3 页出现错误。
编辑 2 - 将失败的位转换为 MVC 项目以获取 /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