Snap icon indicating copy to clipboard operation
Snap copied to clipboard

GZip Images

Open jessiejs opened this issue 2 years ago • 3 comments

Snap stores images uncompressed, in an XML file.

It would problably be better for project sizes if we use gzip to compress the data urls.

jessiejs avatar Dec 08 '22 20:12 jessiejs

Snap stores images uncompressed, in an XML file. Not really, as "data:image/png;base64," / PNG is a specially designed image encoding and compression format. 

DarDoro avatar Dec 09 '22 21:12 DarDoro

we could compress that text down, but then we'd need to re-encode it as base64 to use it in a text file. Not sure we'd get much savings there. We'd also have to use some custom Gzip JS...

Honestly, if we want to save space we need to go to an actual binary format like a zip package with XML and PNG files. They actually might be useful for a few reasons, but I don't think is a critical stopping point for anything.

cycomachead avatar Dec 09 '22 22:12 cycomachead

I can confirm, from having looked into this for MicroBlocks a few months ago, that GZipping the base64 string and then re-encoding it as base64 would give us next to no savings but instead a myriad of other problems. I truly wouldn't recommend that path to anyone :)

bromagosa avatar Jan 05 '23 12:01 bromagosa