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

Smaller PDF page contains white background while converting #138

Open
2 of 3 tasks
gopal-augment opened this issue Mar 16, 2021 · 12 comments
Open
2 of 3 tasks

Smaller PDF page contains white background while converting #138

gopal-augment opened this issue Mar 16, 2021 · 12 comments

Comments

@gopal-augment
Copy link

Prerequisites

  • I have written a descriptive issue title
  • 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

@dlemstra dlemstra transferred this issue from ImageMagick/ImageMagick Mar 16, 2021
@fmw42
Copy link

fmw42 commented Mar 16, 2021

Please post your input PDF file.

@gopal-augment
Copy link
Author

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
Copy link

fmw42 commented Mar 16, 2021

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
Copy link
Author

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
Copy link

fmw42 commented Mar 17, 2021

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

@gopal-augment
Copy link
Author

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

@fmw42
Copy link

fmw42 commented Mar 17, 2021

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

@gopal-augment
Copy link
Author

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

@fmw42
Copy link

fmw42 commented Mar 17, 2021

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
Copy link
Author

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

@fmw42
Copy link

fmw42 commented Mar 17, 2021

I will have to leave this to the IM developers.

@gopal-augment
Copy link
Author

Okay. I'm looking forward

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants