Git Product home page Git Product logo

pixel2svg-fork's Introduction

README for pixel2svg

About

pixel2svg converts pixel art to SVG - pixel by pixel.

For example, here is an icon from the Tango Icon Set:

tango heart

If you scale this up for a nice blocky print, you might get a dithered result:

tango heart 400px dithered

Of course you can turn dithering off. But sometimes you might want a vector file, especially for large prints. For these cases, pixel2svg produces this SVG file (try clicking to find out whether your browser supports SVG):

tango-heart.svg

Here is a screenshot of the SVG in Inkscape:

tango heart inkscape

Nice, pure vector data.

Prerequisites

Python 3

Python pillow

svgwrite svgwrite 1.4.1 documentation

Gentoo Linux

As of 2021 the dev-python/svgwrite ebuild is masked, you need to add:

>=dev-python/svgwrite-1.4.1 ~amd64

to /etc/portage/package.accept_keywords

Then install the 2 python libraries with:

emerge dev-python/pillow dev-python/svgwrite dev-python/numpy

Usage

usage: pixel2svg.py [-h] [--version] [--overlap] [--squaresize SQUARESIZE]
                    [--unit {em,ex,cm,mm,Q,in,pc,pt,px}] [--combine]
                    [--similar SIMILAR]
                    imagefile

Convert pixel art to SVG

positional arguments:
  imagefile             The image file to convert

optional arguments:
  -h, --help            show this help message and exit
  --version             Display the program version
  --overlap             If given, overlap vector squares by 1 unit
  --squaresize SQUARESIZE
                        Width and height of vector squares in pixels, default:
                        40
  --unit {em,ex,cm,mm,Q,in,pc,pt,px}
                        set SVG unit used with --squaresize, default: px
  --combine             If given, combine similar pixels into larger
                        rectangles
  --similar SIMILAR     Configure a numeric value to find a similar color.
                        Larger values make the comparison less sensitive.

Running

pixel2svg.py IMAGE.EXT

will process IMAGE.EXT and create IMAGE.svg

EXT can be any format (png, jpg, bmp, gif and many more) that can be read by the Python Imaging Library. See https://pillow.readthedocs.io/en/stable/handbook/image-file-formats.html for details.

License

pixel2svg is licensed under the GPL. See the file COPYING for details.

Author

original version: (c) Florian Berger [email protected]

updates by cyChop at https://github.com/cyChop/pixel2svg-fork

updates by Dirk Jagdmann [email protected] at https://github.com/doj/pixel2svg-fork

pixel2svg-fork's People

Contributors

aoloe avatar cychop avatar doj 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.