Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImageProcessingException: An error occurred when processing the image using CropProcessor #750

Closed
3 of 4 tasks
rodion-m opened this issue Oct 24, 2018 · 1 comment · Fixed by #753
Closed
3 of 4 tasks

Comments

@rodion-m
Copy link

rodion-m commented Oct 24, 2018

Prerequisites

  • I have written a descriptive issue title
  • I have verified that I am running the latest version of ImageSharp
  • I have verified if the problem exist in both DEBUG and RELEASE mode
  • I have searched open and closed issues to ensure it has not already been reported

Description

Exception throws when I try to apply EntropyCrop method to this image:
https://yadi.sk/d/nU_mjlfkV5UI2w

Call Stack:

SixLabors.ImageSharp.ImageProcessingException: An error occurred when processing the image using EntropyCropProcessor`1. See the inner exception for more detail. ---> SixLabors.ImageSharp.ImageProcessingException: An error occurred when processing the image using CropProcessor`1. See the inner exception for more detail. ---> System.ArgumentNullException: Array cannot be null.
Parameter name: bytes
    at System.Text.Encoding.GetString(Byte* bytes, Int32 byteCount)
   at SixLabors.ImageSharp.EncoderExtensions.GetString(Encoding encoding, ReadOnlySpan`1 buffer)
   at SixLabors.ImageSharp.MetaData.Profiles.Exif.ExifReader.ConvertToString(ReadOnlySpan`1 buffer)
   at SixLabors.ImageSharp.MetaData.Profiles.Exif.ExifReader.ConvertValue(ExifDataType dataType, ReadOnlySpan`1 buffer, UInt32 numberOfComponents)
   at SixLabors.ImageSharp.MetaData.Profiles.Exif.ExifReader.TryReadValue(ExifValue& exifValue)
   at SixLabors.ImageSharp.MetaData.Profiles.Exif.ExifReader.AddValues(List`1 values, UInt32 index)
   at SixLabors.ImageSharp.MetaData.Profiles.Exif.ExifReader.ReadValues()
   at SixLabors.ImageSharp.MetaData.Profiles.Exif.ExifProfile.InitializeValues()
   at SixLabors.ImageSharp.MetaData.Profiles.Exif.ExifProfile.GetValue(ExifTag tag)
   at SixLabors.ImageSharp.Processing.Processors.Transforms.TransformHelpers.UpdateDimensionalMetData[TPixel](Image`1 image)
   at SixLabors.ImageSharp.Processing.Processors.Transforms.TransformProcessorBase`1.AfterImageApply(Image`1 source, Image`1 destination, Rectangle sourceRectangle)
   at SixLabors.ImageSharp.Processing.Processors.CloningImageProcessor`1.CloneAndApply(Image`1 source, Rectangle sourceRectangle)
--- End of inner exception stack trace ---
    at SixLabors.ImageSharp.Processing.Processors.CloningImageProcessor`1.CloneAndApply(Image`1 source, Rectangle sourceRectangle)
   at SixLabors.ImageSharp.Processing.Processors.CloningImageProcessor`1.Apply(Image`1 source, Rectangle sourceRectangle)
   at SixLabors.ImageSharp.Processing.Processors.Transforms.EntropyCropProcessor`1.BeforeImageApply(Image`1 source, Rectangle sourceRectangle)
   at SixLabors.ImageSharp.Processing.Processors.ImageProcessor`1.Apply(Image`1 source, Rectangle sourceRectangle)
--- End of inner exception stack trace ---
    at SixLabors.ImageSharp.Processing.Processors.ImageProcessor`1.Apply(Image`1 source, Rectangle sourceRectangle)
   at SixLabors.ImageSharp.Processing.DefaultInternalImageProcessorContext`1.ApplyProcessor(IImageProcessor`1 processor, Rectangle rectangle)
   at SixLabors.ImageSharp.Processing.DefaultInternalImageProcessorContext`1.ApplyProcessor(IImageProcessor`1 processor)
   at SixLabors.ImageSharp.Processing.EntropyCropExtensions.EntropyCrop[TPixel](IImageProcessingContext`1 source, Single threshold)

Steps to Reproduce

            using (var image = Image.Load("img20.jpg"))
            {
                image.Mutate(x => x.EntropyCrop(0.07f));
            }
  • ImageSharp version: 1.0.0-dev002072
  • Other ImageSharp packages and versions:
  • Environment (Operating system, version and so on): Win 10
  • .NET Framework version: 4.6.2
  • Additional information:
    img20
@JimBobSquarePants
Copy link
Member

Looks like the EXIF metadata is somehow corrupted @dlemstra I'll need your help here.

JimBobSquarePants added a commit that referenced this issue Oct 27, 2018
Added missing length check that caused an ArgumentNullException (#750)
antonfirsov pushed a commit to antonfirsov/ImageSharp that referenced this issue Nov 11, 2019
Added missing length check that caused an ArgumentNullException (SixLabors#750)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants