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

Access to source image object #58

Merged
merged 7 commits into from
Nov 12, 2019
Merged

Access to source image object #58

merged 7 commits into from
Nov 12, 2019

Conversation

mtking2
Copy link
Collaborator

@mtking2 mtking2 commented Nov 5, 2019

This PR exposes the source Img2Zpl::Image object and all of the functionality that comes along with it provided by the img2zpl gem (and in turn all the functionality of the MiniMagick::Image class from the minimagick gem)

Usage

image = Zebra::Zpl::Image.new path: 'path/to/file.png', position: [0, 0]
image.source #=> Img2Zpl::Image instance

# also aliased as .src
image.src

Example

Flattening an image's layers (so it is properly converted) and then trimming out unnecessary white space around the edges:

label = Zebra::Zpl::Label.new width: 600, length: 305, print_speed: 6

image = Zebra::Zpl::Image.new path: 'path/to/file.png', position: [0, 0]

image.src.flatten
image.src.trim

label << image

zpl = ''
label.dump_contents zpl
puts zpl

@mtking2 mtking2 merged commit b008bc3 into bbulpett:master Nov 12, 2019
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

Successfully merging this pull request may close these issues.

1 participant