Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

.thumbnail method and input options #267

tomasc started this conversation in Ideas
Discussion options

It would be fantastic if the thumbnail method would accept :dpi and :page options in order to fully support rendering of thumbnails from PDF files.

You must be logged in to vote

Replies: 3 comments

Comment options

Hi, you can put page into the filename, eg.:

vips thumbnail nip2guide.pdf[page=12] -o x.jpg

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.

You must be logged in to vote
0 replies
Comment options

Hi John, thanks for reply.

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.)

You must be logged in to vote
0 replies
Comment options

thumbnail just rasterises the PDF at the exact size you ask for. It gives nice results for me, for example the ISO res chart:

vipsthumbnail ISO_12233-reschart.pdf

Gives:

tn_iso_12233-reschart

Do you have an example of a PDF that fails to rasterise well?

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #111 on January 31, 2021 13:10.

AltStyle によって変換されたページ (->オリジナル) /