Page 1 of 1

[Suggestion] FLIF image format support

Posted: Sun Nov 12, 2017 11:40 am
by Devon Andersson
What is FLIF?

A new Free Lossless Image Format.

Why support it in Ren'Py?
  • standardized and stable now
  • beats ALL other image-formats in compression (the "killer"-argument for me personally)
  • supports lossy and lossless compression
  • supports transparency
  • supports animations
  • Interlaced files can be decoded quickly at lower quality/resolution (faster load times on typical systems with slow drives but fast CPUs, should help on low-end systems with low-resolutions monitors)
  • in general the support for this format is gaining traction

    Good arguments for this image-format in general compared to others, but irrelevant to Ren'Py:
  • no generation loss
  • color depth up to 16 bits per channel
I've searched the forum about 'FLIF' and found one older post:

At that time of that old post the FLIF-format was considered "not final". A valid argument at that time. That is no longer the case.

I am working on a visual novel with VERY high quality 3D CG graphics. These images are rendered at 6K resolution and then downscaled to 4K and 1080p. The plan is to release a 4K- and 1080p-version of the game. There will be 1000+ images. The filesize-reduction due to the better compression would help a lot.

As far as I know these are the most efficient compressing and free formats for each media-type:
  • Audio: Opus
  • Video: VP9 (only HEVC beats this but it is not free, the upcoming AV1-format looks promising)
  • Images: FLIF
For Audio and Video Ren'Py already supports the most-efficient and free formats available. Excellent!
Even though Ren'Py is mainly used with Images, a more efficient Image-compression is available for free and could be implemented.

If there would be experimental support for FLIF (basic support without transparency and animations) I'd be the first to try it.

Re: [Suggestion] FLIF image format support

Posted: Wed Nov 15, 2017 6:42 pm
by ComputerArt.Club
Sounds cool. There is another open format that I am sure is even more efficient, especially at higher resolutions. SVG :). Ha, yeah, I know it cant be used in your situation as you are rendering 3D, I render images in 3D for backgrounds too sometimes. However, I almost always use vectors for characters and objects and most my projects now use vector backgrounds too. Those images are then rendered into png, which is a bit sad. It would be nice to be able to play games at any resolution with crystal clear graphics and low file sizes. I've seen Tom discuss svg before, he said he needed a small free renderer. I wonder if there is one out there now.

What software are you using to render Flif? Googled Blender and FLIF and no one is talking about it.

Re: [Suggestion] FLIF image format support

Posted: Thu Nov 16, 2017 7:50 pm
by Devon Andersson
Yes, I see your point with the vectorgraphics. SVG would perfectly scale on every resolution.
What software are you using to render Flif? Googled Blender and FLIF and no one is talking about it.
I do not use FLIF yet. But I tested it over a year ago. I believe it was this converter I used:
I remember testing it in html too. Everything worked fine for me and the compression was impressive. There was (still is?) a javascript to decode FLIFs. But FLIF needs native Browser-support obviously. Decoding images in javascript is slow and would drain batteries on mobiles devices. Errr ... got a little offtopic here :D

I still use PNGs. To reduce file sizes I use pngcrush with a batch-file that converts all finished renders from a directory to "crushed" PNGs.

I will leave my crush_all.bat here. Maybe it useful for somebody:

Code: Select all

mkdir crushed
for %%a in ("*.png") do pngcrush_1_8_10_w64.exe "%%a" "crushed/%%~na.png"
REM *todo: copy all .PNGs into "<ren'pygame>\images"-folder*
add -brute for *try hard* bruteforce-compression:

Code: Select all

for %%a in ("*.png") do pngcrush_1_8_10_w64.exe -brute "%%a" "crushed/%%~na.png"

Re: [Suggestion] FLIF image format support

Posted: Fri Nov 17, 2017 12:07 pm
by ComputerArt.Club
Thanks for the links. I've seen similar links around. Yes optimization is an important step, though for my workflow it is the final step.

Found the SVG discussion too, it is dated 2008:

A lot has changed since then. Vectors are no longer so crude, ugly or difficult to create. In fact, for those without a graphics tablet, vectors are much easier to create and much better looking than 2D raster images (something that I am painfully aware of as a teacher). 3D is great but also needs to be processed after the render to fit the style.

I am making my games for android, I'd love to reduce to file size further and also keep the quality up.

FLIF sounds fun for larger images and larger screens. What platform do you have in mind for your games? You know, it would be really cool to play 4K games on a smart TV though many phones don't support casting their screens. We have a cheap 4K TV (Taiwan is great for things like thay) but we have never watched 4K content on it (due to chromecast's limitations and the lack of a need for it, things just seem to look crisp already)

I hope I can make some vector assets freely available that would persuade more people to use it and possibly help push for SVG support. It's something I've been thinking of for a long time. I have a long to-do list though.
Vectors are awesome, I really wish more platforms, developers and artists embraced them.