Notifications
Clear all

[Closed] Output bitmap size?

Hi,

I want to know how I can output bitmap size to my spinner value. Like pick bitmap from c:blaa blaa and output bitmap width to width spinner value and bitmap height to spinner height value…

I tried to find out from “Bitmap Value” section, but I didn’t understund how.:sad:

Thanks.

4 Replies

Bitmaps have a .width and .height property which you can access using maxscript’s dot-notation:

(widthSpinner and heightSpinner in this example are both spinners)

myBMP = openbitmap "C:\\foo.bmp"
widthSpinner.value = myBMP[b].width[/b]
heightSpinner.value = myBMP[b].height[/b]
  • Martijn

Oh yes… That was easy:) If you please help me with one more thing. I want that openbitmap”blaa blaa” would be replaced with some kind of brawser. So user don’t have to type path name inside script. I found Brawse Test but there is only getSavePath so I cant acsess to bitmap files…

Thanks again.

you can directly a load a bit map into the VFB by using the selectbitmap() function, you can assign this bitmap to a variable, i.e

ChosenBitmap = selectbitmap()

–This will kick up an open dialogue for the bitmap, and will assign the bitmap to the variable –“ChosenBitmap”

–From you could use the line

ChosenBitmap.filename

–This will return the path for the bitmap as a string, you can assign this to a variable in the same way

BitmapPath = ChosenBitmap.filename

– now BitmapPath is your bitmap path!

–Finally if you do not want to load the bitmap into the frame buffer then you can easily use –the command

BitmapPath = getBitmapOpenFileName()

–This will kick up a load bitmap dialogue, when you select the file it will record the string –for the pathname in the variable “BitmapPath”, but it will not load the bitmap itself.

If you are building an interface for your tool, then just set the lines to be executed on a button press

Hope this helps dude , good luck with it!

EverZen

Now I can continue my script project. I’m scripting “simple” script to my friend. That create’s plane with picked image size with texture assigned(with bend and segment adjustment). It’s almost done! There is still one little problem, but I’m going to solve it by my self this time

Thanks a lot for kind replys EverZen and Martijn!