Log in

View Full Version : PNG and image formats


hellgauss
28th April 2026, 16:54
I have the following problem while taking screenshots of 4K hdr10 video (Windows11).

For maximum quality, I use mpv.net @16bit and tonemapped. Format png - I need lossless, or at least lossless up to pixel-format conversion.

I need to upload images to free image hosting sites compatible with forum-boards, the best I find are imagebam and imgbb, which have a 30-32 MB file size cap.

However the filesize of the screenshots often exceeds that limit. I tried optipng.exe which reduces the bitdepth from 64 to 48bit, discarding the useless alpha channel, and also performs some lossless optimizations but it is not enough.

I think a good compromise could be to switch to 12bit x 3 channels (RGB), and compress as 16bit-png with less significant digits set to 0 to gain in compression, but I do not know how to do it.

I can write simple c/c++ scripts to parse raw data and do it manually, but it seems that the .bmp format does not support 16bit per channel. Is there any not compressed image format which stores 16 bit as RGB? Or any image format which use 12 bit lossless and can be converted to png-16bit via command line?

Thank you
HG

Z2697
28th April 2026, 19:30
PPM.
Or just ffmpeg -vf zscale=d=none,format=gbrp12le,zscale=d=none,format=gbrp16le. (none dither is the default for zscale so can be omitted)

hellgauss
29th April 2026, 01:05
Thanks! It works! As I expected, the less significant bits are not comprimible, so I saved a lot.

File .bat used:

ffmpeg -i "input.png" -vf zscale=d=none,format=gbrp12le,zscale=d=none,format=gbrp16le "output.png"
optipng -o7 "output.png"

Input.png taken from mpv.net WITHOUT tag-colorspace and with high bit depth.

ffmpeg compression in png is very good, optipng -o7 takes a lot of time but it can save an extra 1-4%, it can be useful if you still oversize the limit a little bit.

PS:
I'm waiting for a widely used lossless yuv 4:2:0 image format... At 8 and 10 bit they are respectively 12bpp and 15bpp, which is far less than the 24bpp of standard rgb and it is really lossless.

Z2697
29th April 2026, 12:23
YUV420 will not give you lossless if you want post-tonemap result.

hellgauss
29th April 2026, 15:55
You can store yuv lossless + metadata for tonemap

Z2697
6th May 2026, 04:17
HEIF should be able to do that, the most widely available variant is AVIF.