This book is now obsolete Please use CSAwesome instead.

18.1. Compute with Images

Let’s swap the colors in the image. The program below does that.

There are lot of lines in the program below. Don’t worry if they don’t all make sense to you right now.

  • Especially when we write programs to manipulate images, you can ignore many of the lines. All the code in the Image Classes container you don’t need to worry about. It helps us render and display the image.

  • Words after the \\ or in \* *\ are ignored by the computer. They are comments to human readers to help them understand a program.

  • The code in the main method at the bottom is what important at the moment.

Press the run button button to run the program and show the changed image. Please note that processing all those pixels can take a few minutes.

Let’s try another activecode with the SimplePicture class included:

You have attempted of activities on this page