Reconstruct original 16-bit Raw pixel data from the HTML5 canvas

非 Y 不嫁゛ 提交于 2019-12-24 08:48:36

问题


If a 16-bit single channel (Gray-scale) raw pixel data losslessly encoded into Image format(e.g.PNG, Webp , Jpeg-2000 or JPEG-XR) and Image rendered to HTML5 canvas, then is there any way to retrieve original 16-bit Raw pixel data from the canvas?


回答1:


No.

When drawn to a canvas the image is uncompressed, and all the pixels data are pre-multiplied and converted to 24-bit data + an 8-bit alpha channel (RGBA).
In this process the image looses everything from the original, even for same color depth original image because of various rounding errors (See Canvas fingerprinting.)

So even lossless formats are loosy on a canvas.

If you need the raw data, you'll need to write a parser yourself and treat directly your images files as arrayBuffer.



来源:https://stackoverflow.com/questions/43412842/reconstruct-original-16-bit-raw-pixel-data-from-the-html5-canvas

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!