diff --git a/common/source/java/ch/systemsx/cisd/common/image/MixColors.java b/common/source/java/ch/systemsx/cisd/common/image/MixColors.java index 68bfc57747ef9588559ec6cc7812dae0017ce67e..ca8291c4fbe12c42ff8bdcf2c9a64505da083fd0 100644 --- a/common/source/java/ch/systemsx/cisd/common/image/MixColors.java +++ b/common/source/java/ch/systemsx/cisd/common/image/MixColors.java @@ -302,8 +302,13 @@ public class MixColors } } - final float whitePointFactor = 255f / getMaxComponent(whitePointColor.getRed(), whitePointColor.getGreen(), whitePointColor.getBlue()); + float maxComponent = getMaxComponent(whitePointColor.getRed(), whitePointColor.getGreen(), whitePointColor.getBlue()); + float whitePointFactor = 1; + if (maxComponent != 0) + { + whitePointFactor = 255f / maxComponent; + } final BufferedImage mixed = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); // apply white point adjustments to the final image