User Tools

Site Tools


ascii_art

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
ascii_art [2023/03/25 14:23] – [ASCII Art] frchrisascii_art [2023/03/25 14:30] – [Step 3. Convert the RGB tuples of your pixels into single brightness numbers] frchris
Line 201: Line 201:
  
 ==== Step 3. Convert the RGB tuples of your pixels into single brightness numbers  ==== ==== Step 3. Convert the RGB tuples of your pixels into single brightness numbers  ====
 +
 +Now that you have a 2D Array of ''Color'', you can use the ''Color'' methods of ''getRed()'', ''getGreen()'', and ''getBlue()'' to assign a single brightness number.   There are many different ways to map RGB values to brightness, and each produces a slightly different style of transformed image. Think of them like Instagram filters. Some examples:
 +  - Average: average the R, G and B values - ''(R + G + B) / 3''
 +  - Lightness: average the maximum and minimum values out of R, G and B - ''max(R, G, B) + min(R, G, B) / 2''
 +  - Luminosity: take a weighted average of the R, G and B values to account for human perception - ''0.21 R + 0.72 G + 0.07 B''
 +  - See [[https://stackoverflow.com/questions/596216/formula-to-determine-brightness-of-rgb-color|this stackoverflow thread]] for more detail
 +
 ==== Step 4. Convert brightness numbers to ASCII characters  ==== ==== Step 4. Convert brightness numbers to ASCII characters  ====
 ==== Step 5. What if it looks your image looks squashed? ==== ==== Step 5. What if it looks your image looks squashed? ====
ascii_art.txt · Last modified: 2023/03/27 10:46 by frchris

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki