View Full Version : Output bitmap size?
03 March 2005, 10:14 AM
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:
03 March 2005, 11:17 AM
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.width
heightSpinner.value = myBMP.height
03 March 2005, 12:19 PM
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 (http://www.3d-designer.dk/maxscript/) but there is only getSavePath so I cant acsess to bitmap files...
03 March 2005, 01:03 PM
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
--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!
03 March 2005, 02:26 PM
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 :D
Thanks a lot for kind replys EverZen and Martijn!
03 March 2005, 02:26 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.