Advertisement
from_scratch

increasing the red color for each pixel in an image

Oct 8th, 2015
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function moreRed(pixel, increaseRedByXpixels){
  2.     var red = pixel.getRed() + increaseRedByXpixels;
  3.     if(red > 255){
  4.         red = 255;
  5.     }
  6.     pixel.setRed(red);
  7. }
  8. var image = new SimpleImage("pixabayhands.jpg");
  9. print(image);
  10. for(var pix of image.values()){
  11.     moreRed(pix, 80);
  12. }
  13. print(image);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement