[Suggestion] FLIF image format support

In this forum we discuss the future of Ren'Py, both bug fixes and longer-term development. Pre-releases are announced and discussed here.
Post Reply
Message
Author
User avatar
Devon Andersson
Newbie
Posts: 3
Joined: Sun Nov 12, 2017 9:10 am
Contact:

[Suggestion] FLIF image format support

#1 Post by Devon Andersson » Sun Nov 12, 2017 11:40 am

What is FLIF?

A new Free Lossless Image Format.
http://flif.info/

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:
viewtopic.php?f=4&t=40277&p=427878&hilit=flif#p427878

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.

Background:
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.

User avatar
ComputerArt.Club
Regular
Posts: 45
Joined: Mon May 22, 2017 8:12 am
Location: Taiwan
Contact:

Re: [Suggestion] FLIF image format support

#2 Post by ComputerArt.Club » Wed Nov 15, 2017 6:42 pm

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.

User avatar
Devon Andersson
Newbie
Posts: 3
Joined: Sun Nov 12, 2017 9:10 am
Contact:

Re: [Suggestion] FLIF image format support

#3 Post by Devon Andersson » Thu Nov 16, 2017 7:50 pm

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: http://flif.info/UGUI_FLIF/
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 https://en.wikipedia.org/wiki/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

REM CREATE 'CRUSHED' DIRECTORY:
mkdir crushed
REM FOR EVERY FILE ENDING WITH .PNG RUN PNGCRUSH
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*
pause
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"

User avatar
ComputerArt.Club
Regular
Posts: 45
Joined: Mon May 22, 2017 8:12 am
Location: Taiwan
Contact:

Re: [Suggestion] FLIF image format support

#4 Post by ComputerArt.Club » Fri Nov 17, 2017 12:07 pm

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:
viewtopic.php?f=8&t=3494&p=48721&hilit=svg+renpy#p48721

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.

Post Reply

Who is online

Users browsing this forum: No registered users