PDA

View Full Version : Bitmap, copy Blue channel from one bitmap to another


Gibbz
02-09-2010, 12:22 AM
Hey, im trying to copy the blue channel from one bitmap, into the blue channel of another, whats the quickest way to do this? Im trying to use "pastebitmap" however it just copys the whole lot.

Any ideas? (using getpixels is way to slow)

MattRennie
02-09-2010, 04:11 PM
As Im not sure of the scope of your problem this may be way off base, but why dont you just do an action in photoshop?

jkwiatkowski
02-09-2010, 04:26 PM
Hi,

Anyway there's also a section 'MAXScript FAQ > How To Make It Faster > Never get a single pixel when you can get a whole line' in docs -

regards

jk

Wheiraucher
02-09-2010, 04:55 PM
pastebitmap is the right way to go. You can program custom functions for pasting. it's really nice. should look like this:

fn pasteblue color1 pixel1 color2 pixel2 =
(
res = color2 -- the result will contain the Green and Red of color2
res.b = color1.b --but the Blue from color1
res
)
-- paste the blue channel from bmp1 into the blue channel of bmp2
pastebitmap bmp1 bmp2 [0,0] [0,0] type:#function function:pasteblue

Gibbz
02-09-2010, 10:41 PM
fn pasteblue color1 pixel1 color2 pixel2 =
(
print "oi"
res = color2 -- the result will contain the Green and Red of color2
res.b = color1.b --but the Blue from color1
res
)
-- paste the blue channel from bmp1 into the blue channel of bmp2
pastebitmap bmp1 bmp2 [0,0] [0,0] type:#function function:pasteblue
display bmp2


Ok so this doesnt work either :(
ive added display bmp2 to view the output, and its still just copying all of bmp1 into bmp2... Any ideas why this is?

Edit: added a print in the function, it doesnt even use the function. Using max 2009 sp1

Gibbz
02-09-2010, 11:16 PM
woudl this be possible using .net?

Wheiraucher
02-10-2010, 08:18 AM
hu? weird. works just fine on my computer (using max2010). Maybe if you write function:pasteblue() instead of just function:pasteblue ? But that's just guessing, both are working here...

JHN
02-10-2010, 10:06 AM
pastebitmap bmp1 bmp2 [0,0] [0,0] type:#function function:pasteblue
The function argument is new for 2010.... getSetPixels is the only way. There was a avguard.dlx that shipped with Louis Marcoux stereo cam modifier that enabled the function for 2009, but that would make you dependent on another plugin... Lookup Louis video on stereo camera's I believe files where provided for the script.

-Johan

PiXeL_MoNKeY
02-10-2010, 03:44 PM
You could hack around it by extracting the needed channels in a ColorCorection and then Add the results together through a Composite Map. You can then use rendermap to pass it to the needed bitmap. This should all work within the shipping version of Max, not sure about the resulting speed though.

Not sure about dotnet possibilities, havn't spent much time with dotnet yet.

-Eric

CGTalk Moderation
02-10-2010, 03:44 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.