All Projects → giventofly → pixelit

giventofly / pixelit

Licence: MIT license
Create pixel art from an image

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to pixelit

pixelino
Pixel-drawing app for iOS ✍️
Stars: ✭ 45 (-93.5%)
Mutual labels:  pixel-art, pixelart
pixelart.js
punks.js - draw punk (pixel) art images using any design (in ascii text) in any colors; incl. 2x/4x/8x zoom for bigger sizes and more
Stars: ✭ 132 (-80.92%)
Mutual labels:  pixel-art, pixelart
Gitfiti
abusing github commit history for the lulz
Stars: ✭ 6,750 (+875.43%)
Mutual labels:  pixel-art, pixelart
FishFight
Tactical 2D shooter in fishy pixels style. Made with Rust-lang and Macroquad 🦀🌶
Stars: ✭ 631 (-8.82%)
Mutual labels:  pixel-art, pixelart
pixelart-howto
pixel art HOWTOs
Stars: ✭ 322 (-53.47%)
Mutual labels:  pixel-art, pixelart
SpookyGhost
A procedural sprite animation tool made with the nCine
Stars: ✭ 185 (-73.27%)
Mutual labels:  pixel-art, pixelart
Pixelorama
A free & open-source 2D sprite editor, made with the Godot Engine! Available on Windows, Linux, macOS and the Web!
Stars: ✭ 2,535 (+266.33%)
Mutual labels:  pixel-art, pixelart
faq
DIY (Do-It-Yourself) - Yes, You Can! Design Your Own Punk (Pixel) Characters / Heads+Bodies using the Punk (Building) Blocks in the 24×24px (or 32×32px or 40×40px ) Formats And Much More
Stars: ✭ 15 (-97.83%)
Mutual labels:  pixelart
darkest-pixel-dungeon
Traditional roguelike game with pixel-art graphics and simple interface
Stars: ✭ 66 (-90.46%)
Mutual labels:  pixel-art
Zombusters
🕹️ A retro style zombies shooter with cool isometric pixel art for Windows and MacOS
Stars: ✭ 41 (-94.08%)
Mutual labels:  pixel-art
Cytopia
🌳🏡🏢🌲 A city building simulation game
Stars: ✭ 241 (-65.17%)
Mutual labels:  pixel-art
vscode-luna-paint
A raster image editor extension for VS Code
Stars: ✭ 235 (-66.04%)
Mutual labels:  pixel-art
PixelShape
Pixel editor that comes in handy when creating pixel art images and animations
Stars: ✭ 29 (-95.81%)
Mutual labels:  pixel-art
godot-psx-style-demo
Demo project featuring a collection of PS1 style shaders and materials for Godot engine.
Stars: ✭ 266 (-61.56%)
Mutual labels:  pixel-art
punks.design
Punk Design Series - Original CryptoPunks Series (24×24); CryptoNormies And More
Stars: ✭ 29 (-95.81%)
Mutual labels:  pixelart
voxel-builder
Voxel-based 3D modeling application
Stars: ✭ 31 (-95.52%)
Mutual labels:  pixel-art
ColorByNumber-iOS
Color by Number: a pixel coloring game on iOS.
Stars: ✭ 50 (-92.77%)
Mutual labels:  pixel-art
Idacyber
Data Visualization Plugin for IDA Pro
Stars: ✭ 244 (-64.74%)
Mutual labels:  pixel-art
8192px
A collaborative pixel art experiment
Stars: ✭ 64 (-90.75%)
Mutual labels:  pixel-art
8 bit hubble
Generate random pixel art galaxies! In honor of Hubble Space Telescope, SNES videogames and Bob Ross
Stars: ✭ 59 (-91.47%)
Mutual labels:  pixel-art

Pixel It

Javascript library to create pixel art from an image. See Pixel It in action.

Index

Files

On /dist you can find the files you need

file description
pixelit.js javascript es6 file
pixelitmin.js javascript minified and babeljs.io parsed for es5

Examples

Original image and after Pixel It did some work on it.

No filter applied and color palette used.

default use 4 color palette used

Documentation

To use the quick default configuration you need an element from where to draw the image and canvas element with the id pixelitcanvas. Then load the pixelit.js script and apply it on an image.

    <img src="sky.jpg"  id="pixelitimg" alt="">
    <canvas id="pixelitcanvas"></canvas>
    <script src="pixelit.js"></script>
    <script>
      //create object
      const px = new pixelit();
      px.draw().pixelate();
    </script>

You can use this option when creating the instance of Pixel It

    const config = {
      to : elem,
      //defaults to document.getElementById("pixelitcanvas")
      from : elem, 
      //defaults to document.getElementById("pixelitimg")
      scale : int 
      //from 0-50, defaults to 8
      palette : [[r,g,b]], 
      //defaults to a fixed pallete
      maxHeight: int, 
      //defaults to null
      maxWidth: int, 
      //defaults to null
    }
    const px = new pixelit(config);

Api

method
.draw() draw to canvas from image source and resizes if max height or max width is reached
.setDrawFrom(elem) elem to get the image to pixelate
.setDrawTo(elem) canvas elem to draw the image
.setFromImgSource(src) change the src from the image element
.setPalette(arr) sets the color palette to use, takes an array of rgb colors: [[int,int,int]], int from 0 to 255
.setMaxWidth(int) set canvas image maximum width, it can resize the output image, only used when .resizeImage() is applied
.setMaxHeight(int) set canvas image maximum height, it can resize the output image, max height overrides max width, only used when .resizeImage() is applied
.setScale(int) set pixelate scale [0...50]
.getpalette() returns array of current palette, can't be chained
.convertGrayscale() converts image to greyscale, apply only after .draw is called
.convertpalette() converts image with the defined color palette, apply only after .draw is called
.resizeImage() resizes the output image if bigger than the defined max Height or max Width
.pixelate() draws a pixelated version of the from image to the to canvas, , apply only after .draw is called
.saveImage() saves/downloads current image

Working example:

    <img  src="assets/sky.jpg"  id="pixelitimg"  alt="">
    <canvas  id="pixelitcanvas"></canvas>
    <script>
    const mypalette = [
    [26,28,44],[93,39,93],[177, 62, 83],[239, 125, 87],[255, 205, 117],[167, 240, 112],[56, 183, 100],[37, 113, 121],[41, 54, 111],[59, 93, 201],[65, 166, 246],[115, 239, 247],[244, 244, 244],[148, 176, 194],[86, 108, 134],[51, 60, 87]
    ];
    const  px  =  new  pixelit({from:  document.getElementById('pixelitimg'),
    "palette": mypalette});
    px.draw().pixelate().convertPalette();
    </script>

Local development

Run npm install to install the needed files, edit javascript from /src/ folder and run gulp serve to make a direct copy and a minified and transpiled files into /dist and /docs/js respectively.

You have inside the docs page a tests page to check changes to different image sizes.

Changelog

2022-03-05

  • Added a page with tests
  • Fixed image cut for smaller images and better border removal for bigger images

2022-02-16

  • Github page added scroll down selector for palette change

2022-02-10

  • Github page added changelog
  • Github page added local development information
  • Added gulp to minifiy and transpile without the need for aditional tools
  • Fix border appearing on bigger images
  • Added new palettes on live page
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].