GithubHelp home page GithubHelp logo

metafloor / zpl-image Goto Github PK

View Code? Open in Web Editor NEW
77.0 77.0 22.0 66 KB

Pure javascript conversion of PNG, JPEG, GIF files to ZPL GRF bitmaps encoded with Z64.

License: Other

CSS 1.00% JavaScript 94.90% HTML 4.11%

zpl-image's People

Contributors

metafloor avatar munawwar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

zpl-image's Issues

Are white pixels being eaten up?

I'm rendering my label in a canvas element. I'm drawing black on white for the label contents.

I'm calling imageToZ64(canvas); to generate the ZPL from my canvas.

What's weird is the ZPL appears to drop all white pixels on the top and left of my canvas, so to get my label to print properly in the center I have to put a black border around the perimeter of the canvas.

Is this expected behavior, or am I doing something wrong?

pako not defined, webpack 5 makes this library hard to use in browser.

I'm using zpl-image in a react app, within the browser. I had to add node polyfills to make it even partially happy (zlib, stream, assert), which is a pain because CRA doesn't make it easy to configure webpack. I had to add a library called craco to enable the polyfills.

zlib isn't even used, but the way the module is structured I had to set up a polyfill for it.

Also, pako seems to be expected to be at window.pako. To make sure it was in scope, I had to add this to my code:

import pako from 'pako';
window.pako = pako;

It'd be nice to not have to dance around this to get it to work, like just import { imageToZ64 } from 'zpl-image';

Don't embed pako

Why is pako included in the repo when there is an npm package? Also the included pako.js seems to have some minified code at the top.

Great library otherwise! Thanks a lot for writing it!

Pixelated output

The image I am inputting is already in greyscale (black & white). After conversion the resulting image in ZPL is quite pixelated and missing a lot of detail, and kind of hard to read.

Is there any way to retain the original image and just convert to ZPL only? No need for monochrome rotation etc.

Before
orig image

After
zpl-image output

ZPL to image?

Hey,

I'm sorry if I'm missing something obvious, but is it possible to convert ZPL to an image or a PDF using this library? Basically into anything that can be embedded into a browser page.

Thank you!

Use in Angular?

Been trying to use this in Angular but having trouble getting it identified as a library. Not sure you have any experience with this platform but any idea how to import the library?

Not converting complete Image.

let id= document.getElementById("image");
let res = imageToZ64(id,{notrim:true,black:56, rotate:'I',height:id['height']});
let zpl = "^XA^LH0,0^FWN^PON^PMN^LRN^FO10,10^GFA,"+ res['length'] +","+ res['length'] +","+ res['rowlen'] +","+ res['z64'] +" ^XZ".

Hello, I have a problem here. Can anyone tell why only the half of the image is converting. That it is only converting width upto 192 px.

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.