Notifications
Clear all

[Closed] Resize an image ?

I wonder if anyone here could help me on how to resize an image file using max script in Max 5.1

I am working on a small script where I the user can select an image file, and based on his selection I want to show a small version of the image in the UI (as a bitmap).

In the help there seems to be no easy way to do a resize of a bitmap, and I wonder if anyone has an idea on how to do this?

Thanks

4 Replies

You can use the copy method to do this.

Excerpt from the online reference:

copy <source_bitmap> <dest_bitmap>

Copies the source bitmap to the destination bitmap. If the size of the two bitmaps is different, the image will be scaled to fit the destination bitmap.

Martijn

Thank you very much Magicm, I will try that out – never imagined that a copy could be used this way.

Thanks

Originally posted by xlars.dk
[B]Thank you very much Magicm, I will try that out – never imagined that a copy could be used this way.

Thanks [/B]

While it works for stuff like quick previews, the result of the copying is not very smooth as it does not interpolate, it only repeats or skips pixels as necessary.

You can write your own resizing function using a bitmapTexture map and the renderMap method. This will use the Max renderer and will give you the option to filter the map.

Hope this helps.

Cheers,
Bobo

Thank you very much Bobo I had also been thinking in the lines rendering the image somehow to get some nicer antializing etc., before Martijn gave me the idea with the copy (which as you also say gives nice results for quick previews etc.).

Your suggestion using the renderMap method is brilliant. I am currently studying the documentation more closely.

Thanks