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

Color conversion #295

Closed
aabacchus opened this issue Feb 16, 2021 · 4 comments
Closed

Color conversion #295

aabacchus opened this issue Feb 16, 2021 · 4 comments

Comments

@aabacchus
Copy link

I often scan some work and want to convert the images to a pdf for uploading.
These images can be very large in size but I can "remove" the color from them by converting the pdf to grayscale, and this can vastly reduce the file sizes, usually by about 10 times.

At the moment I use Ghostscript in this way:

#!/bin/sh
gs      -sOutputFile=gray.pdf \
        -sDEVICE=pdfwrite \
        -sColorConversionStrategy=Gray \
        -dProcessColorModel=/DeviceGray \
        -dCompatibilityLevel=1.4 \
        -dNOPAUSE \
        -dBATCH \
        $1

Could a similar feature be implemented in pdfcpu?

@hhrutter
Copy link
Collaborator

Hello!
Can you share a small sample input PDF for analysis?

@aabacchus
Copy link
Author

Here's a jpg photo of a page of work: sample-pic
Taken pretty hurriedly, lighting is yellow, there's a bit of my table in the background.
It's 3.3M.

Converted to a pdf using pdfcpu import sample-pic.pdf sample-pic.jpg: sample-pic.pdf
Also 3.3M.

Now running the above script: gray.pdf
Size is 420k and no distracting colour.

@hhrutter
Copy link
Collaborator

I'll check it out 👍
Thank you for using pdfcpu 💚

@hhrutter hhrutter changed the title Feature request: remove color from pdf "Remove" color from a PDF page Feb 16, 2021
@hhrutter hhrutter changed the title "Remove" color from a PDF page color conversion Feb 27, 2021
@hhrutter hhrutter changed the title color conversion Color conversion Feb 27, 2021
@hhrutter hhrutter self-assigned this Mar 10, 2021
@hhrutter
Copy link
Collaborator

Fixed with the latest commit!

Now you can do: pdfcpu import -- "gray:true" gray.pdf test.jpg to get what you need.

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