Question: Please edit the following java code so that it returns the negative of the picture rather than the grayscale of the picture. This needs to

Please edit the following java code so that it returns the negative of the picture rather than the grayscale of the picture. This needs to be made into a function that will go into utilities file. Use https://introcs.cs.princeton.edu/java/stdlib/ to build off of.

import java.awt.Color; public class Inverted { public static void main(String[] args) {

Picture pic =new Picture(args[0]); for(int x =0; x < pic.width(); x++) { for(int y =0; y < pic.height(); y++) { Color color = pic.get(x, y); Color gray = Luminance.toGray(color); pic.set(x, y, gray); } } pic.show(); } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!