📜  READIMAGE 函数 PHP 代码示例

📅  最后修改于: 2022-03-11 14:54:51.737000             🧑  作者: Mango

代码示例1
Use this to convert all pages of a PDF to JPG:



readImage('myfile.pdf');

$imagick->writeImages('converted.jpg', false);

?>



If you need better quality, try adding $imagick->setResolution(150, 150); before reading the file!



If you experience transparency problems when converting PDF to JPEG (black background), try flattening your file:



readImage('myfile.pdf[0]');

$imagick = $imagick->flattenImages();

$imagick->writeFile('pageone.jpg');

?>



In order to read pages from a PDF-file use [PAGENUMBER] after the filename (pages start from zero!).



Example: Read page #1 from test.pdf



readImage('test.pdf[0]');

$imagick->writeImage('page_one.jpg');

?>