Forum How do I...?

Raster jpg quality

What compression level is used for the jpg rasters from Prince? And is there a way to control that anywhere? I am using `raster-format=jpg` from the command line. I have it set to 300 DPI, but I have a customer complaining that the image is too soft so I am wondering if it is a compression issue or not.
You could use PNG output, if lossy compression is not appropriate.
I don't think I need to go to the extreme of using PNG. I was just wondering what jpg compression it is using and if there is a way to control that. If you are already using decently high compression this customer might just be not liking something that has nothing to with the compression anyways.
The quality parameter given to libjpeg is 92. There is no option to control it at the moment.
To add onto this conversation, we are having some customers complain about the raster quality of certain images that have text on the image that are becoming fuzzy. In this particular case it was the name of the team on a sports jacket. At first I thought maybe the issue was being created on my end so I increased the resolution of the image that was being embedded into the html. This helped but didn't completely fix the issue. Even with a huge ~5MB file embedded in without anything being done to it on my end, the raster quality of a 8x10 at 300 DPI made the text on the embedded image fuzzy. Increasing the DPI to something like 400DPI did help, but isn't always feasible since we have customers that need the DPI to be exactly 300 to print correctly (no idea why to be honest).

Outputting a png resulted in the same quality as far as I could tell. Unless you are using libjpeg to do the actual rasterization I don't think the lossy compression is the issue here.

I am reaching for straws here, but when using ImageMagick or libvips to convert jpgs there is an option to control the compression algorithm. Usually the defaults are fairly fast but dirty algorithms that introduce artifacts like I am seeing here. Is there something similar in Prince's rasterization pipeline you can expose as a CLI option to help with quality issues?

These are limited signed S3 urls to the images so they won't last forever, but here is an example of what I talking about:
Generated composite resulting in blurry text on jacket:

Original full quality image:

Edited by daneren2005

The link to the generated image has expired.
I can see the usual JPEG artefacts around the white stripe and white text on the green jacket if I zoom right up. Those wouldn't be present in a PNG image.

If the metadata is correct, the text itself is only about 3x2 mm on the page and 35x19 pixels large.
Sorry for the delayed response. I was taking a vacation so I didn't see your reply earlier.

Here is a PNG:

Here is the same image as a jpg:

I see no difference between the two so I am thinking the fuzzing happens before compressing the image to a jpg. Just for comparisons sake, I decided to do a similar screenshot using Puppeteer and it was actually worse even specifying the jpg quality at 99: I also ran a PNG test with Puppeteer and saw the same results there as well.

I'm not sure what the metadata says, but those should be 10 x 8" composites. I think you are right that it is a tiny bit of text on the image so it shouldn't make a difference. The customer in question was using something called DP2 (a fairly industry specific tool) before and they are claiming that the same dimension images coming out of DP2 are better looking than what we are producing. They are also claiming that they actually printed it and it makes a difference in the printed quality as well.
Here is a comparison of the JPEG vs PNG outputs, zoomed up 800% (click to see full size):
[missing attachment: "jpeg_vs_png_comparison.png‎"]
You can see the JPEG artefacts (which could be described as "fuzzy") and the text in the JPEG is softer.

We may be able to enable a higher quality downsampling filter for images (Catmull-Rom vs bilinear interpolation). However, it is very much slower and I'm not sure it would be considered an improvement in this case anyway. (Note: I may not have matched your image sizes exactly.)
[missing attachment: "Catmull-Rom.png‎"]

I don't really know what else can be done at 300 DPI. Any reason your customers are not printing the original PDF containing unscaled images?
Interesting. I will have to play with some different downsampling filters to see if any other algorithms do a better job there. I understand if there isn't anything to be done at 300 DPI. This is probably one of those times that I am just going to tell the customer that is what we have and we can't change it.

And as for the PDF question, unfortunately a lot of these lab's printers just flat out don't handle pdf's very well. Some crash and burn. Some just print differently than shown by Adobe. Over the last couple of years we have moved to defaulting new customers to jpg renders instead (PS I love that you guys provide that as an option so we can use the same render library for both outputs). We give the original pdf as an option, but so far the only people who actually use that are a few extremely large customers that have high end printers and the resources to properly QA before printing.
In the new latest build we have added a --raster-jpeg-quality option which allows it to be raised from the default of 92, perhaps this will help.