ImageMagick / ImageMagick6

🧙‍♂️ ImageMagick 6
https://legacy.imagemagick.org
Other
198 stars 82 forks source link

Smaller PDF page contains white background while converting #138

Open gopal-augment opened 3 years ago

gopal-augment commented 3 years ago

Prerequisites

ImageMagick version

6

Operating system

Linux

Operating system, version and so on

20.04

Description

convert -density 150 -alpha remove -colorspace sRGB pdf[0].pdf -quality 100 out.jpg

After converting to JPG, it created with white background around it

Steps to Reproduce

convert -density 150 -alpha remove -colorspace sRGB pdf[0].pdf -quality 100 out.jpg

After converting to JPG, it created with white background around it

convert -density 150 -alpha remove -colorspace sRGB pdf[0].pdf -quality 100 out.jpg

After converting to JPG, it created with white background around it

fmw42 commented 3 years ago

Please post your input PDF file.

gopal-augment commented 3 years ago

PDF.

Please get the PDF from the above link. And the page number 8 we are facing that white background around it, other pages looks fine.

fmw42 commented 3 years ago

The histogram of that page shows a fully opaque alpha channel with white underneath it.

500559: (65535,65535,65535,65535) #FFFFFFFFFFFFFFFF white

So you cannot just turn off the alpha channel and expect anything other than white. You would have to fuzzy change white to black. But that would leave artifacts.

gopal-augment commented 3 years ago

Not understand. What should I change in my convert command. That should convert all types of PDFs to the correct image. Please let me know

fmw42 commented 3 years ago

What does the "correct" image look like? What do you want in place of white?

gopal-augment commented 3 years ago

Should the same as on Pdf pages. don't want add any background or cutoff

fmw42 commented 3 years ago

I do not understand. What do you see as the background? I just see white.

gopal-augment commented 3 years ago

On page 7, I can see white color around the image. So we dont want that

fmw42 commented 3 years ago

That page is padded with transparency. You can add -trim to your command to remove it.

convert -density 150 -colorspace sRGB pdf[0].pdf -trim -quality 100 out.jpg

gopal-augment commented 3 years ago

If I use -trim, it will cut off the top and bottom in the last page pdf.

fmw42 commented 3 years ago

I will have to leave this to the IM developers.

gopal-augment commented 3 years ago

Okay. I'm looking forward