colors - What is high performance for creating a TIF image from a background TIF and a foreground TIF in java -
i have 2 tif files, 1 background (overlay) , other foreground. following code used combining 2 tifs.
// background color of foreground image int w = color.white.getrgb(); // fill pixels not background color (int = 0; < foregroundimage.getwidth(); i++) { (int j = 0; j < foregroundimage.getheight(); j++) { int x = foregroundimage.getrgb(i, j); if (x != w) backgroundimage.setrgb(i, j, x); } } is there other way has better performance this?
you can make color.white pixels transparent using rgbimagefilter, shown here, or lookupop, mentioned here. can use alphacomposite.src_over rule combine images. alphacompositedemo example lets 1 explore available modes, , there's related example here. of course, you'll need profile both approaches see faster.
Comments
Post a Comment