notmasteryet / jpgjs

JPEG/DCT data decoder
Other
237 stars 57 forks source link

TypeError: Cannot read property '0' of undefined #34

Open joshmarinacci opened 9 years ago

joshmarinacci commented 9 years ago

I'm getting an error with some JPEGs that I created in Mac OS X Preview. Your test images work fine. The error is:

TypeError: Cannot read property '0' of undefined at quantizeAndInverse (/Users/josh/projects/node-pureimage/src/jpg.js:367:61) at buildComponentData (/Users/josh/projects/node-pureimage/src/jpg.js:528:9) at Object.parse (/Users/josh/projects/node-pureimage/src/jpg.js:790:19) at Object.decode (/Users/josh/projects/node-pureimage/src/jpg.js:986:11) at Object. (/Users/josh/projects/node-pureimage/tests/images.js:15:5) at Module._compile (module.js:456:26) at Object.Module._extensions..js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Function.Module.runMain (module.js:497:10)

Any idea what would cause this? If I load my image and some test images into Preview I see that my image has a lot more metadata in it, but the basic format seems the same.

bird

thorikawa commented 9 years ago

I have the same issue. That's happens probably because jpgjs expect 'Start of Frame' section to appear after 'DQT' section in jpeg header, but it's not the case for some jpg files. I will send PR later on.

SantyWang commented 5 years ago

@thorikawa Thanks to you, that PR resolves my problem.

Cryptonewsmedia commented 3 years ago

I'm getting an error with some JPEGs that I created in Mac OS X Preview. Your test images work fine. The error is:

TypeError: Cannot read property '0' of undefined at quantizeAndInverse (/Users/josh/projects/node-pureimage/src/jpg.js:367:61) at buildComponentData (/Users/josh/projects/node-pureimage/src/jpg.js:528:9) at Object.parse (/Users/josh/projects/node-pureimage/src/jpg.js:790:19) at Object.decode (/Users/josh/projects/node-pureimage/src/jpg.js:986:11) at Object. (/Users/josh/projects/node-pureimage/tests/images.js:15:5) at Module._compile (module.js:456:26) at Object.Module._extensions..js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Function.Module.runMain (module.js:497:10)

Any idea what would cause this? If I load my image and some test images into Preview I see that my image has a lot more metadata in it, but the basic format seems the same.

bird

Not '0', but 'O', as representing circle