I am trying to darken an image in java but instead it is turning plain black.
Here is the code that i am using..
float[] elements = {factor};
Kernel kernel = new Kernel(1, 1, elements);
ConvolveOp op = new ConvolveOp(kernel);
BufferedImage bufferedImage = new BufferedImage(image.getWidth(), image.getHeight(), image.getType());
op.filter(image, bufferedImage);
Any ideas what I am doing wrong?
I think you are missing the right number for the factor, a really good way to experiment with this is with the Gimp, you can go to filters -> generic -> convolution matrix and try out different factors, I can darken my image with a factor 0.7 and very low becomes too black.
Let me know how it went.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With