Converted images to pdf are too vibrant

72 Views Asked by At

When I do

img2pdf input.jpg -o output.pdf

, the output pdf is too vibrant, and not a one-to-one with the image. I also tried it with ImageMagick and

convert input.jpg output.pdf

is also too vibrant.

I was expecting a one-to-one like how MacOS' Create PDF does it, but I can't use it because I don't think it has a CLI equivalent, and I would rather not lock myself in with MacOS only tools. I need it to be usable on the CLI to automate several tasks with scripting. I just noticed the difference, and I've been searching for a couple of hours, but couldn't find an answer to my problem. Is this intentional? Or a bug? It's driving me mad!

2

There are 2 best solutions below

4
On

Works fine for me to convert from jpg to png in Imagemagick 6.9.12.93 on my Mac OSX Ventura

convert blue.jpg x.png
compare -metric rmse blue.jpg x.png null:
0 (0)

Same result converting to PDF

convert blue.jpg x.pdf
bash-3.2$ compare -metric rmse blue.jpg x.pdf null:
0 (0)

What is your IM version?

Your jpg has no profile. You might want to add an sRGB.icc color profile before converting. That often helps as some viewers and systems handle that differently (add or don't add the profile automatically).

0
On

Also works fine for me. If I

  • convert the JPG to PDF with IM,
  • display both using the same file viewer (Okular)
  • Take a screenshot that includes these two image viewer windows
  • Measure the blue in each window in the screen shot

I get the very same color on both sides.

If you use different apps to check the JPG and the PDF, the PDF viewer could be adding "pop" to the image.