Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Are white pixels being eaten up? #11

Closed
jmbldwn opened this issue Jul 25, 2023 · 1 comment
Closed

Are white pixels being eaten up? #11

jmbldwn opened this issue Jul 25, 2023 · 1 comment

Comments

@jmbldwn
Copy link

jmbldwn commented Jul 25, 2023

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?

@metafloor
Copy link
Owner

Set notrim to true in the options object. If you look at the code, you will see the following callout for the option:

    // Create a monochome image, cropped to remove padding.
    // The return is a Uint8Array with extra properties width and height.
    let mono = monochrome(rgba, width, height, +opts.black || 50, opts.notrim);

@jmbldwn jmbldwn closed this as completed Jul 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants