var picture = new SimpleImage("usain.jpg");
print(picture);
picture.setSize(50, 50);
print(picture);
var pixel = picture.getPixel(25, 25);
print(pixel);
print(pixel.getRed());
pixel.setRed(35);
print(pixel.getRed());
print ("The picture contains: " + picture.values().length + " pixels" );
for(var pix of picture.values()) {
print(pix);
}
var picture = new SimpleImage("palm-and-beach.png");
print (picture);
function maxRed() {
for(var pixel of picture.values()) {
//Make any modifications below
pixel.setRed(255);
}
print(picture)
}
maxRed();
*/
//Get the green screen image
var greenScreen = new SimpleImage("drewRobert.png");
//Get a background image
var background = new SimpleImage("dinos.png");
//Use the green screen image to make a new image that combines green screen and background
var greenWidth = greenScreen.getWidth();
var greenHeight = //Finsh this
var finalImage = new SimpleImage(//Add Values);
//Set a green pixel tolerance--change and see results
var greenTolerance = 200;
function makeGreenScreen() {
//Loop through all the pixels of greenScreen
for(var pixel of greenScreen.values()) {
//Get the coordinates of current pixel
var x = pixel.getX();
var y = //You finish
//Determine if green pixel is above tolerance
if(/*Add Condition */) {
var backgroundPix = background.getPixel(x, y);
finalImage.setPixel(/*Add Values*/);
}
else {
//Set it to the green screen pixel
}
}
//Change the 3 to whatever will make the image fit your screen
finalImage.setSize(greenWidth/3, greenHeight/3);
print(finalImage);
}
//Call the above function