qzind / qz-print

Archive for legacy qz-print versions (1.8, 1.9). See https://github.com/qzind/tray for modern versions.
Other
141 stars 101 forks source link

Using color in postscript images results in poor quality with CUPS #171

Closed noramtkane closed 8 years ago

noramtkane commented 8 years ago

I am using QZ-tray 1.9.5 and use html2canvas to make a rather complicated 4.x6 label on a Zebra GK420d. On windows it looks fine but when using linux the label looks dithered and is impossible to read.

I took the postscript that CUPS saves for the job and it looked fine. I ran it though the gstoraster filter manually and that it where the problem occurs. I can see that the image in the postscript is a colorimage. Perhaps an option to use non color images in the postscript would help when using single color label printers would help with this. I know the issue is color related because if I use a photoeditor to change the postscript to 1 bit color it looks better and if I generate a color or grayscale image with gstoraster it looks perfect(But won't work with the printer).

Has anyone run in to this issue before?

tresf commented 8 years ago

if I use a photoeditor to change the postscript to 1 bit color it looks better and if I generate a color or grayscale image with gstoraster it looks perfect(But won't work with the printer).

Has anyone run in to this issue before?

If you're not yet heavily invested in the 1.9 version, I'd recommend switching over to 2.0, which uses a much better method for rendering HTML content (html2canvas has been abolished in 2.0). The major downside of this is that if your CUPS environment is Linux, you'll need to find a JavaFX8 package for your desktop. Another disadvantage is that we haven't extensively tested RC1 on Mac or Linux yet, so you may discover some bugs in the process.

https://qz.io/wiki/2.0-pixel-printing#html-printing

Even better, we've introduced a nearest-neighbor option in our 2.0 branch which allows images which contain pixel-accurate low-resolution graphics to scale without the blurring side-effects.

Last, you can match your Zebra's native 203dpi or 300dpi by forcing the DPI using our new density parameter.

If this suits your needs, we'll close this out as resolved.

On the other hand, if you're stuck on 1.9 for a while, we can discuss backporting a feature to that branch to suit your needs.

tresf commented 8 years ago

@noramtkane can you please email me a sample? I'll fire up 2.0.0-RC1 and see how well it's JavaFX HTML rendering engine can tackle this.

tres.finocchiaro@gmail.com

tresf commented 8 years ago

@noramtkane I'm closing this out, since it's a question. Please continue using this thread for discussion. If we can get proper steps to reproduce on 2.0, we'll reopen.

noramtkane commented 8 years ago

We've tried this in 2.0 and have the same issue. Here is a code snippet of one of the ways we tried doing it:

var config = qz.configs.create(service.defaultPrinter, { 
    units: "in",
    density: 203, 
    colorType: 'blackwhite', 
    interpolation: 'nearest-neighbor' 
    size: {
        width: canvas.width, 
        height: canvas.height 
    } 
});

​var base64 = canvas.image.replace('data:image/png;base64,', ''); ​ 
var data = [ 
    { 
        type: 'image',
        format: 'base64', 
        data: base64 
    } 
]; ​ 

qz.print(config, data);

The prefilter CUPS job file has a image with multiple colors so it doesn't convert to single color correctly(because you can't adjust the threshold). I think the issue is anti-aliasing. I would think blackwhite wouldn't do any but it does.

tresf commented 8 years ago

@noramtkane I see you're still using html2canvas, is there a reason why you're not using the new improved HTML feature?

https://qz.io/wiki/2.0-pixel-printing#html-printing

tresf commented 8 years ago

@noramtkane also, we will need a sample to get this tested properly from our end.