• Getting a PNG texture size
    4 replies, posted
Trying to get the size of a PNG material. Tried combining these two but they wouldn't work. [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/surface/GetTextureSize]surface.GetTextureSize[/url] [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Global/Material]Material[/url]
surface.GetTextureSize is only compatible with surface.GetTextureID. But surface.GetTextureID is not compatible with png or jpg meaning you should probs give in. (You can always just look at the initial file size?) Or you can use [URL="http://wiki.garrysmod.com/page/file/Size"]http://wiki.garrysmod.com/page/file/Size[/URL] But you have to grab the material location, shouldn't be hard. [CODE]file.Size( "addons/thing_bob/materials/cool_mat.png", "GAME" )[/CODE] etc
[QUOTE=JacobsReturn;52571432]surface.GetTextureSize is only compatible with surface.GetTextureID. But surface.GetTextureID is not compatible with png or jpg meaning you should probs give in. (You can always just look at the initial file size?) Or you can use [URL="http://wiki.garrysmod.com/page/file/Size"]http://wiki.garrysmod.com/page/file/Size[/URL] But you have to grab the material location, shouldn't be hard. [CODE]file.Size( "addons/thing_bob/materials/cool_mat.png", "GAME" )[/CODE] etc[/QUOTE] Sorry I meant dimensions in pixels not bytes.
[QUOTE=Moat;52571649][img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/IMaterial/Width]IMaterial:Width[/url] [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/IMaterial/Height]IMaterial:Height[/url][/QUOTE] Thank you I completely missed those.
Sorry, you need to Log In to post a reply to this thread.