Brail to pixels

Brail to pixels

by Konstantin Cryman

HTML

<button id='upload_image'>upload</button>
<br />
<input id='contrast_control' type='range' min="0.01" max="1" step="0.01"> contrast_control
<br />
<canvas id='workCan'></canvas>
<div id="text_display" width='400px'>

</div>

JavaScript

const brush = [
  "⠀",
  "⠁",
  "⠂",
  "⠃",
  "⠄",
  "⠅",
  "⠆",
  "⠇",
  "⠈",
  "⠉",
  "⠊",
  "⠋",
  "⠌",
  "⠍",
  "⠎",
  "⠏",
  "⠐",
  "⠑",
  "⠒",
  "⠓",
  "⠔",
  "⠕",
  "⠖",
  "⠗",
  "⠘",
  "⠙",
  "⠚",
  "⠛",
  "⠜",
  "⠝",
  "⠞",
  "⠟",
  "⠠",
  "⠡",
  "⠢",
  "⠣",
  "⠤",
  "⠥",
  "⠦",
  "⠧",
  "⠨",
  "⠩",
  "⠪",
  "⠫",
  "⠬",
  "⠭",
  "⠮",
  "⠯",
  "⠰",
  "⠱",
  "⠲",
  "⠳",
  "⠴",
  "⠵",
  "⠶",
  "⠷",
  "⠸",
  "⠹",
  "⠺",
  "⠻",
  "⠼",
  "⠽",
  "⠾",
  "⠿",
  "⡀",
  "⡁",
  "⡂",
  "⡃",
  "⡄",
  "⡅",
  "⡆",
  "⡇",
  "⡈",
  "⡉",
  "⡊",
  "⡋",
  "⡌",
  "⡍",
  "⡎",
  "⡏",
  "⡐",
  "⡑",
  "⡒",
  "⡓",
  "⡔",
  "⡕",
  "⡖",
  "⡗",
  "⡘",
  "⡙",
  "⡚",
  "⡛",
  "⡜",
  "⡝",
  "⡞",
  "⡟",
  "⡠",
  "⡡",
  "⡢",
  "⡣",
  "⡤",
  "⡥",
  "⡦",
  "⡧",
  "⡨",
  "⡩",
  "⡪",
  "⡫",
  "⡬",
  "⡭",
  "⡮",
  "⡯",
  "⡰",
  "⡱",
  "⡲",
  "⡳",
  "⡴",
  "⡵",
  "⡶",
  "⡷",
  "⡸",
  "⡹",
  "⡺",
  "⡻",
  "⡼",
  "⡽",
  "⡾",
  "⡿",
  "⢀",
  "⢁",
  "⢂",
  "⢃",
  "⢄",
  "⢅",
  "⢆",
  "⢇",
  "⢈",
  "⢉",
  "⢊",
  "⢋",
  "⢌",
  "⢍",
  "⢎",
  "⢏",
  "⢐",
  "⢑",
  "⢒",
  "⢓",
  "⢔",
  "⢕",
  "⢖",
  "⢗",
  "⢘",
  "⢙",
  "⢚",
  "⢛",
  "⢜",
  "⢝",
  "⢞",
  "⢟",
  "⢠",
  "⢡",
  "⢢",
  "⢣",
  "⢤",
  "⢥",
  "⢦",
  "⢧",
  "⢨",
  "⢩",
  "⢪",
  "⢫",
  "⢬",
  "⢭",
  "⢮",
  "⢯",
  "⢰",
  "⢱",
  "⢲",
  "⢳",
  "⢴",
  "⢵",
  "⢶",
  "⢷",
  "⢸",
  "⢹",
  "⢺",
  "⢻",
  "⢼",
  "⢽",
  "⢾",
  "⢿",
  "⣀",
  "⣁",
  "⣂",
  "⣃",
  "⣄",
  "⣅",
  "⣆",
  "⣇",
  "⣈",
  "⣉",
  "⣊",
  "⣋",
  "⣌",
  "⣍",
  "⣎",
  "⣏",
  "⣐",
  "⣑",
  "⣒",
  "⣓",
  "⣔",
  "⣕",
  "⣖",
  "⣗",
  "⣘",
  "⣙",
  "⣚",
  "⣛",
  "⣜",
  "⣝",
  "⣞",
  "⣟",
  "⣠",
  "⣡",
  "⣢",
  "⣣",
  "⣤",
  "⣥",
  "⣦",
  "⣧",
  "⣨",
  "⣩",
  "⣪",
  "⣫",
  "⣬",
  "⣭",
  "⣮",
  "⣯",
  "⣰",
  "⣱",
  "⣲",
  "⣳",
  "⣴",
  "⣵",
  "⣶",
  "⣷",
  "⣸",
  "⣹",
  "⣺",
  "⣻",
  "⣼",
  "⣽",
  "⣾",
  "⣿"
];

const normalizeData = ( __data ) => {

  const normalized = [];

  for( let i = 0; i < __data.data.length; i+=4  ){

    const r = __data.data[ i ];
    const g = __data.data[ i + 1 ];
 ...