pz-mapmap icon indicating copy to clipboard operation
pz-mapmap copied to clipboard

Compress the images?

Open jmartin657 opened this issue 3 years ago • 7 comments

How is it you cant reduce the quality of the PNGs to not require 500gb for pixelated images of zomboid -_-

Quality 100 png images are used for like 4k resolution, and the quality to size correlation is not a straight line. You could probably compress the pngs down by 80%, and not even notice a change in image quality but a HUGE gain in storage space.

As is 500gb for a map of a game like this is laughable

jmartin657 avatar Feb 25 '22 19:02 jmartin657

Hello @jmartin657,

Any and all PRs to this effect are highly appreciated. Currently I'm using optipng to compress the PNG files (which I only use for the upper layers as I require the alpha channel) and jpegoptim for the L0 files.

Kind regards, Benjamin

blind-coder avatar Feb 25 '22 19:02 blind-coder

Would love to use this and make a web map for my server but I do not have that kind of size available, let me know if this ever becomes a reasonable amount of space

jmartin657 avatar Feb 26 '22 21:02 jmartin657

I do use webp for the final tiles with blind-coder/pz-to-deepzoom. It is great for layer 0 as well as it does support alpha channels with lossy compression being less in size than both png and jpg.

I recall Fort Redstone being at ~6.5GB in png before, and with webp it is ~800MB.

You do also need an up to date Open Seadragon that supports custom extensions and this function at document.ready function:

OpenSeadragon.setImageFormatsSupported({webp: true});

So far I have these generated for comparison, they're all webp (don't have a disk to do the full vanilla map processing with pz-mapmap heh): image

I don't think it is a good idea to let this tool (pz-mapmap) compress images as this has to be done at the final step which is the files that will be served live on the website (which is done with deepzoom tools and we want the original lossless source files to work with it), so you still need lots of disk space if you want to do the full vanilla map, and then compress to webp for the final website.

Here's the website I'm hosting for me and friends to use with the custom maps I'm processing: https://r4to0.hldm-br.net/pzmap/?desc=FortRedstone_20220307_L0

R4to0 avatar Apr 09 '22 05:04 R4to0

@R4to0 OH wow, using webp never occured to me. It should be easy enough to run a shell script converting all files to webp after creation and before uploading. Thank you!

blind-coder avatar Apr 09 '22 11:04 blind-coder

Here's another comparison to motivate: Bedford Falls L0 tiles

PNG: bedford_l0_png

cwebp with default settings: bedford_l0_webp

Might get better gains if tweaking compression params. Imagemagick also supports the same webp lib so it is doable do there directly.

R4to0 avatar Apr 10 '22 02:04 R4to0

Yeah, I'm experimenting with this myself right now. Do you know if TVs and consoles support WebP? We have quite a few people watch the map on those devices.

blind-coder avatar Apr 10 '22 08:04 blind-coder

Yeah, I'm experimenting with this myself right now. Do you know if TVs and consoles support WebP? We have quite a few people watch the map on those devices.

Oh haven't tried on those (I could try on my brother's PS4 remotely but it is off now). Should work fine if its up to date.

There's a good reference about support https://caniuse.com/webp

If it was AVIF then would be another story haha.

R4to0 avatar Apr 10 '22 16:04 R4to0