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: unknown JPEG marker 0 #81

Open
googleoryx opened this issue Dec 7, 2020 · 4 comments
Open

Error: unknown JPEG marker 0 #81

googleoryx opened this issue Dec 7, 2020 · 4 comments
Labels

Comments

@googleoryx
Copy link

Hi guys

I'm getting this error when trying to decode this file. I've attached the file.
2020-12-07-invalid-jpeg-marker

The stack trace is as follows:

Error: unknown JPEG marker 0
    at constructor.parse (SOME_PATH\node_modules\jpeg-js\lib\decoder.js:825:19)
    at Object.decode (SOME_PATH\node_modules\jpeg-js\lib\decoder.js:1096:11)
    at Object.<anonymous> (SOME_PATH\test\download-property.ts:37:6)
    at Module._compile (internal/modules/cjs/loader.js:777:30)
    at Module.m._compile (SOME_PATH\node_modules\ts-node\src\index.ts:493:23)
    at Module._extensions..js (internal/modules/cjs/loader.js:788:10)
    at Object.require.extensions.<computed> [as .ts] (SOME_PATH\node_modules\ts-node\src\index.ts:496:12)
    at Module.load (internal/modules/cjs/loader.js:643:32)
    at Function.Module._load (internal/modules/cjs/loader.js:556:12)
    at Function.Module.runMain (internal/modules/cjs/loader.js:840:10)

The jpeg opens fine in:

  • Windows 10 Photos
  • Microsoft Paint
  • Paint.NET
  • IE11
  • Google Chrome

But I get the following error trying to open the file in Photoshop CS6 (this old version is more sensitive to file issues):
image

What do you guys think?

@patrickhulce
Copy link
Collaborator

Thanks for filing @googleoryx! It looks like a malformed JPEG. Given the current resourcing, this project can't make the same extensive recovery attempts that some other popular decoders can. If it turns out that this a very popular camera and encoder always produces files like this (such as the situation in #82), then we'd happily accept a PR for a workaround.

@NyaomiDEV
Copy link

Hey there! Having the same issue here, but with JPEG music album images. Is there a way of "sanitizing" said images beforehand so that jpeg-js is happy with them?

@patrickhulce
Copy link
Collaborator

Is there a way of "sanitizing" said images beforehand so that jpeg-js is happy with them?

Yes, but doing so mostly requires the same level of effort as decoding the JPEG to begin with.

If you are getting images from a popular encoder that always produces files like this, sending examples along with repro steps is the best path to getting a PR for a workaround :)

@NyaomiDEV
Copy link

If you are getting images from a popular encoder that always produces files like this, sending examples along with repro steps is the best path to getting a PR for a workaround :)

In my case, I work with unpredictably encoded JPG images, since they're from the Internet itself. Sadly I cannot send a sample and be done with it, as it might just really be corrupted and I wouldn't ever know

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

No branches or pull requests

3 participants