Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce .html size by avoiding duplicating image data #6

Open
PeterMinin opened this issue Mar 9, 2023 · 1 comment
Open

Reduce .html size by avoiding duplicating image data #6

PeterMinin opened this issue Mar 9, 2023 · 1 comment

Comments

@PeterMinin
Copy link

PeterMinin commented Mar 9, 2023

Currently the final .html files include all images as inline base64 data. The problem is, profile photos are typically repeated many times within a chat, and the data is duplicated every time. This makes the files unnecessarily large.

Here is an idea of how to reuse the same data using CSS: https://stackoverflow.com/a/55762229/675674. Note that SVG, which is also used there, is avoidable too: see the comment. Other answers provide other CSS solutions and a JS one.

@PeterMinin
Copy link
Author

I made a Python script to post-process the files: https://gist.github.com/PeterMinin/20b7bebbda578db7cad24a6487d81d7c.
Well, for me it saved 10%, 305 MB -> 272 MB. Not very much, especially if you compress your backup. But some of my files reduced by ~70%, like 490 KB -> 128 KB, so YMMV.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant