Open mindeffects opened 10 years ago
You're right; it'd be nice if it could do this. I think I can add PDF support for the imagick driver at least. GD won't read PDFs and I'm not sure about gmagick.
It would be awesome if this would work. I need it for a current project. I need to convert the first uploaded page of pdf into an image in the frontend. Any tips on how to do that?
oo12 has left the building. :-(
Say, @rthrash : Could you make @mindeffects and @inreti admins for keeping this baby alive and growing?
@sonicpunk : I use the ImageMagick command line tool for converting single and multipage PDFs to images:
#!/bin/bash
convert -verbose -density 72x72 -resize 210x297 singlepage.pdf singlepage.png
convert -verbose -density 72x72 -resize 210x297 multipage.pdf multipage_page-%03d.png
In order to do this you have to have "gs" (GhostScript) on your server to handle PDFs. Would be nice to have this stuff at our fingerstips in MODX. ;-)
@mindeffects absolutely. It's going to transfer into @modxcms soon too. :)
@mindeffects @inreti welcome to the admin club. :)
Thanks, @rthrash! What does "It's going to transfer into @modxcms soon too." mean? Full IM support inside of MODX would be great and should make a supasweat core feature! Having broken thumbs of PDFs and SVGs should be a thing we leave behind.
Hi @mindeffects ! I need a script that can on the fly create the image from the pdf... so a command line solution may not be the best for me. I would love this to be added to resizer!!
the owner of the repo is going to modx. there are some things that @garryn, @netProphET and others want to do to improve this with an eye towards replacing the less than ideal phpThumb stuff currently in the core. No promises, but it's been bounced around as an idea.
But you can test the conversion in the CLI, @sonicpunk. If it does not work there, your server might have a problem with creating the stuff you want anyway. Or try this in a snippet:
<?php
$im = new Imagick();
$im->setResolution( 300, 300 );
$im->readImage( "test.pdf" );
?>
At least this should work for one page. Maybe you find some inspiration here: http://stackoverflow.com/questions/11329395/converting-multipage-pdf-to-multi-images
That is true @mindeffects, thanks for the tip. Do we have an ETA on this for resizer?
I would want to pass complete command lines to ImageMagick (or Mogrify).
This here converts a multipage CMYK PDF to cropped and numbered 300dpi RGB JPGs with "Photoshop level 11" quality (=92), using colorprofiles for input and output:
convert -density 300 'multipage-cmyl.pdf' -crop '1529x2161+166+0' -quality 92 -profile 'ISOcoated_v2_300_eci.icc' -profile 'sRGB.icc' -colorspace sRGB output_%02d.jpg
Maybe "Resizer" would then not be the best name for this extras any more. ;-)
Yep, if we utilize the whole function of IM here, there is much more in it than just resizing. Think of overlays and other combining of images.
Somehow Resizer does not like PDFs, which is sad, because i really like Resizer's speed and quality and – very important – its ability to handle CMYK inputs and RGB outputs, which would be exactly what I would need for PDFs: Being able to use my PDF-X/3s or PDX-X/4s and have RGB thumbsnails generated from them. When using pThumb "without" Resizer, PDFs can be converted to JPGs. Trying this "with" Resizer activated, the conversion fails. Thank you for your awesome work! Oliver