Create a Border Around an Image

Solve It

Again, we are creating a picture of a white image with a black frame. This time we use the logic operator "or" to describe the regions that should be colored black.

Code It

// border frame refactored var image = new SimpleImage(300,200); print(image); for (var p of image.values()) { p.setRed(255); p.setGreen(255); p.setBlue(255); if (p.getX() < 10 || p.getY() < 10 || p.getX() > 289 || p.getY() > 189) { p.setGreen(0); p.setBlue(0); p.setRed(0); } } print(image);

See It

 
 

Available Images

Drop your images onto the area above to make it available within your code editor on this page. Note: your images will not be uploaded anywhere, they will stay on your computer.