Java에서 "Duotone"효과를 구현할 수있는 방법이 있습니까?Java에서 "Duotone"효과를 구현하는 방법
내가하고 싶은 것의 좋은 예는 here 또는 내가 BandCombineOp 도움이 될 것 같아요
here입니다. 나에게 그것을 먼저 회색으로 변환하고 임계 효과와 같은 부드럽게 적용해야합니다. 하지만 좋은 결과물을 얻을 수 없었습니다.
또한이 효과를 위해 색상을 설정하는 방법을 모르겠다.
float[][] grayMatrix = new float[][]
{
new float[] {0.3f, 0.3f, 0.3f},
new float[] {0.3f, 0.3f, 0.3f},
new float[] {0.3f, 0.3f, 0.3f},
};
float[][] duoToneMatrix = new float[][]
{
new float[] {0.1f, 0.1f, 0.1f},
new float[] {0.2f, 0.2f, 0.2f},
new float[] {0.1f, 0.1f, 0.1f},
};
BufferedImage src = ImageIO.read(new File("X:\\photoshop_image_effects.jpg"));
WritableRaster srcRaster = src.getRaster();
// make it gray
BandCombineOp bco = new BandCombineOp(grayMatrix, null);
WritableRaster dstRaster = bco.createCompatibleDestRaster(srcRaster);
bco.filter(srcRaster, dstRaster);
// apply duotone
BandCombineOp duoToneBco = new BandCombineOp(duoToneMatrix, null);
WritableRaster dstRaster2 = bco.createCompatibleDestRaster(dstRaster);
duoToneBco.filter(dstRaster, dstRaster2);
BufferedImage result = new BufferedImage(src.getColorModel(), dstRaster2, src.getColorModel().isAlphaPremultiplied(), null);
ImageIO.write(result, "png", new File("X:\\result_duotone.png"));
내 출력 난 당신이 그 luminosity를 변경하지 않고 이미지의 색상을 변경하려고 무엇을 말할 수에서