Hi.
I am using ghostscript and imagemagick to convert pdf-files to jpg image files. Unfortunatly I am experiencing problems with some pdf files that contains a lot of transparent objects. In theese case the conversion process only generates blank output
But when I optimize the pdf files in acrobat professional (the problem is solved)
To skip this step in acrobat professional I was wondering if there was a way to use imagemagick to flatten transparency?
Theese are the settings I am using for imagemagick:
-density 250 -units PixelsPerInch -define pdf:use-cropbox=true -quality 90% -colorspace RGB -layers flatten
-Thanks
Flatten transparency
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Flatten transparency
Don't know if this will help. but have you tried -flatten rather than -layers flattenmarcher wrote:Hi.
I am using ghostscript and imagemagick to convert pdf-files to jpg image files. Unfortunatly I am experiencing problems with some pdf files that contains a lot of transparent objects. In theese case the conversion process only generates blank output
But when I optimize the pdf files in acrobat professional (the problem is solved)
To skip this step in acrobat professional I was wondering if there was a way to use imagemagick to flatten transparency?
Theese are the settings I am using for imagemagick:
-density 250 -units PixelsPerInch -define pdf:use-cropbox=true -quality 90% -colorspace RGB -layers flatten
-Thanks
Re: Flatten transparency
Hi.
yes I have tryed this setting too, but unfortunatly there wasent any difference in the result.
yes I have tryed this setting too, but unfortunatly there wasent any difference in the result.
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Flatten transparency
-flatten and -layers flatten are the same thing. The former is for backward compatibility and convenience.
I hope you are not trying to go from PDF to PDF, that is not a good thing to do with IM as that it outside its scope.
See A word about Vector Image formats
http://www.imagemagick.org/Usage/formats/#vector
I hope you are not trying to go from PDF to PDF, that is not a good thing to do with IM as that it outside its scope.
See A word about Vector Image formats
http://www.imagemagick.org/Usage/formats/#vector
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: Flatten transparency
Hi Anthony.
Thanks for replying to my post. No I'm not trying to go from PDF to PDF, it's from PDF to jpg.
After testing multiple settings I have discovered that if I remove the -density 250 or lower it to -density 50 the pages which gave me problems are created unfortunatly the quality is very low and jagged. As mentioned earlier then the problem seems to appear when the PDF page contains a lot of transparent objects.
The pages that dosent contain a lot of transparent objects are processed without any problems by using the settings described in my previoius post.
Thanks for replying to my post. No I'm not trying to go from PDF to PDF, it's from PDF to jpg.
After testing multiple settings I have discovered that if I remove the -density 250 or lower it to -density 50 the pages which gave me problems are created unfortunatly the quality is very low and jagged. As mentioned earlier then the problem seems to appear when the PDF page contains a lot of transparent objects.
The pages that dosent contain a lot of transparent objects are processed without any problems by using the settings described in my previoius post.
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Flatten transparency
JPEG can't handle transparency. You will need to underlay some background color to the image before saving to JPEG.
The -flatten mentioned is the typical method to do this.
The -flatten mentioned is the typical method to do this.
Code: Select all
convert .... -background white -flatten image.jpg
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/