- Mar 7, 2019
- 1,408
- 1,205
starting to investigate this. picked 4 images from my images folder to test on. posting this as a reference for myself, to see what we can manage to achieve.jpg was for storing the thumbnails to reduce size since u'd be adding another image alongside the original image. just so this change doesn't have a big impact.
I meant lower res, to reduce vram usage. my grid is 3 columns and forgot its customizable so I thought you could get away with smaller..
Id say only low column grids need the larger images, so you could just treat it as an outlier, or even have a system that checks image size and choses the low vs high res image, that way they are not hindering optimisation for the small images.
In saying that, im giving all these suggestions in a optimistic vacuum, i know you might not have the time
as for storing as bitmap, storage size might balloon real quick, but im sure you'd already test that beforehand
onto a more promising path:
did a quick search, opengl supports texture compression which seems to be alot better than simple lower res resize.
You must be registered to see the links
DXT1 seems to be popular, not sure if there is a newer compression format thats taken over nowadays
You must be registered to see the links
glfw should support glCompressedTexImage2D? havent checked, but more importantly idk if its exposed to imgui
shows in order, file size on disk, texture byte size to send to gpu, and pixel resolution

(idk what happened with those floating brackets, powershell is tripping, they dont exist)
from what i found here
You must be registered to see the links
we might be able to achieve a 6:1 compression ratio with DXT1 (actually, maybe even more, that wiki mentions 6:1 from 24bit RGB to DXT1, but we're currently using RGBA which i assume is 32bit, so 32bit RGBA * 16pixel per chunk / 64bits per DXT1 chunk = 8:1 compression). but converting to that format might take time. will probably do something like, first time an image is loaded, if not correct format it gets converted then overwritten to disk. means all images will be .dds from now on, when this is all worked out. also, it mentions that DXT1 is an extension, not part of opengl spec, so might not work on all gpus?EDIT: yep, 800% compression ratio

thats the first image, the 18.2mb on gpu and 5.8mb on disk. crazy how dxt1 gets even better compression than the original png image (btw thats "race of life" banner)
now next problem is that i used this wand library, its basically image magick. ideal would be to have just dxt1 conversion in python without extra dependencies, but pillow doesnt do that from what i can see. could maybe include the magickwand .dll / .so
Last edited: