PDA

View Full Version : Resize an image ?


Xlars
11-20-2003, 10:57 PM
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

magicm
11-21-2003, 09:49 AM
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

Xlars
11-21-2003, 04:05 PM
Thank you very much Magicm, I will try that out - never imagined that a copy could be used this way.

Thanks

Bobo
11-23-2003, 12:31 PM
Originally posted by xlars.dk
Thank you very much Magicm, I will try that out - never imagined that a copy could be used this way.

Thanks


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

Xlars
11-23-2003, 06:32 PM
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

CGTalk Moderation
01-16-2006, 05:00 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.