Code Monkey home page Code Monkey logo

zplconvert's Introduction

ZPLConvert

ZPLConvert provides a simple tool for converting images to ZPL compatible strings.

Installation

pip install zplconvert

Requirements

ZPLConvert needs one of the following:

Example use

Included is a simple main program that can be used from the command line to convert images.

zplconvert zebra_logo.png

will read zebra_logo.png, convert it to black and white, then to compressed ZPL Ascii and print the result to stdout.

If you want more control, you can use the following flags:

Flag Description
--no-compress Do not compress the result image (useful for debugging).
--position x,y Add a positional header to the output.
--threshold value Set black pixel threshold (0-255, default 128).
--dither Dither the result instead of hard limit for black pixels.
--label Add header and footer needed for a complete ZPL label. This allows the result to be sent directly to a printer (e.g. with curl).
--output filename Write result to file instead of stdout.

The same converter can be used directly from Python as well

from zplconvert import ZPLConvert
convert = ZPLConvert("zebra_logo.png")
convert.set_compress_hex(True)
result = convert.convert()

See the code for other options that can be set on the converter.

Also included is a helper utility for converting ZPL images back to PNG (or any other image format supported by PIL).

zplparse --output logo.png zebra_logo.grf

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/Karimerto/zplconvert.

License

This source is released under the standard MIT License

Zebra logo

Zebra Logo

The Zebra Logo was copied from Zebra Design.

zplconvert's People

Contributors

karimerto avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

zplconvert's Issues

pip doesnt find zplconvert

I was unable to install it via pip, as zplconvert wasnt found.
Local installation was refused because versions didnt fit

Empty output string

As python3 wasnt compatible, I used python2 and tried to convert a bmp file, but just got an output string with the zpl header (GFA…) and only delimiter characters

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.