-
Notifications
You must be signed in to change notification settings - Fork 10
Description
Related to this and Froox's comment on the previous issue, currently PNG saving is extremely slow.
I'd open a new issue for it, but PNG screenshots are already a few issues deep and I don't want to make it even more complicated...Due to misconfigured WebP parameters, saving to inventory isn't as fast as it could be (Up to 90% faster with 1% larger files).
Then Resonite has to re-compress the WebP into a PNG, but those parameters are also misconfigured. Using pngcheck reportszlib: deflated, 32K window, maximum compression, which you can actually see if you check the screenshot folder after taking a quick photo. Depending on image viewer, you can watch the file being written line by line.Both of these config issues add up, causing a 4K screenshot to take 30 Seconds to save and 2 Minutes(!) for an 8K screenshot to finish writing to disk. That's based on file created and modified times, meaning only PNG encoding, so the still slightly sluggish WebP saving makes it even slower.
The standard for game use is usually
superfast compression(zlib level 1), but even more conservative values like 3 should be at most 20% larger and around 80% faster. It can be even faster swapping zlib in FreeImage with zlib-ng, which I'll open an issue for shortly.More modern tools like OxiPNG can compress PNGs in a fraction of a second without sacrificing filesize (0.15% smaller than Resonite in under 0.8 seconds), but that would mean a more direct integration for certain formats, which I know Froox wants to avoid.
Originally posted by @jonnyawsom3 in #1877
zlib-ng should be a drop-in swap for FreeImage, giving large performance gains for both PNG reading and writing. Quoted above is my related comment about lowering the zlib level in Resonite. With zlib-ng, the level may be able to stay at max, but users probably want performance over savings. (Or add a slider to the settings menu to control compression? Hmm.... Maybe another issue for later.)