Notifications
Clear all

[Closed] Problem resizing bitmap

Hey guys,
I’m trying to resize a bitmap using methods described here:
http://forums.cgsociety.org/showthread.php?f=98&t=894679&highlight=resize+scale+bitmap

With this method though:

  ( 	
  db = viewport.getViewportDib() 	
  db.filename = (getdir #temp) + "\	emp_dib.bmp" 	
  save db 	
  tx = bitmaptexture bitmap:db 	
  rendermap tx into:bb size:([db.width,db.height]/4) filter:on display:on 		 
  format "original size: % %
" db.width db.height 	
 format "rendered size: % %
" bb.width bb.height 
 )
I'm getting this error:
-- Type error: renderMap requires BitMap, got: undefined

I’m pretty sure tx has been defined and the help file says that bitmaptexture is a subclass of texturemap, which is what renderMap wants. Any ideas what I’m doing wrong?

Thanks.
8 Replies

where’s bb defined ?

If you specify the optional into: argument, the function renders the map into the supplied bitmap, taking size and other attributes from the existing bitmap. If you don’t, a new bitmap value is created using the size: and fileName: arguments in its creation. Default size: value is [200,200].

I just copied the code from the other thread and thought it would work but reading this again in the help makes it seems like specifying the “into” makes it expect an existing bitmap. When I first read it I thought “into” was creating a new bitmap for you out of the size and filename params.

everything works for me:

b =	viewport.getViewportDib() 
b.filename = getdir #temp + @"	emp.tga"	
save b
a = rendermap (bitmaptexture bitmap:b) size:[b.width/2, b.height*2] display:on 

yeah… bb has to be a bitmap

ok, thanks guys! I just removed “into:bb” and left everything else the same and it works great.

1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

do you need to preserve an alpha channel? do you want to make just thumbnails(icons)?

I was just making pose snapshot thumbnails but alpha preservation sounds pretty useful. How’s that done?

i just have wanted to say that if you don’t need alpha it’s would be better and faster to use .net rescale methods. you can find a sample on this forum