You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I agree having a proper page parameter would be simpler.
You're right, you can't use dpi to size thumbnails, you can only give a size in pixels. You can calculate a pixel size from the image xres and your desired DPI, of course.
I'm not certain that sizing by DPI is very useful. Many PDFs have strange values set for DPI and you could get almost any size thumbnail as a result.
I think it would be great if the api would be same as for .new_from_file here eventually.
As for dpi – I assumed that when supplied as input option the PDF is internally rasterised to that DPI and then scaled down with for example the .resize. It would be great if .thumbnail works the same so that we do not need to run it twice – once to generate large version from PDF, second time to scale it down to actual thumbnail.
(For now, I went back to the .resize method in dragonfly_libvips because using the .thumbnail breaks all PDF rasterisation – ie the images have correct pixel size but appear low-res, pixellated.)
Activity
jcupitt commentedon Jun 13, 2017
Hi, you can put
pageinto the filename, eg.:I agree having a proper
pageparameter would be simpler.You're right, you can't use
dpito size thumbnails, you can only give a size in pixels. You can calculate a pixel size from the imagexresand your desired DPI, of course.I'm not certain that sizing by DPI is very useful. Many PDFs have strange values set for DPI and you could get almost any size thumbnail as a result.
tomasc commentedon Jun 13, 2017
Hi John, thanks for reply.
I think it would be great if the api would be same as for
.new_from_filehere eventually.As for dpi – I assumed that when supplied as input option the PDF is internally rasterised to that DPI and then scaled down with for example the
.resize. It would be great if.thumbnailworks the same so that we do not need to run it twice – once to generate large version from PDF, second time to scale it down to actual thumbnail.(For now, I went back to the
.resizemethod indragonfly_libvipsbecause using the.thumbnailbreaks all PDF rasterisation – ie the images have correct pixel size but appear low-res, pixellated.)jcupitt commentedon Jun 14, 2017
thumbnailjust rasterises the PDF at the exact size you ask for. It gives nice results for me, for example the ISO res chart:Gives:
Do you have an example of a PDF that fails to rasterise well?