Idered / chalk.ist

📷 Create beautiful images of your source code
https://chalk.ist
MIT License
941 stars 78 forks source link

[Feature Request] Embed config in PNG as metadata #39

Open EmNudge opened 7 months ago

EmNudge commented 7 months ago

One of the main issues with most picture generators for code is that edits to the photo require hand-copying all the code and retrieving a new image, likely with new aesthetics.

We can take the PNG data and append some text chunks containing the current application config or at least the text inside of the image. The page can also be an upload target, so you can drag an image onto chalk.ist that was generated using chalk.ist and retrieve the original text back.

Idered commented 7 months ago

I'm working on adding user accounts to let user save their snippets. I guess this will resolve edits issue CleanShot 2024-01-31 at 11 30 48@2x

EmNudge commented 7 months ago

It would only resolve re-editing for the creator. Usually it's someone else updating old documentation. The PNG specification isn't terribly complicated. I can open up a PR with at least part of this feature if you think it's something you're okay with including.

Idered commented 7 months ago

Thanks, this is really interesting feature but let's wait a little bit until I'm done with new version - it will be a massive update. In meantime it would be cool if you could check if modified PNG uploaded to twitter or linked keeps the custom data.

Browser extension which detects such PNG's and adds "Edit on chalk.ist" would be cool

EmNudge commented 7 months ago

Twitter converts all images to Webp these days (significantly smaller than PNG) which strips metadata like text chunks in the process. Platforms like Discord seem to add on their own EXIF chunk, but preserve the tEXt chunks, so it should carry over there. I assume most of the use will be in docs directly or hosted on github instead of via social media.