Skip to content

Latest commit

 

History

History
168 lines (112 loc) · 6.24 KB

README.md

File metadata and controls

168 lines (112 loc) · 6.24 KB

pixel-artist

A toy API to convert any bitmap image in to RGB colours!


Node License: Unlicense.

Demo

Or try it with a random unsplash image

Install & run

Docker

docker run -it --rm -p 80:6451 wisehackermonkey/pixel-artist:latest

Node

npm install
npm start

Docker-compose

docker-compose up

Docker Build from scratch

docker build -t pixel-artist .
docker run -it --rm -p 80:6451 pixel-artist:latest

Open localhost:80

Usage

Reach the hosted API at

https://pixel-artist.herokuapp.com/api/?cols=x&url=y

It accepts two parameters, columns: cols (min 4 max 64 default 32); and url for any valid bitmap image

Fewer columns, the faster! Returns a multidimensional array and some meta data:

{
   "pixels":[
      [
         "rgb(160, 144, 169)",
         "rgb(130, 114, 137)",
         "rgb(85, 108, 128)",
         "rgb(229, 244, 253)"
      ],
      [
         "rgb(208, 205, 220)",
         "rgb(162, 152, 149)",
         "rgb(150, 158, 173)",
         "rgb(123, 137, 152)"
      ],
      ...
   ],
   "meta":{
      "cols":4,
      "rows":5,
      "title":"Starry Night, Van Gogh"
   }
}

New! SVG API!

Returns an .svg image file.

It accepts the same two parameters as a normal API cal, columns: cols (min 4 max 64 default 32); and url for any valid bitmap image

https://pixel-artist.herokuapp.com/svg/?cols=x&url=y

BUT also:

size (dot size, default 12)

gap (gap between the dots, default 2)

background (a background fill that can be any valid css color, rgb, hex (if you use hex, you need to encode the hash to %23 e.g. %23FFFFFF) etc. Default is transparent)

shape ('circle' or 'square' default 'circle')'

https://pixel-artist.herokuapp.com/svg/?shape=square&background=%23bada55&gap=10&size=40&url=https://source.unsplash.com/520x640/?portrait&cols=22&

Try it out!

BTW! It'd be unwise to hotlink to images on the hosted api as heroku has a 30 second cold start so it'll be super slow to load!

Examples

Demo s1 Demo s2 Demo s3
Demo 1 Demo 3 Demo 4
Demo 2 Demo 6 Demo 7
Demo 5 Demo 9 Demo 10
Demo 11 Demo 12 Demo 13
Demo 14 Demo 15 Demo 16
Demo 17 Demo 18 Demo 19
Demo 20 Demo 21 Demo 22

Development

how to publish docker image to docker hub

git clone https://github.com/blackspike/pixel-artist.git

cd pixel-artist

docker build . -t wisehackermonkey/pixel-artist:latest

docker login

docker push wisehackermonkey/pixel-artist:latest

Contributors

Made with contributors-img.

License

This project is licensed under the License: Unlicense.