Skip to content

.thumbnail method and input options #111

Closed

Description

@tomasc

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.

Activity

  1. jcupitt commented on Jun 13, 2017

    @jcupitt
    Member

    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.

  2. tomasc commented on Jun 13, 2017

    @tomasc
    Author

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

  3. jcupitt commented on Jun 14, 2017

    @jcupitt
    Member

    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?

  4. locked and limited conversation to collaborators on Jan 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions