doubling image size

// write your code here
//selecting the image i wanted to enlarge
var smallImage = ("smalllion.jpg");
//creating a blank image which is having twice as size of original image
var bigImage =   ("smallImage.getWidth() *2 , smallImage.getHeight() *2");
for (var px of bigImage.values()){
    var x = px.getX();
    var y = px.getY();
    var calx = Math.floor(x/2);
    var caly = Math.floor(y/2);
    var smallPixel = smallImage.getPixel(calx,caly);
    px.setRed(smallPixel.getRed());
    px.setGreen(smallPixel.getGreen());
    px.setBlue(smallPixel.getBlue());
}
print (bigImage);

Comments

Popular posts from this blog

Choose Your Social Media Channels Week 5 Quiz