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

imagetoraster and 16bit images #25

Closed
jpnp opened this issue May 6, 2022 · 7 comments
Closed

imagetoraster and 16bit images #25

jpnp opened this issue May 6, 2022 · 7 comments

Comments

@jpnp
Copy link

jpnp commented May 6, 2022

When I print a 16bit TIFF file, imagetoraster fails with this in the debug logs:

   DEBUG: TIFF resolution = 70.866142x70.866142, units=3
   DEBUG: Stored resolution = 180x180 PPI
   DEBUG: Bad TIFF dimensions 2104x1488x16x3!
   ERROR: The print file could not be opened.
   ERROR: imagetoraster (PID 259068) stopped with status 1

If I convert the tiff to a 16bit PNG (and use a ppd which specifies /cupsBitsPerColor 16/ then the filter runs and produces a 16bit raster, but it is entirely blank white.

If I force cups to go via imagetopdf by disabling imagetoraster then things are better and gs produces a sensible 16bit raster. The image values are not exactly the same as the input (some sample's channel values are 1-3 out compared to the original image). i.e. it passes an effectively 14-15bit per channel image to gutenprint.

I'm using Ubuntu 20.04 with cups 2.3.1-9ubuntu1.1 and cups-filters 1.27.4-1, and gutenprint 5.3.4.

@tillkamppeter
Copy link
Member

Could you attach the 16-bit TIFF file here (or give me a link to a publicly available one)? Thanks.

@jpnp
Copy link
Author

jpnp commented May 7, 2022

Here are a 16bit PNG and 16bit TIFF (zipped as github doesn't like TIFF).
The files can be viewed with the Gnome image viewer, and opened by GIMP or ImageMagick.

1page
1page.zip

@tillkamppeter
Copy link
Member

I have checked and the function to read TIFF in libcupsfilters actually does not support 16 bit per color. There was no complaint about that for all the years and so I did not realize that. In addition, direct printing of files to CUPS (not using an application) is only rarely done. Therefore it is also planned to remove support for all image formats except JPG and PNG in cups-filters 2.x.

So I will have a look to see whether it is trivial to fix or whether it will be a wont-fix.

In general you can do high-color-depth printing via PNG and also via PDF (if you print your image from an application, the application will send PDF to CUPS).

@jpnp
Copy link
Author

jpnp commented May 8, 2022

GUI apps offer options and control via print dialogs but are not easily scripted, and it's often hard to have control of colour management. (PhotoPrint works well with gutenprint printers by doing the RIP in app and send raw data to the print queue, but that has been unsupported for years and is unreliable on current OSs.)

PNG is fine as a TIFF alternative. However, when I print the PNG file attached above, I get no errors in the log, but a blank print as output (it gives a totally white cups raster file).

@Harshit09-lang
Copy link
Contributor

Harshit09-lang commented Jan 5, 2023

@jpnp Could you perhaps upload your /var/log/cups/error_log file after running the problematic job? Set CUPS to debug logging before delivering the task (cupsctil --debug-logging), then modify your error log file to have a .txt extension so that GitHub accepts it.

@tillkamppeter
Copy link
Member

@Harshit09-lang you will not need any more from the original poster, I could reproduce it, with both cups-filters 1.x and 2.x. Download this PPD file:
C43x.ppd.txt
and the PNG image from the original poster (click the image). Then run tthe following command line:

cat image.png | PPD=C43x.ppd.txt ./imagetoraster 1 1 1 1 'PageSize=A4 PwgRasterDocumentType=SRgb_16' > out.raster

image.png is the image from the original poster. Open out.raster with rasterview and you see a white page, but at least with correct metadata.

This was referenced Mar 23, 2023
@tillkamppeter tillkamppeter transferred this issue from OpenPrinting/cups-filters Apr 8, 2023
@tillkamppeter
Copy link
Member

Fixed in commits c83bead and bb180dc. Thanks, @Harshit09-lang for your contribution!

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

No branches or pull requests

3 participants