imagemagick - PHP Imagick produces black png from multi page pdf -
i need uploaded pdf converted 1 long png image. simple images (e.g. jpg) works fine , pdf if convert last page (default). when try convert pages of pdf 1 png produces long black image or long black image white strip.
if ($file === null || !($file instanceof uploadedfile)) { throw new \logicexception('no uploadable file found'); } $tmpfile = $file->getrealpath(); try { $im = new \imagick(); $im->pingimage($tmpfile); $im->setresolution(140, 140); $im->readimage($tmpfile); switch ($file->getmimetype()) { case 'application/pdf': $im->resetiterator(); $ima = $im->appendimages(true); $ima->setimageformat('png'); $ima->writeimage(); $ima->clear(); $ima->destroy(); break; default: break; //return new response('error'); }
well figured out problem..may need this. dont know why , how pingimage() method caused problem. interesting imo not make problem if (by default) want convert 1 page of pdf or not multipaged images. removed method produced image correct. note use windows 8 , havent tried on linux. may method doesnt make problem on linux.
Comments
Post a Comment