Skip to main content

How to get white background instead of default black background.

Please note these java.net forums are being decommissioned and use the new and improved forums at https://community.oracle.com/community/java.
1 reply [Last post]
crellion
Offline
Joined: 2010-12-10
Points: 0

I am currently using TranslateDescriptor and MosaicDescriptor to merge some images (separate JPEGs) into a single image. I am fine-tunning the pixel-mapping translations for source-image 1 and source-image 2 to fit it correctly in my resulting image dimension and aspect ratio (all done in a matrix array.) However, since the source-images aren't fitting well, I am seeing black-backgrounds in all the "gaps" of the merged image.
I know that means - JAI is rendering it as a blank-space in its canvas, but how do I make it white-color instead of the default blank-black?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
paulgmx
Offline
Joined: 2005-07-20
Points: 0

Set the mosaic ParameterBlock backgroundValues to white
double[] backGroundColor = new double[] {255.0, 255.0, 255.0};
mosaicParams.set(backGroundColor, 4);