Notifications
Clear all
[Closed] what am i doing wrong?
Jul 12, 2014 5:14 am
I am trying to grab my viewport and resize it in half and save it.
I googled and stumbled upon answers by denisT, about year back, and constructed this code.
function bitmap_creator =(
--grabbs the viewport
viewgrab = gw.getViewportDib()
viewgrab.filename = getdir #temp + @" emp_dib.jpg"
save viewgrab
scaled_image= rendermap (bitmaptexture bitmap:viewgrab) size:[viewgrab.width/2, viewgrab.height/2] display:on filter:on
scaled_image.filename = getFilenamePath(getSourceFileName()) + "\\snapgrabs\\"+ edt1.text + ".jpg"
save scaled_image
free viewgrab
close viewgrab
)
the problem is, everytime i call this function, it scales down old viewport grab instead of new one.
(i have to call this function twice, to get the current screengrab scaled and saved)
save viewgrab
do his job right, but rendermap command always take the old screengrab and scale it.
any ideas on what i’m doing wrong?
3 Replies
Jul 12, 2014 5:14 am
It is simpler : just make a copy of your grab bitmap in a smaller bitmap and it’s done !
(
viewgrab = gw.getViewportDib()
half_viewgrab = bitmap (viewgrab.width/2) (viewgrab.height/2) -- create an empty half bitmap
half_viewgrab = copy viewgrab half_viewgrab -- copy the first one to the half one (this keeps whole image, no crop)
half_viewgrab.filename = @"c:\somewhere o\save.jpg"
save half_viewgrab
display half_viewgrab
)
Jul 12, 2014 5:14 am
Thanks bro… i have switched to your method. I was trying to use that previous method to get a smoother image. copy does the thing but the result is not smooth…