Coder Social home page Coder Social logo

Grid parameter ignored for pdfs about timg HOT 6 CLOSED

xeruf avatar xeruf commented on June 16, 2024
Grid parameter ignored for pdfs

from timg.

Comments (6)

hzeller avatar hzeller commented on June 16, 2024

Interesting, indeed.
The reason is, that a PDF is treated as single 'image' as it is a single file even though it has multiple sub-images.

This should probably be broken up and behave as if it was separate independent images that then nicely arrange in the grid.

from timg.

hzeller avatar hzeller commented on June 16, 2024

Alright, should be fixed now.
Can you do a fresh git pull, recompile and test with your PDF ?

from timg.

xeruf avatar xeruf commented on June 16, 2024

Thank you, works :)

Just a little thing, but that might also be the fault of kitty -
When I allow height overflow, there is a slight offset within the grid:
image

timg --grid=2 Oceans\ \(D\)\ -\ Akkorde.pdf -W

Scrolled up:

image

from timg.

hzeller avatar hzeller commented on June 16, 2024

I don't observe that with Kitty, but maybe the PDF has different page sizes ? I have to test for that situation and double check that -W works in these cases.

(BTW, if you add --auto-crop unnecessary whitespace around is cropped, so you might get less of the whitespace pixels using up space).

Re-opening now while investigation is going on to reproduce.

from timg.

xeruf avatar xeruf commented on June 16, 2024

I am seeing this for any PDF with multiple pages, all A4, even with auto-crop enabled (which is a good hint, thank you :) )

As said, this is only when the height overflows i.e. each image is bigger than the terminal height. It also happens for images, so this is not PDF-related.

from timg.

hzeller avatar hzeller commented on June 16, 2024

So the problem here is, that if you have -W, a page might be longer than the terminal and have to scroll down a little.
but in the grid, the cursor needs to jump up to the next page.
Now, the way terminals work, they don't allow to jump the cursor beyond the top of the terminal. So if the previos page is a bit longer, the next page will only be displayed starting from the position it could jump to .. slightly down.

So there is nothing we can do about this here.

In the latest release ( https://github.com/hzeller/timg/releases/tag/v1.6.0 ), the resolution of the rendering has been improved. I typically can easily read PDS with --grid=2x1 -U or even --grid=3x1 (also, it is faster).
So if you read PDFs a lot, this might be an interesting release for you.

from timg.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.