ImageMagick6 icon indicating copy to clipboard operation
ImageMagick6 copied to clipboard

Smaller PDF page contains white background while converting

Open gopal-augment opened this issue 3 years ago • 12 comments

Prerequisites

  • [X] I have written a descriptive issue title
  • [X] I have searched open and closed issues to ensure it has not already been reported
  • [ ] I have verified that I am using the latest version of ImageMagick

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

gopal-augment avatar Mar 16 '21 17:03 gopal-augment

Please post your input PDF file.

fmw42 avatar Mar 16 '21 22:03 fmw42

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.

gopal-augment avatar Mar 16 '21 22:03 gopal-augment

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.

fmw42 avatar Mar 16 '21 22:03 fmw42

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

gopal-augment avatar Mar 17 '21 12:03 gopal-augment

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

fmw42 avatar Mar 17 '21 15:03 fmw42

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

gopal-augment avatar Mar 17 '21 15:03 gopal-augment

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

fmw42 avatar Mar 17 '21 15:03 fmw42

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

gopal-augment avatar Mar 17 '21 15:03 gopal-augment

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

fmw42 avatar Mar 17 '21 16:03 fmw42

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

gopal-augment avatar Mar 17 '21 16:03 gopal-augment

I will have to leave this to the IM developers.

fmw42 avatar Mar 17 '21 16:03 fmw42

Okay. I'm looking forward

gopal-augment avatar Mar 17 '21 17:03 gopal-augment