05.05.2013 Views

Programming PHP

Programming PHP

Programming PHP

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Text Representation of an Image<br />

An interesting use of the ImageColorAt( ) function is to loop through each pixel in an<br />

image and check the color, and then do something with that color data. Example 9-13<br />

displays a # character in the appropriate color for each pixel.<br />

Example 9-13. Converting an image to text<br />

<br />

<br />

<br />

The result is an ASCII representation of the image, as shown in Figure 9-15.<br />

Figure 9-15. ASCII representation of an image<br />

232 | Chapter 9: Graphics<br />

This is the Title of the Book, eMatter Edition<br />

Copyright © 2002 O’Reilly & Associates, Inc. All rights reserved.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!