GithubHelp home page GithubHelp logo

pic4xiu / zplgfa Goto Github PK

View Code? Open in Web Editor NEW

This project forked from simonwaldherr/zplgfa

0.0 0.0 0.0 137 KB

#Golang package and cli tool for converting to #ZPL (from PNG, JPEG and GIF) for @ZebraTechnology-printers

License: MIT License

Go 100.00%

zplgfa's Introduction

since I am currently working exclusively in the home office and no longer have to do with labels professionally (only as a hobby), I can unfortunately no longer work on this project. But if someone would like to provide me a @Zebra printer, I would be happy to develop it further. Of course, pull requests are still welcome.

ZPLGFA Golang Package

convert pictures to ZPL compatible ^GF-elements

GoDoc Coverage Status Go Report Card codebeat badge FOSSA Status license

The ZPLGFA Golang package implements some functions to convert PNG, JPEG and GIF encoded graphic files to ZPL compatible ^GF-elements (Graphic Fields).

If you need a ready to use application and don't want to hassle around with source code, take a look at the ZPLGFA CLI Tool which is based on this package.

install

  1. install Golang
  2. go get simonwaldherr.de/go/zplgfa

example

take a look at the example application
or at this sample code:

package main

import (
    "simonwaldherr.de/go/zplgfa"
    "fmt"
    "image"
    _ "image/gif"
    _ "image/jpeg"
    _ "image/png"
    "log"
    "os"
)

func main() {
    // open file
    file, err := os.Open("label.png")
    if err != nil {
        log.Printf("Warning: could not open the file: %s\n", err)
        return
    }

    defer file.Close()

    // load image head information
    config, format, err := image.DecodeConfig(file)
    if err != nil {
        log.Printf("Warning: image not compatible, format: %s, config: %v, error: %s\n", format, config, err)
    }

    // reset file pointer to the beginning of the file
    file.Seek(0, 0)

    // load and decode image
    img, _, err := image.Decode(file)
    if err != nil {
        log.Printf("Warning: could not decode the file, %s\n", err)
        return
    }

    // flatten image
    flat := zplgfa.FlattenImage(img)

    // convert image to zpl compatible type
    gfimg := zplgfa.ConvertToZPL(flat, zplgfa.CompressedASCII)

    // output zpl with graphic field data to stdout
    fmt.Println(gfimg)
}

label server

If you have dozens of label printers in use and need to fill and print label templates, this tool will help you:

SimonWaldherr/ups - GitHub

License

MIT

zplgfa's People

Contributors

simonwaldherr avatar fossabot avatar pic4xiu avatar sw-rubix 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.