Giter Club home page Giter Club logo

Comments (22)

JoepDiskTuna avatar JoepDiskTuna commented on May 23, 2024 2

Indeed no end marker. Added one.
bad image fixed

from imagesharp.

vaindil avatar vaindil commented on May 23, 2024 1

@JimBobSquarePants I have some time in the near future, I'm going to see if I can figure out how to bypass this. I'll keep you updated here; I assume you want to close #83 as a dupe.

from imagesharp.

vaindil avatar vaindil commented on May 23, 2024 1

This probably isn't ideal, but for the moment I can work around it like this:

try
{
    var imageTest = new Image(stream);
}
catch
{
    stream.Seek(-2, SeekOrigin.End);
    stream.WriteByte(0xff);
    stream.WriteByte(0xd9);
}

stream.Seek(0, SeekOrigin.Begin);
var image = new Image(stream);

from imagesharp.

JimBobSquarePants avatar JimBobSquarePants commented on May 23, 2024

From @dlemstra on October 31, 2016 13:7

Can you add a link to the original jpg file? Github changed it into a PNG file. Is this the correct link: https://yooocanlive.azureedge.net/images/98bc0f36fcc4444e9889e152aa4ceb5d?

And can you move your issue to the new repo: https://github.com/JimBobSquarePants/ImageSharp? The Core branch has been renamed.

from imagesharp.

JimBobSquarePants avatar JimBobSquarePants commented on May 23, 2024

From @gdoron on October 31, 2016 13:14

@dlemstra
Try this one:
http://yooocan.com/images/temp/bad%20image.jpeg
(For future readers, this image will be deleted, I had to upload it to our server)

Thanks!

from imagesharp.

JimBobSquarePants avatar JimBobSquarePants commented on May 23, 2024

From @gdoron on October 31, 2016 13:19

BTW, in case you delete go to the link and read the story,
This is a Halloween costume a father made for his disabled I hate this word kid.
They "dressed" the wheelchair in a Ghostbusters car costume. AMAZING STUFF!.

from imagesharp.

JimBobSquarePants avatar JimBobSquarePants commented on May 23, 2024

@gdoron Great story, really heart-warming! 😄

I'm going to move this issue over to the correct repo as I have moved everything. We can continue the discussion there.

from imagesharp.

JimBobSquarePants avatar JimBobSquarePants commented on May 23, 2024

Ok, @gdoron,

I used jpegsnoop to analyse the image and it is technically corrupt as it's missing an EOI (End Of Image) marker.

Theoretically it would still be possible to decode the image (Windows can) by calculating the number of expected MCU's (Minimum Coded Unit) if we are able to read the height and the width from the image header and stopping decoding once we have reached that value. Typically those are 8x8 units but can also be 16x8 or 16x16 depending on the subsampling.

More info on MCU's can be found here

It's not going to be easy to fix but I'll give it my best shot.

from imagesharp.

gdoron avatar gdoron commented on May 23, 2024

Thanks James!
I'm curios, how images getting corrupt like that, considering no one manually played with the raw bits in the image.

from imagesharp.

JimBobSquarePants avatar JimBobSquarePants commented on May 23, 2024

@gdoron Whatever originally encoded the image probably has a bug. Or maybe even something has happened during file copy in some instance. It happens often enough.

from imagesharp.

gdoron avatar gdoron commented on May 23, 2024

It happens often enough

Yeah, we are getting many images like that lately... 😢

from imagesharp.

gdoron avatar gdoron commented on May 23, 2024

@JoepDiskTuna Welcome to GitHub...! 🎆 (it says you joined today).
Thanks for fixing the image, but we'll need a fix for the problem as we're getting more and more corrupted images like this one.

from imagesharp.

JoepDiskTuna avatar JoepDiskTuna commented on May 23, 2024

Ah, ok. I understand. I was just looking into JPG corruption and errors and all that and that's how Google got me here.

In the end, the file was 'corrupt'. Just minor of course. Just check start and end markers for a start would be a good thing. But I don't have to tell you that.

from imagesharp.

gdoron avatar gdoron commented on May 23, 2024

Great @vaindil! It's our top 1 bug on our website... 👍 👍 👍
Thanks mate!

from imagesharp.

JimBobSquarePants avatar JimBobSquarePants commented on May 23, 2024

Yeah that's nasty!

We should have an MCU count in the decoder, working out whether to throw should be a case of checking against that count. If you could have a look that would be awesome. I would suggest looking at the source code for JpegSnoop on GitHub, that can detect missing EOI markers, warn and successfully decode them.

from imagesharp.

vaindil avatar vaindil commented on May 23, 2024

I spent a good amount of time looking over it, and I cannot for the life of me figure out how to properly get the correct location of the EOI marker. I found a ton of resources but can't find a definitive way to get the info of where the file should end. :/

from imagesharp.

JimBobSquarePants avatar JimBobSquarePants commented on May 23, 2024

No worries, thanks for trying. It's on my list of thinks to work through so will get it done eventually.

from imagesharp.

tocsoft avatar tocsoft commented on May 23, 2024

renaming to make the 2 issues different as one seems to be more easily fixable then the other.

from imagesharp.

tocsoft avatar tocsoft commented on May 23, 2024

@gdoron I just merged a fix for none-progressive jpegs... updating to the latest ImageSharp.Formats.Jpeg should help stop some of the issues your seeing, probably won't fix them all but it should help a bit.

from imagesharp.

antonfirsov avatar antonfirsov commented on May 23, 2024

@gdoron It seems we managed to fix this.

Yeah, we are getting many images like that lately...

I would be very happy if you could provide some feedback about the situation with your inputs based on our latest build! 😄

from imagesharp.

gdoron avatar gdoron commented on May 23, 2024

I'll upload a new version of our application tomorrow with the latest build and let you know.

Thank you all!

from imagesharp.

gdoron avatar gdoron commented on May 23, 2024

@antonfirsov So far it's cool 👍
Thanks a ton mates!

from imagesharp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.