I am trying to convert PDF to JPG using ImageMagick on CodeIgniter, but the generated image is of poor quality and always has a black background for some reason (while PDF is not).
The code I use
public function converter($pdf){ $this->load->library('image_lib'); $config = array( 'image_library' => 'imagemagick', 'library_path' => '/usr/bin/convert', 'source_image' => "./pdf/".$pdf, 'new_image' => "./images/a.jpg", 'maintain_ratio' => true, 'width' => 980, 'quality' => '90%', ); $this->image_lib->initialize( $config ); if ( $this->image_lib->resize( ) ) { $this->image_lib->clear( ); } }
Does anyone have an idea of โโwhat seems wrong here?
source share