inkjet icon indicating copy to clipboard operation
inkjet copied to clipboard

Crashes when decoding JPGs w/ sRGB IEC61966-2.1 color profile

Open bvandenbos opened this issue 7 years ago • 7 comments

At least the color profile seems to be the consistent factor. May also be true for other profiles. I can decode JPGs w/out a profile just fine.

Stack trace:

TypeError: Cannot read property '0' of undefined
    at quantizeAndInverse (jpg.js:448)
    at buildComponentData (jpg.js:586)
    at constructor.parse (jpg.js:820)
    at JpegImage.parse (jpg.js:68)

Example image: 3

bvandenbos avatar Jun 08 '17 00:06 bvandenbos

got it, thank you for the bug report. I'll look into it.

gchudnov avatar Jun 08 '17 19:06 gchudnov

Same issue here

dalisoft avatar Feb 24 '20 08:02 dalisoft

@dalisoft do you have another example for an image?

gchudnov avatar Feb 24 '20 08:02 gchudnov

16_out

I used PNG from here

Steps do this: If you have macOS, then you can do this by:

  1. Open any image with macOS built-in photo viewer
  2. Export image and select JPEG (select quality to High)

If you using Windows:

  1. Open any PNG image with Adobe Photoshop (you can use free trial if haven't purchased)
  2. After opening dialog will be be opened to select which color profile
  3. Select sRGB (... no matter specs number)

dalisoft avatar Feb 24 '20 09:02 dalisoft

I also ran into this issue. This was an issue with the underlying jpgJS library: https://github.com/notmasteryet/jpgjs/issues/34 However, they seemed to have fixed it here: https://github.com/notmasteryet/jpgjs/pull/36 I solved the problem by just using the current version of jpgjs directly rather than Inkjet, but I suspect this library could be fixed by simply updating the jpg.js file to a more current version.

dexo568 avatar Sep 25 '20 22:09 dexo568

today started upgrading all underlying libraries, but might take some time..

gchudnov avatar Sep 26 '20 13:09 gchudnov

preliminary fix is here: https://github.com/gchudnov/inkjet/pull/7 released as 3.0.0-rc0.

if used in node.js: require('inkjet').default should be used. will revert back to require('inkjet') in rc1.

gchudnov avatar Oct 01 '20 07:10 gchudnov