GithubHelp home page GithubHelp logo

zaxoavoki / jpg-to-ascii Goto Github PK

View Code? Open in Web Editor NEW
2.0 0.0 0.0 406 KB

๐Ÿ’ซ JPG to ASCII chars image converter

Home Page: https://jpg-to-ascii.herokuapp.com/

HTML 15.18% JavaScript 69.12% SCSS 15.70%
jpg ascii-art ascii converter

jpg-to-ascii's Introduction

JPG to ASCII

Converts JPG picture into ASCII symbols. The project was build with JavaScript.

Screenshot Screenshot

How to run

To run this project on your own machine follow these steps:

  • Clone this repository with git clone https://github.com/zaxoavoki/jpg-to-ascii.git
  • Install all dependencies with npm install
  • Run npm run build and npm run start or simply npm run dev

or check it out here.

About project

Mapping image data

I have used jpeg-js library to read image data. The sRGB (stardard Reg Green Blue) color space is defined in terms of the CIE 1931 linear luminance Ylin, which is given by:

Ylin = 0.2126 Rlin + 0.7152 Glin + 0.0722 * Blin

After mapping each pixel to grayscale with this formula (e.g. rgba(255, 255, 255, 0) => 254.998) I have replaced given value with most suitable one in ascii_map.json.

Resizing image

To make an image smaller I have used an algorithm that just removes every second row or column (depends on what we resize - height or width).

To get number of squeeze times I used tricky formula 2^x = width / 170px.

To-do

  • Add extended ASCII map
  • Add support for other image formats

jpg-to-ascii's People

Contributors

zaxovaiko avatar

Stargazers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.