Advertisement
from_scratch

swapping the red and green pixels in an image

Oct 8th, 2015
342
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function swapRedGreen(pixel){
  2.     var tempRedValue = pixel.getRed();
  3.     pixel.setRed(pixel.getGreen());
  4.     pixel.setGreen(tempRedValue);
  5. }
  6. var image = new SimpleImage("drewRobert.png");
  7. print(image);
  8. for(var pix of image.values()){
  9.     swapRedGreen(pix);
  10. }
  11. print(image);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement