java - When reassigning color to pixels, all color is black -
simplified code:
public static void main(string[]args) throws exception { bufferedimage img = new bufferedimage(512, 512, bufferedimage.type_int_argb); (int = 0; < 512; i++) { (int j = 0; j < 512; j++) { if (complex.getinfinite()) { color newcol = new color(100, 0, 0); img.setrgb(i, j, newcol.getrgb()); } if (complex.getinfinite() == false) { color newcol = new color(0, 0, 100); img.setrgb(i, j, newcol.getrgb()); } } } saveimage(img, new file("julia.jpg")); }
my problem when run program, julia.jpg black image.
have played around amount of pixels color , pixels coloring turn black.
i wondering if issue when generated image gave wrong type.
change
bufferedimage img = new bufferedimage(512, 512, bufferedimage.type_int_argb);
to
bufferedimage img = new bufferedimage(512, 512, bufferedimage.type_int_bgr);
more details: bufferedimage.type_int_bgr
Comments
Post a Comment