Notifications
Clear all
[Closed] Checking scene textures size
Feb 09, 2022 5:32 pm
Hello there
I’m looking for a way to check, in a scene, if there are some maps above 2048 px for example, but I don’t find any existing code I could use. I’ve little experience with MXS, mostly basic UI stuff, and I don’t know where to start with this. Would you please have an idea ?
So far, I’ve only found this piece of code on the web, but I don’t know how to use it for my needs :
tex = getOpenFileName()
bmpTex = openBitmap tex
format "Width:% Height:%
" bmpTex.width bmpTex.height
Thanks in advance for your help !
Regards.
2 Replies
Feb 09, 2022 5:32 pm
For those interested, a friend provided me this:
for i in sceneMaterials do
(
Bmap = getClassInstances BitmapTexture + getClassInstances CoronaBitmap
for i in Bmap do
(
map = openBitmap i.filename
if map.height and map.width >= 2000 then
format "FILENAME:% /// HEIGHT:% WIDTH:%\n" ((getFilenameFile i.filename)+(getFilenameType i.filename)) (map.height) (map.width)
)
)
Now I have to find if it’s possible to resize automatically the maps that exceeds given height/width …
Regards.
Feb 09, 2022 5:32 pm
for i in sceneMaterials do
remove that line, othwerwise you may hang your max for a long long time