Skip to content

Commit

Permalink
added readme
Browse files Browse the repository at this point in the history
  • Loading branch information
blackspike committed Feb 1, 2021
1 parent ed8edfc commit dce837b
Show file tree
Hide file tree
Showing 88 changed files with 101 additions and 11 deletions.
78 changes: 73 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,77 @@
# colorpixel
# pixel-artist

Turns images into pixelated colour streams!
A toy API to convert any bitmap image in to RBA colours!

## Try these
## Install & run

https://upload.wikimedia.org/wikipedia/en/thumb/b/bc/Old_guitarist_chicago.jpg/1280px-Old_guitarist_chicago.jpg
```
npm install
```

https://artvee.com/saconud/sftb/204299DI01fg.jpg
```
node index.js
```

## Usage

Reach the 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:

```json
{
"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"
}
}
```

## Examples

[![Demo 1](public/screengrabs/thumbs/demo_1.png)](public/screengrabs/demo_1.png)
[![Demo 3](public/screengrabs/thumbs/demo_3.png)](public/screengrabs/demo_3.png)
[![Demo 4](public/screengrabs/thumbs/demo_4.png)](public/screengrabs/demo_4.png)
[![Demo 2](public/screengrabs/thumbs/demo_2.png)](public/screengrabs/demo_2.png)
[![Demo 6](public/screengrabs/thumbs/demo_6.png)](public/screengrabs/demo_6.png)
[![Demo 7](public/screengrabs/thumbs/demo_7.png)](public/screengrabs/demo_7.png)
[![Demo 5](public/screengrabs/thumbs/demo_5.png)](public/screengrabs/demo_5.png)
[![Demo 9](public/screengrabs/thumbs/demo_9.png)](public/screengrabs/demo_9.png)
[![Demo 10](public/screengrabs/thumbs/demo_10.png)](public/screengrabs/demo_10.png)
[![Demo 11](public/screengrabs/thumbs/demo_11.png)](public/screengrabs/demo_11.png)
[![Demo 12](public/screengrabs/thumbs/demo_12.png)](public/screengrabs/demo_12.png)
[![Demo 13](public/screengrabs/thumbs/demo_13.png)](public/screengrabs/demo_13.png)
[![Demo 14](public/screengrabs/thumbs/demo_14.png)](public/screengrabs/demo_14.png)
[![Demo 15](public/screengrabs/thumbs/demo_15.png)](public/screengrabs/demo_15.png)
[![Demo 16](public/screengrabs/thumbs/demo_16.png)](public/screengrabs/demo_16.png)
[![Demo 17](public/screengrabs/thumbs/demo_17.png)](public/screengrabs/demo_17.png)
[![Demo 18](public/screengrabs/thumbs/demo_18.png)](public/screengrabs/demo_18.png)
[![Demo 19](public/screengrabs/thumbs/demo_19.png)](public/screengrabs/demo_19.png)
[![Demo 20](public/screengrabs/thumbs/demo_20.png)](public/screengrabs/demo_20.png)
[![Demo 21](public/screengrabs/thumbs/demo_21.png)](public/screengrabs/demo_21.png)
[![Demo 22](public/screengrabs/thumbs/demo_22.png)](public/screengrabs/demo_22.png)

## License

This project is licensed under the [unlicense](https://unlicense.org/).
9 changes: 5 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const app = express()
const cors = require('cors')
const path = require('path');
app.use(cors())
app.use(express.static(path.join(__dirname, '/public')));
const port_number = process.env.PORT || 6451


Expand Down Expand Up @@ -41,7 +42,7 @@ async function makePixels(imageURL, cols = 32) {
const currentRandomImage = randomImage();

// If no image url passed, just show one of the demo images
const fileOrUrl = imageURL ? encodeURI(imageURL) : path.join(__dirname + '/static/art/' + currentRandomImage.file);
const fileOrUrl = imageURL ? encodeURI(imageURL) : path.join(__dirname + '/public/art/' + currentRandomImage.file);

// Set col min/max
if(cols > 64) {
Expand Down Expand Up @@ -113,9 +114,9 @@ app.get('/api', async (req, res) => {
// Serve index.html
// -----------------------------------------------------------------------------

app.get('/', async (req, res) => {
res.sendFile(path.join(__dirname + '/static/index.html'));
})
app.get('/', (req, res) => {
res.send('Hello World!');
});

// -----------------------------------------------------------------------------
// Listen
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "colorpixel",
"name": "pixelartist",
"version": "1.0.0",
"description": "",
"main": "index.js",
Expand Down
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
Binary file added public/crap/meta-1200x628.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
23 changes: 22 additions & 1 deletion static/index.html → public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,32 @@
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="icon" href="favicon.ico" />
<link rel="icon" href="/crap/favicon.ico" />
<title>Pixel Artists by Blackspike.com</title>
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/lib/anime.min.js"></script>

<meta name="description" content="A toy API to convert any bitmap image in to RBA colours!">

<!-- Google / Search Engine Tags -->
<meta itemprop="name" content="Pixel Artists by Blackspike.com">
<meta itemprop="description" content="A toy API to convert any bitmap image in to RBA colours!">
<meta itemprop="image" content="https://pixel-artist.herokuapp.com/crap/meta-1200x628.png">

<!-- Facebook Meta Tags -->
<meta property="og:url" content="http://pixel-artist.herokuapp.com">
<meta property="og:type" content="website">
<meta property="og:title" content="Pixel Artists by Blackspike.com">
<meta property="og:description" content="A toy API to convert any bitmap image in to RBA colours!">
<meta property="og:image" content="https://pixel-artist.herokuapp.com/crap/meta-1200x628.png">

<!-- Twitter Meta Tags -->
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="Pixel Artists by Blackspike.com">
<meta name="twitter:description" content="A toy API to convert any bitmap image in to RBA colours!">
<meta name="twitter:image" content="https://pixel-artist.herokuapp.com/crap/meta-1200x628.png">


<style>
:root {
--mw: 610px;
Expand Down
Binary file added public/screengrabs/demo_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/screengrabs/demo_10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/screengrabs/demo_11.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/screengrabs/demo_12.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/screengrabs/demo_13.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/screengrabs/demo_14.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/screengrabs/demo_15.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/screengrabs/demo_16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/screengrabs/demo_17.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/screengrabs/demo_18.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/screengrabs/demo_19.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/screengrabs/demo_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/screengrabs/demo_20.png
Binary file added public/screengrabs/demo_21.png
Binary file added public/screengrabs/demo_22.png
Binary file added public/screengrabs/demo_3.png
Binary file added public/screengrabs/demo_4.png
Binary file added public/screengrabs/demo_5.png
Binary file added public/screengrabs/demo_6.png
Binary file added public/screengrabs/demo_7.png
Binary file added public/screengrabs/demo_8.png
Binary file added public/screengrabs/demo_9.png
Binary file added public/screengrabs/thumbs/demo_1.png
Binary file added public/screengrabs/thumbs/demo_10.png
Binary file added public/screengrabs/thumbs/demo_11.png
Binary file added public/screengrabs/thumbs/demo_12.png
Binary file added public/screengrabs/thumbs/demo_13.png
Binary file added public/screengrabs/thumbs/demo_14.png
Binary file added public/screengrabs/thumbs/demo_15.png
Binary file added public/screengrabs/thumbs/demo_16.png
Binary file added public/screengrabs/thumbs/demo_17.png
Binary file added public/screengrabs/thumbs/demo_18.png
Binary file added public/screengrabs/thumbs/demo_19.png
Binary file added public/screengrabs/thumbs/demo_2.png
Binary file added public/screengrabs/thumbs/demo_20.png
Binary file added public/screengrabs/thumbs/demo_21.png
Binary file added public/screengrabs/thumbs/demo_22.png
Binary file added public/screengrabs/thumbs/demo_3.png
Binary file added public/screengrabs/thumbs/demo_4.png
Binary file added public/screengrabs/thumbs/demo_5.png
Binary file added public/screengrabs/thumbs/demo_6.png
Binary file added public/screengrabs/thumbs/demo_7.png
Binary file added public/screengrabs/thumbs/demo_8.png
Binary file added public/screengrabs/thumbs/demo_9.png
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Binary file removed static/screengrabs/botticelli-venus.png
Diff not rendered.
Binary file removed static/screengrabs/da-vinci-mona-lisa.png
Diff not rendered.
Binary file removed static/screengrabs/hokusai-tsunami.png
Diff not rendered.
Binary file removed static/screengrabs/hopper-nighthawks.png
Diff not rendered.
Binary file removed static/screengrabs/magritte-pipe.png
Diff not rendered.
Binary file removed static/screengrabs/magritte-son-of-man.png
Diff not rendered.
Binary file removed static/screengrabs/picasso-old-guitarist.png
Diff not rendered.
Binary file removed static/screengrabs/riley-shadowplay.png
Diff not rendered.
Binary file removed static/screengrabs/van-gogh-starry-night.png
Diff not rendered.
Binary file removed static/screengrabs/vermeer-pearl-earring.png
Diff not rendered.
Binary file removed static/screengrabs/wood-american-gothic.png
Diff not rendered.

0 comments on commit dce837b

Please sign in to comment.