Exploratory Programming for the Arts and Humanities (MIT Press) by Nick Montfort
Author:Nick Montfort [Montfort, Nick]
Language: eng
Format: mobi, epub, pdf
ISBN: 9780262034203
Publisher: The MIT Press
Published: 2016-04-08T04:00:00+00:00
8.3 Pixel-by-Pixel Image Manipulation
For simplicity’s sake, even though we created one nice rose-colored rectangle, we’ll begin this section by discussing grayscale images, images where the all the color values have the same amount of red, blue, and green. We’ll use images of the same standard format, PNG. Leaving color for later is not an unusual way to proceed. In programming, it’s often good to start with simpler versions of a problem. In visual art and design, intensity (dark and light) is often dealt with before color.
With the exception of allrose.png, the images we created in the previous section—allwhite.png, allgray.png, allblack.png, almostall.png, and oneline.png—are all grayscale PNGs. For image manipulation purposes, obtain a different grayscale PNG image from the Web. Look for something with some detail and with different level of grays, and for an image that isn’t horizontally or vertically symmetric. A photograph or a scanned charcoal drawing will work; line drawings or images that consist of words (type) are not best. Entirely black rectangles will be a particularly bad choice. If you can’t find a suitable image, just create one quickly in a drawing program.
In a PNG image, the intensity of each pixel varies between 0 (no light, a completely black pixel) and 255 (the maximum amount of light, a white pixel). It might be easier to think about if the range went from 0 to 100 and we could simply specify a percentage of light, but the 256 possible values of intensity correspond to the values that can be stored in a single byte, which has eight binary digits (or bits). These bits can each be 1 or 0, on or off, and since there are eight of them in order there are 28 = 256 possibilities. If we start counting from 0, our first value, 255 is our 256th value, the maximum number.
It isn’t essential to know about the architecture of computers to understand how to program them effectively; one of the types of abstraction that developers of programming languages have striven to implement is the ability to think about computation and problem-solving independent of hardware. It can be good to know that when “255” and similar values crop up, however, they are not being placed capriciously or maliciously by the creators of different systems. They actually relate to underlying aspects of computer systems.
Some programming environments do allow for percentages or similar values to be specified instead of numbers in the range from 0 to 255, and this can be a help to new programmers. John Maeda’s design by numbers (DBN), a predecessor of Processing, works this way. Even in this age of high-level languages and abstraction, however, there are very good reasons to use the computer’s native representation. If one can only specify an integer value between 0 and 100, any mapping that is used will be uneven and it will not be possible to indicate many native color values (the other 155 of them). If one is allowed to specify a floating-point number between 0
Download
Exploratory Programming for the Arts and Humanities (MIT Press) by Nick Montfort.epub
Exploratory Programming for the Arts and Humanities (MIT Press) by Nick Montfort.pdf
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Secrets of the JavaScript Ninja by John Resig & Bear Bibeault(6541)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(6425)
Kotlin in Action by Dmitry Jemerov(5074)
Odoo 15 Development Essentials - Fifth Edition by Daniel Reis & Greg Mader(3404)
Odoo 15 Development Essentials by Daniel Reis(2822)
React Native - Building Mobile Apps with JavaScript by Novick Vladimir(2540)
Learning Angular - Second Edition by Christoffer Noring(2365)
Pride and Prejudice by Jane Austen(2354)
Mobile Forensics Cookbook by Igor Mikhaylov(2025)
Computers For Seniors For Dummies by Nancy C. Muir(2009)
Bulletproof Android: Practical Advice for Building Secure Apps (Developer's Library) by Godfrey Nolan(1878)
Android Development with Kotlin by Marcin Moskala & Igor Wojda(1806)
Building Android UIs with Custom Views by Raimon Ràfols Montané(1797)
1936941139 (N) by Bob Rosenthal(1741)
Building Progressive Web Apps: Bringing the Power of Native to the Browser by Ater Tal(1734)
Hands-On Internet of Things with MQTT by Tim Pulver(1718)
Android App Development by Franceschi Hervé J.;(1716)
Ember.js in Action by Joachim Haagen Skeie(1695)
Hands-On Design Patterns with React Native by Mateusz Grzesiukiewicz(1660)
