Hacker News new | ask | show | jobs
by dvh 1666 days ago
If I wanted a non-downloadable image I would make it from 1px wide/tall colored divs.
3 comments

I thought this is what it was going to be! Another method would be to generate a plane with the same number of vertices as pixels, store the pixel color values as an attribute, and then render the mesh to a canvas.
You can right-click canvas and save it as image.
Oh, you're right! I guess you'd have to disable the context menu too.
Which doesn't help either because in the Inspect view you can just click "Screenshot node" on the HTML element.
I'm learning a lot today.
Pretty sure that was actually used in emails at some point, just with tables, to get around email clients not loading images.
Email clients generally don't load external images. The majority should still display images that are sent as part of a multipart/mixed message though, and those should take up significantly less space than thousands of divs/tds and color attributes.
I actually used this to generate graphs in JS/HTML in the 1990s. :-)
Out of curiosity, how was the performance (of course normalized to performance of that era)?
Here's a somewhat older approach splitting charts into linear runs of 1x1 images, which has some statistics at the bottom of each chart:

https://www.masswerk.at/demospace/relayWeb_en/chartset.htm

(Or see https://www.masswerk.at/demospace/relayWeb_en/welcome.htm and select "charts". Total time for calculations and rendering was then in the about 1 sec range. The real problem for using this in production was that these charts could be printed on Windows with Postscript printers only. I think, this was eventually fixed in Windows 98 SE.)