// write your code here
function swapRedGreen(pixel){
G = pixel.getGreen();
R = pixel.getRed();
if (G >= 200 ){
pixel.setRed(255);
pixel.setGreen(0);
return true
}
if (R >= 200){
pixel.setRed(0);
pixel.setGreen(255);
return true;
}
}
var image = new SimpleImage("smallhands.png");
print (image);
for (pixel of image.values()){
pixel = swapRedGreen(pixel);
}
print (image);
No comments:
Post a Comment