defsteph / EPiFocalPoint

Focal point based image cropping for EPiServer using ImageResizing.NET
MIT License
9 stars 10 forks source link

ArgumentException in ImageDimensionService with progressive JPGs #14

Closed KlawitterB closed 6 years ago

KlawitterB commented 6 years ago

Hi,

we are getting ArgumentExceptions in the ImageDimensionService when using progressive JPGs. In DecodeJfif you are looking for a 0xc0 marker which is only valid for baseline jpgs. For progressive jpgs it should be 0xc2.

Additionally I would suggest that you replace the throw new ArgumentException(ErrorMessage); with return Size.Empty; so the fallback Image.FromStream can be used. Keep in mind that you need to reset the stream position to the beginning (stream.Position = 0;) right before the Image.FromStream because the BinaryReader has already read some bytes.

Regards, Benjamin