convert PDF to PNG gives gray instead of white background
Posted: 2015-07-20T13:00:24-07:00
I'm using Perl::Magick to convert PDFs containing black text on a white background to PNGs using ImageMagick 6.7.7-10 2014-03-06 Q16.
The code looks like:
where the input path points to a PDF file and the output to a PNG file.
The resulting PNGs have a gray background and seem to have acquired alpha/matte channels.
When I convert the same files via the command line using ImageMagick 6.9.0-9 Q16 x86_64 2015-03-02, I get what I want, black text on a white background.
This should be simple. How can I get what I want?
Thanks,
-J
The code looks like:
Code: Select all
my $image = Image::Magick->new( density => $density,
units => 'PixelsPerInch' );
my $err = $image->Read( $input_path );
if ( "$err" ) {
$self->logger->logdie( "Read error: $err" );
}
$image->Write( $output_path );
The resulting PNGs have a gray background and seem to have acquired alpha/matte channels.
When I convert the same files via the command line using ImageMagick 6.9.0-9 Q16 x86_64 2015-03-02, I get what I want, black text on a white background.
This should be simple. How can I get what I want?
Thanks,
-J