[Closed] Bitmap, copy Blue channel from one bitmap to another
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)
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?
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
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
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
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…
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
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