Imageprocessor: Unable to process some images after 2.3 > 2.4 upgrade

Created on 24 Jun 2016  路  10Comments  路  Source: JimBobSquarePants/ImageProcessor

Ver: 2.3.3.0 -> 2.4.1
4.5.3.0 -> 4.6.1.0
Prev version worked fine, after upgrade I get this:

http://localhost/media/technoparks/res/1085.jpg?width=240&upscale=false
[ArgumentException: Property cannot be found.]
   System.Drawing.Image.GetPropertyItem(Int32 propid) +475825
   ImageProcessor.Imaging.Formats.GifDecoder.GetFrame(Image image, Int32 index) +118
   ImageProcessor.Imaging.Formats.GifFormat.ApplyProcessor(Func`2 processor, ImageFactory factory) +227
   ImageProcessor.Web.ImageFactoryExtensions.AutoProcess(ImageFactory factory, IWebGraphicsProcessor[] graphicsProcessors) +129
   ImageProcessor.Web.HttpModules.<ProcessImageAsync>d__32.MoveNext() +3570
   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +92
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +58
   System.Web.TaskAsyncHelper.EndTask(IAsyncResult ar) +71
   System.Web.AsyncEventExecutionStep.OnAsyncEventCompletion(IAsyncResult ar) +9670481
bug fixed on dev framework

All 10 comments

If I make url like this: http://localhost/media/technoparks/res/1085.jpg?upscale=false
The error becomes

 The request /media/technoparks/res/1085.jpg?upscale=false could not be understood by the server due to malformed syntax. 

Can you send me the image please. I'd like to know why the gif encoder is kicking in working with a jpeg

@JimBobSquarePants it's an actual gif image with jpg extension

1085

Fixed and released.

If I make url like this: http://localhost/media/technoparks/res/1085.jpg?upscale=false

Just to note, that parameter is only valid in conjunction with either height or width. That is why the second error is thrown and is by design.

Great, thank you!

Just had the same issue, the new version fixed it, THANKS Jim!

I found out that an exception is still thrown if you .Format() first and then .Resize like this:

imageFactory.Load(inStream.ToArray()).Format(formatResizeMemoryReusable).Resize(resizeLayer).Save(inStream);

But it works just fine if using:

imageFactory.Load(inStream.ToArray()).Resize(resizeLayer).Format(formatResizeMemoryReusable).Save(inStream);

An unhandled exception of type 'System.AccessViolationException' occurred in System.Drawing.dll

Attempted to read or write protected memory. This is often an indication that other memory is corrupt.


   at System.Drawing.SafeNativeMethods.Gdip.GdipDrawImageRectRectI(HandleRef graphics, HandleRef image, Int32 dstx, Int32 dsty, Int32 dstwidth, Int32 dstheight, Int32 srcx, Int32 srcy, Int32 srcwidth, Int32 srcheight, Int32 srcunit, HandleRef imageAttributes, DrawImageAbort callback, HandleRef callbackdata)
   at System.Drawing.Graphics.DrawImage(Image image, Rectangle destRect, Int32 srcX, Int32 srcY, Int32 srcWidth, Int32 srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttrs, DrawImageAbort callback, IntPtr callbackData)
   at System.Drawing.Graphics.DrawImage(Image image, Rectangle destRect, Int32 srcX, Int32 srcY, Int32 srcWidth, Int32 srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttr)
   at ImageProcessor.Imaging.Resizer.ResizeLinear(Image source, Int32 width, Int32 height, Rectangle destination, AnimationProcessMode animationProcessMode)
   at ImageProcessor.Imaging.Resizer.ResizeImage(Image source, Int32 width, Int32 height, Int32 maxWidth, Int32 maxHeight, List`1 restrictedSizes, ResizeMode resizeMode, AnchorPosition anchorPosition, Boolean upscale, Single[] centerCoordinates, Boolean linear)
   at ImageProcessor.Imaging.Resizer.ResizeImage(Image source, Boolean linear)
   at ImageProcessor.Processors.Resize.ProcessImage(ImageFactory factory)
   at ImageProcessor.Imaging.Formats.FormatBase.ApplyProcessor(Func`2 processor, ImageFactory factory)
   at ImageProcessor.Imaging.Formats.JpegFormat.ApplyProcessor(Func`2 processor, ImageFactory factory)
   at ImageProcessor.ImageFactory.Resize(ResizeLayer resizeLayer)
...

Ah @YovavGad that info is vital thanks! I've uncovered that access issue in #419 but I didn't have a decent stacktrace.

Thank you for an awesome project Jim! :+1:

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nul800sebastiaan picture nul800sebastiaan  路  7Comments

Bartmax picture Bartmax  路  8Comments

alecrt picture alecrt  路  7Comments

skttl picture skttl  路  5Comments

kristianstruct picture kristianstruct  路  4Comments