품질 저하없이 여러 pdf 파일을 jpeg 이미지로 변환하는 가장 빠른 방법을 찾으려고합니다.복수 페이지 pdf를 jpg 이미지로 변환하는 가장 빠른 방법
$this->imagick = new \Imagick();
$this->imagick->setresolution(300,300);
$this->imagick->readimage($this->uploadPath . '/original/test.pdf');
$num_pages = $this->imagick->getNumberImages();
for($i = 0;$i < $num_pages; $i++) {
$this->imagick->setIteratorIndex($i);
$this->imagick->setImageFormat('jpeg');
$this->imagick->readimage($asset);
// i need the width, height and filename of each image to add
// to the DB
$origWidth = $this->imagick->getImageWidth();
$origHeight = $this->imagick->getImageHeight();
$filename = $this->imagick->getImageFilename();
$this->imagick->writeImage($this->uploadPath . '/large/preview-' . $this->imagick->getIteratorIndex() . '.jpg');
$this->imagick->scaleImage($origWidth/2, $origHeight/2);
$this->imagick->writeImage($this->uploadPath . '/normal/preview-' . $this->imagick->getIteratorIndex() . '.jpg');
//add asset to the DB with the given width, height and filename ...
}
이 해상도가 너무 커서 부분적으로 있기 때문에, 아주 느린 네가하지만 내가 추가 해달라고이며, 이미지의 텍스트가 매우 품질이 좋지 : 나는 다음과 같은 코드가 있습니다. 또한 이미지를 먼저 저장하고 파일의 작은 버전을 저장한다는 사실은 아마도 매우 최적화되지 않았을 것입니다.
누구나이 작업을 수행하는 데 더 좋은 방법이 있습니까? 어쩌면 고스트 스크립트만으로도 될까요?
최소 요구 사항은 변환 된 이미지의 2 가지 버전이 필요하다는 것입니다. 실제 크기 버전과 절반 크기의 버전. 그리고 난 너비와 높이와 파일 이름을 데이터베이스에 추가해야합니다.
"이미지의 텍스트 품질이 매우 좋지 않습니다." - 제 대답을 확인하십시오 http://stackoverflow.com/a/23144243/778719 – Danack