nodeca / pica

Resize image in browser with high quality and high speed
http://nodeca.github.io/pica/demo/
MIT License
3.76k stars 245 forks source link

image corruption on Chrome when not using alpha (jpeg) #203

Closed gregorymaertens closed 2 years ago

gregorymaertens commented 3 years ago

Hello,

the following image is corrupted when using Chrome (Version 86.0.4240.183 (Official Build) (x86_64)). Ok on Safari (Version 14.0 (15610.1.28.1.9, 15610)) and Firefox too (82.0.3 (64-bit)).

Arte-primitiva-el-1-950x701

While investigating this issue I have noticed that setting alpha: true in the options fixes the issue. Is it expected?

You can see with the demo app the pica resize is all black (only in Chrome, ok in Safari, Firefox).

Screen Shot 2020-11-20 at 16 01 00

Sometime the image is corrupted like so: Screen Shot 2020-11-20 at 16 07 15

puzrin commented 3 years ago

I can not reproduce. Can you attach image as zip? Is it PNG?

gregorymaertens commented 3 years ago

it's a jpg Arte-primitiva-el-1-950x701.jpg.zip

puzrin commented 3 years ago

IMO that's something Chrome version or hardware specific. I tried demo with Chrome 87.0.4280.66 on Ubuntu, and still could not reproduce problem (but i belive you have it).

They break something from time to time, and problem self-fix in next versions. Pica does no use anything special in js api.

I'd suggest try Chrome 87 & different PC to localize problem.

DanielStout5 commented 3 years ago

I experienced this same issue - setting alpha:true seems to fix it.

The issue is only present for very specific versions of Chrome.

boberbober commented 3 years ago

Same issue on MacOS Chrome Canary version 93.0.4567.0, used via the image-blob-reduce wrapper.

When alpha is set to false I get random black rectangular splats. Attached example input file was JPG so no alpha channel.

They appear randomly on different images but always in the same spot for the same image. Seen here on the right side:

a1aa16e3-f7e6-4ba5-afa8-d1364c0b3d58

rscotten commented 3 years ago

@boberbober Same problem. Setting alpha to true seems to fix it.

puzrin commented 2 years ago

Try v9. It has fixes for transparency and does not use .alpha option anymore.