I'm looking for a script to make a transparent image from a black-and-white one, that does so by erasing all the white, and replacing the greys with transparent black. This may be possible in other ways that I haven't figured out yet... Is this a scripting problem or is another method better?
yes, script is probably the best way
var image = Document.RasterImage;
var sizeX = image.sizeX;
var sizeY = image.sizeY;
var tmp = Blender.CreateCanvas(sizeX, sizeY, 0);
Blender.Compose(tmp, 0, 0, sizeX, sizeY, image, 0, 0, 0, Blender.OpMapChannels,
Blender.MapChannels(Blender.ChR, Blender.ChG, Blender.ChB, Blender.ChA,
Blender.ChEmpty, Blender.ChEmpty, Blender.ChEmpty, Blender.ChR));
Blender.Compose(tmp, 0, 0, sizeX, sizeY, null, 0, 0, 0xff000000, Blender.OpXor);
Blender.Compose(image, 0, 0, sizeX, sizeY, tmp, 0, 0, 0, Blender.OpSrc);
Perfect! Thank you so much!
You know, maybe a plugin that lets the user (or makes it obvious how to) save scripts would be useful. I've used most of these scripts once or twice...
Adding new functions in a user-friendly manner would be good, but it needs to be well designed. I'll see what can be done.