Skip to content

Conversation

vintagepc
Copy link

@vintagepc vintagepc commented Sep 30, 2023

Per the discussion in #39 - this adds an actual half-tone filter to the driver.

It may also add some value to #37 to improve the output.

The source for these filters was sourced from the driver for a Dymo LabelWriterPnP linux package and is GPL-v2.

Generally, my experience has been that Error Diffusion provides better results for greyscale text, and NLL will work better for images and non hard-edged graphics

It is currently in draft stage for the following reasons:

  • Not integrated into Makefile. I've never used autotools and my distro doesn't offer 2.71 🙃 (that's also why it's a few commits behind the latest...)

My compile command line looks like this:

g++ rastertoptch.c halftoning//ErrorDiffusionHalftoning.cpp halftoning/Halftoning.cpp halftoning/NonLinearLaplacianHalftoning.cpp -I . -lcups -lcupsimage
  • Not integrated into XML. I am not sure how to add an option that supports both sending the requisite information to CUPS to get an 8bpp image as well as pass options to the driver. Namely, we need this block to set the correct depths:
*OpenUI *Halftone/Halftoning: PickOne
*OrderDependency: 20 AnySetup *Halftoning
*DefaulHalftone: ErrorDiffusion
*Halftone Default/Default: "<</cupsColorOrder 0/cupsColorSpace 3/cupsBitsPerColor 1/cupsBitsPerPixel 1>>setpagedevice"
*Halftone ErrorDiffusion/Error Diffusion: "<</cupsColorOrder 0/cupsColorSpace 1/cupsBitsPerColor 8>>setpagedevice"
*Halftone NLL/Nonlinear Dithering: "<</cupsColorOrder 0/cupsColorSpace 1/cupsBitsPerColor 8>>setpagedevice"
*CloseUI: *Halftone

and the following parameters must be passed to rastertoptch depending on the selected value:

Default: Halftone=-1
ErrorDiffusion: Halftone=0
NLL: Halftone=1

There may also be value in allowing the user to select the threshold value for the Laplacian filter, but that would require detailed analysis with a lot of images - not really what tape label printers are meant for but it may have value for e.g. the QL series?

Some examples for a simple black-to-white gradient:

Input: gradient Default: gradient1 Error Diffusion: gradient21 NLL: grad64-31

@vintagepc vintagepc marked this pull request as ready for review May 18, 2024 23:07
@philpem philpem added the help wanted Extra attention is needed label Sep 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants