A function to check dimensions directly from a png during data stage.
Why?
I have icons of different sizes and would like to automatically set icon.size and icon.mipmaps according to png dimensions.
Currently I can get away with smart sorting and deriving that information from the path with lookup tables.
Factorio already loads and checks dimensions of files designated by icon, sprite.filename, asf so there shouldn't be an added security issue exposing the function like
Code: Select all
local width, height = get_sprite_dimensions(filename)