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

Error while optimizing JPG file #12

Open
1024mb opened this issue Dec 30, 2022 · 6 comments
Open

Error while optimizing JPG file #12

1024mb opened this issue Dec 30, 2022 · 6 comments

Comments

@1024mb
Copy link

1024mb commented Dec 30, 2022

Just got multiple errors with this same message, all the files are JPG, unfortunately I can't share the files:

Exception happened when optimizing or comparing the image:
System.ArgumentException: Source array was not long enough. Check the source index, length, and the array's lower bounds. (Parameter 'sourceArray')
   at System.Array.Copy(Array sourceArray, Int32 sourceIndex, Array destinationArray, Int32 destinationIndex, Int32 length, Boolean reliable)
   at System.Array.Copy(Array sourceArray, Int32 sourceIndex, Array destinationArray, Int32 destinationIndex, Int32 length)
   at ExifLibrary.JPEGFile.ReadExifAPP1()
   at ExifLibrary.JPEGFile..ctor(MemoryStream stream, Encoding encoding, Boolean readTrailingData)
   at ExifLibrary.ImageFile.FromStreamInternal(MemoryStream stream, Encoding encoding)
   at ExifLibrary.ImageFile.FromStreamAsync(Stream stream, Encoding encoding)
   at ExifLibrary.ImageFile.FromFileAsync(String filename, Encoding encoding)
   at ExifLibrary.ImageFile.FromFileAsync(String filename)
   at DeveImageOptimizer.ImageOperations.ImageExifComparer.AreImageExifDatasEqual(String image1Path, String image2Path)
   at DeveImageOptimizer.ImageOperations.ImageComparer.<>c__DisplayClass0_0.<<AreImagesEqualAsync>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at DeveImageOptimizer.FileProcessing.FileOptimizerProcessor.OptimizeFile(OptimizableFile file)
@devedse
Copy link
Owner

devedse commented Dec 30, 2022

Hmm I'll look into it, would you be able to share one of the files privately?

@1024mb
Copy link
Author

1024mb commented Dec 31, 2022

I have been testing some of my public files and I just got the same error message with one, here it is (zipped just in case):
1399751938250.zip

Btw, I have been getting some Optimized image isn't equal to source image. and I have ticked the save failed files, do those files not constitute as failed?

@devedse
Copy link
Owner

devedse commented Dec 31, 2022

Apparently it's an issue with the EXIF comparison tool I'm using, I've created an issue in his Github:
oozcitak/exiflibrary#111

What save failed files does is store the failed file as {filename}_Failed.jpg. This makes investigating what went wrong a bit easier. It won't ever overwrite the destination file though of the optimization failed.

@1024mb
Copy link
Author

1024mb commented Dec 31, 2022

Apparently it's an issue with the EXIF comparison tool I'm using, I've created an issue in his Github:
oozcitak/exiflibrary#111

Thanks, hopefully this gets fixed though it has only happened with some files.

What save failed files does is store the failed file as {filename}_Failed.jpg. This makes investigating what went wrong a bit easier. It won't ever overwrite the destination file though of the optimization failed.

Oh, right, I just realized I forgot to add something to my previous comment. I meant that when I get those errors and "save failed files" is enabled the (failed) files aren't saved, I got no {filename}_Failed.jpg, that's why I was asking that.

@devedse
Copy link
Owner

devedse commented Jun 28, 2023

Can you guys maybe post in the GitHub issue I've mentioned? Maybe the owner of the library I'm using for the exif data can try to fix it.

@T0T4R4
Copy link

T0T4R4 commented Jun 28, 2023

I've got the same error using directly the ExifLib library - added a comment to your post @devedse

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants