Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 5. Manipulating Images and Video > Applying basic effects to an image

5.6. Applying basic effects to an image

Changing color values of pixels doesn't mean that you have to create an entire image from scratch; you could always just change the look of something that already exists. One example of this would be basic photo manipulation — the modification of pixels within an image to change the way that it looks. These kinds of effects are trivial to implement in canvas, especially now that you're an expert in pixel manipulation.

5.6.1. Inverting colors

This effect reverses the color values of an image and causes it to look, for lack of a better word, a bit weird. The basic premise is that you subtract the existing color value of a pixel (150), from 255 to reverse, or invert, the color (255-150=105). Let's try something a bit different and go through the code in one go; there's nothing new.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial