问题
I am using the ImageResizer .NET component on an IIS hosted .NET web-service to handle resizing images that are stored in Amazon S3.
It works great for everything except animated GIFs (so no problem with JPEG, PNG, standard GIF)
With an animated GIF however the animation is lost and the transparency switches to black.
Doesn't seem to make any difference whether I add an explicit format=gif parameter to the query string.
The output from the resizer.debug page are shown below:
Image resizer diagnostic sheet 12/08/2014 09:36:08
2 Issues detected:
(Warning): To potentially see additional errors here, perform an image resize request.
(Warning): NoCache is only for development usage, and cannot scale to production use.
Add DiskCache or CloudFront for production use
You are using plugins from the Performance Edition: S3Reader2 (Performance Edition), AnimatedGifs (Performance Edition), PrettyGifs (Performance Edition)
Registered plugins:
ImageResizer.Plugins.Basic.DefaultEncoder
ImageResizer.Plugins.Basic.NoCache
ImageResizer.Plugins.Basic.ClientCache
ImageResizer.Plugins.Basic.Diagnostic
ImageResizer.Plugins.Basic.SizeLimiting
ImageResizer.Plugins.S3Reader2.S3Reader2
ImageResizer.Plugins.AnimatedGifs.AnimatedGifs
ImageResizer.Plugins.PrettyGifs.PrettyGifs
ImageResizer.Plugins.Logging.LoggingPlugin
Configuration:
<resizer>
<plugins>
<add name="S3Reader2" vpp="false" buckets="implat.imagr.220triathlon,implat.imagr.babyexpert,implat.imagr.control,implat.imagr.gardenersworld,implat.imagr.golfmagic,implat.imagr.junior,implat.imagr.loveyourhair,implat.imagr.madeformums,implat.imagr.outdoormagic,implat.imagr.outdoorsmagic,implat.imagr.radiotimes,implat.imagr.runnersworld,implat.imagr.test,implat.imagr.visordown,implat.imagr.youandyourwedding" accessKeyId="[redacted]" secretAccessKey="[redacted]" prefix="~/s3/" useSubdomains="true" region="eu-west-1" />
<add name="AnimatedGifs" />
<add name="PrettyGifs" />
<add name="Logging" />
</plugins>
<diagnostics enableFor="Localhost" />
</resizer>
Accepted querystring keys:
quality, format, thumbnail, colors, dither, 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-IIS/8.0 on Microsoft Windows NT 6.1.7601 Service Pack 1 and CLR 4.0.30319.18444
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)\IIS Express\iisexpress.exe
IntegratedPipeline: True
Loaded assemblies:
mscorlib Assembly: 4.0.0.0 File: 4.0.30319.18444 Info: 4.0.30319.18444
System.Web Assembly: 4.0.0.0 File: 4.0.30319.18446 Info: 4.0.30319.18446
System Assembly: 4.0.0.0 File: 4.0.30319.18408 Info: 4.0.30319.18408
System.Core Assembly: 4.0.0.0 File: 4.0.30319.18408 Info: 4.0.30319.18408
System.Web.ApplicationServices Assembly: 4.0.0.0 File: 4.0.30319.18446 Info: 4.0.30319.18446
System.Configuration Assembly: 4.0.0.0 File: 4.0.30319.18408 Info: 4.0.30319.18408
System.Xml Assembly: 4.0.0.0 File: 4.0.30319.18408 Info: 4.0.30319.18408
System.Runtime.Caching Assembly: 4.0.0.0 File: 4.0.30319.18408 Info: 4.0.30319.18408
Microsoft.Build.Utilities.v4.0 Assembly: 4.0.0.0 File: 4.0.30319.18408 Info: 4.0.30319.18408
Microsoft.JScript Assembly: 10.0.0.0 File: 11.0.50938.18408 Info: 11.0.50938.18408
Microsoft.CSharp Assembly: 4.0.0.0 File: 4.0.30319.18408 Info: 4.0.30319.18408
System.Data Assembly: 4.0.0.0 File: 4.0.30319.18408 Info: 4.0.30319.18408
System.Web.Services Assembly: 4.0.0.0 File: 4.0.30319.18408 Info: 4.0.30319.18408
System.Drawing Assembly: 4.0.0.0 File: 4.0.30319.18408 Info: 4.0.30319.18408
System.EnterpriseServices Assembly: 4.0.0.0 File: 4.0.30319.18408 Info: 4.0.30319.18408
System.IdentityModel Assembly: 4.0.0.0 File: 4.0.30319.18408 Info: 4.0.30319.18408
System.Runtime.Serialization Assembly: 4.0.0.0 File: 4.0.30319.18408 Info: 4.0.30319.18408
System.ServiceModel Assembly: 4.0.0.0 File: 4.0.30319.18408 Info: 4.0.30319.18408
System.ServiceModel.Activation Assembly: 4.0.0.0 File: 4.0.30319.18408 Info: 4.0.30319.18408
System.ServiceModel.Web Assembly: 4.0.0.0 File: 4.0.30319.18408 Info: 4.0.30319.18408
System.Activities Assembly: 4.0.0.0 File: 4.0.30319.18408 Info: 4.0.30319.18408
System.ServiceModel.Activities Assembly: 4.0.0.0 File: 4.0.30319.18408 Info: 4.0.30319.18408
System.WorkflowServices Assembly: 4.0.0.0 File: 4.0.30319.18408 Info: 4.0.30319.18408
System.Web.Extensions Assembly: 4.0.0.0 File: 4.0.30319.18408 Info: 4.0.30319.18408
System.Data.DataSetExtensions Assembly: 4.0.0.0 File: 4.0.30319.18408 Info: 4.0.30319.18408
System.Xml.Linq Assembly: 4.0.0.0 File: 4.0.30319.18408 Info: 4.0.30319.18408
System.ComponentModel.DataAnnotations Assembly: 4.0.0.0 File: 4.0.30319.18408 Info: 4.0.30319.18408
System.Web.DynamicData Assembly: 4.0.0.0 File: 4.0.30319.18408 Info: 4.0.30319.18408
AWSSDK Assembly: 2.2.2.0 File: 2.2.2.0
ImageResizer Assembly: 3.4.3.103 File: 3.4.3.103 Info: 3-4-3 Commit: bf92fd7
ImageResizer.Plugins.AnimatedGifs Assembly: 3.4.3.103 File: 3.4.3.103 Info: 3-4-3 Commit: bf92fd7
ImageResizer.Plugins.Logging Assembly: 3.4.3.103 File: 3.4.3.103 Info: 3-4-3 Commit: bf92fd7
ImageResizer.Plugins.PrettyGifs Assembly: 3.4.3.103 File: 3.4.3.103 Info: 3-4-3 Commit: bf92fd7
ImageResizer.Plugins.S3Reader2 Assembly: 3.4.3.103 File: 3.4.3.103 Info: 3-4-3 Commit: bf92fd7
Imagr.Resizer Assembly: 1.0.0.0 File: 1.0.0.0
NLog Assembly: 3.1.0.0
System.Web.WebPages.Deployment Assembly: 2.0.0.0 File: 2.0.20710.0
Microsoft.VisualStudio.Web.PageInspector.Loader Assembly: 1.0.0.0 File: 12.3.50717.0
System.Xaml Assembly: 4.0.0.0 File: 4.0.30319.18408 Info: 4.0.30319.18408
Microsoft.VisualStudio.Web.PageInspector.Runtime Assembly: 12.3.0.0 File: 12.3.50717.0
Microsoft.Web.Infrastructure Assembly: 1.0.0.0 File: 1.0.20105.407
Microsoft.VisualStudio.Web.PageInspector.Tracing Assembly: 12.3.0.0 File: 12.3.50717.0
System.Web.RegularExpressions Assembly: 4.0.0.0 File: 4.0.30319.18408 Info: 4.0.30319.18408
System.Data.Services.Design Assembly: 4.0.0.0 File: 4.0.30319.18408 Info: 4.0.30319.18408
App_global.asax.2z_wgdg2 Assembly: 0.0.0.0
System.Net.Http Assembly: 4.0.0.0 File: 4.0.30319.18408 Info: 4.0.30319.18408
System.Net.Http.WebRequest Assembly: 4.0.0.0 File: 4.0.30319.18408 Info: 4.0.30319.18408
System.ServiceModel.Internals Assembly: 4.0.0.0 File: 4.0.30319.18408 Info: 4.0.30319.18408
SMDiagnostics Assembly: 4.0.0.0 File: 4.0.30319.18408 Info: 4.0.30319.18408
Thanks in advance!
Adrian
来源:https://stackoverflow.com/questions/25261428/resizing-animated-gif-loses-transparency-and-animation