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

EscposImage dithering #97

Closed
SteampunkProfessor opened this issue Mar 16, 2016 · 3 comments
Closed

EscposImage dithering #97

SteampunkProfessor opened this issue Mar 16, 2016 · 3 comments

Comments

@SteampunkProfessor
Copy link

You can add the Citizen CBM1000-II to your list.
Any chance of adding an Atkinson dither to EscposImage.php?
Thans for your worrk, it's fun trying it out.

@mike42
Copy link
Owner

mike42 commented Mar 17, 2016

I'll leave this open as a feature request.

Could be done with a few loops-

Or could use dithering algo's built in to GD & Imagick-

@mike42 mike42 changed the title Another printer for the list EscposImage dithering Mar 19, 2016
@mike42 mike42 added this to the 1.3 milestone Apr 23, 2016
@mike42
Copy link
Owner

mike42 commented Apr 24, 2016

As part of the image handling re-write, the raster data is all generated in ImageMagick in a single call, which dithers as a side-effect-

$im -> setformat('pbm');
$im -> getimageblob();

The linked commit contains a challenging public domain sample image, and a code snippet showing how to fall back on the old, slow implementation which performed a threshold.

The output is-

2015-04-dither-example

I'll note that the image quality is still not as good as I would like, but this is simply what Imagick gets us. Any pure PHP image manipulation will be very slow, so you should either pre-process your images or use an alternative utility to render them if you have an image-intensive workflow.

Specifically, if you are printing a lot of images, you should also check out-

  • The port of these routines that I recently submitted to python-escpos produces better quality output than the example above (by using PIL in place of Imagick)
  • png2pos is a compiled utility which works exclusively with images.

@SteampunkProfessor
Copy link
Author

Thanks for the update!

On Mon, Apr 25, 2016 at 2:14 AM, Michael [email protected] wrote:

Closed #97 #97 via 7029b7b
7029b7b
.


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#97 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants