Java program could not load image file -
i trying run program manipulate individual pixel colors of digital image produce variety of special effects, picture file not loading. saved picture washingtonmonument.jpg , everytime run it, results in black screen says not loaded.
my program is:
import java.awt.* public class truecolorsdemo { public static void main(string[] args) { picture pictureobj = new picture("washingtonmonument.jpg"); pictureobj.explore(); int redvalue = 0; int greenvalue = 0; int bluevalue = 0; pixel targetpixel = new pixel(pictureobj, 0,0); color pixelcolor = null; for(int y=0; y < pictureobj.getheight(); y++) { for(int x = 0; x < pictureobj.getwidth(); x++) { targetpixel = pictureobj.getpixel(x,y); pixelcolor = targetpixel.getcolor(); redvalue = pixelcolor.getred(); greenvalue = pixelcolor.getgreen(); bluevalue = pixelcolor.getblue(); pixelcolor = new color(redvalue, greenvalue, bluevalue); targetpixel.setcolor(pixelcolor); } } pictureobj.explore(); pictureobj.write("newwashingtonmonument.jpg"); pictureobj.show(); } }
if me figure out how load picture work on program great! thanks
Comments
Post a Comment