Girbons / comics-downloader

tool to download comics and manga in pdf/epub/cbr/cbz from a website
MIT License
456 stars 49 forks source link

Grab image size, use to set PDF page size #86

Closed kshunterco closed 3 years ago

kshunterco commented 3 years ago

Hey, so this change opens each image, determines image size in pixels, then uses that info (based on a pixel/mm scaling) to size each individual PDF page to the image.

I haven't see it "fail", i.e. I haven't checked what goes wrong when I reach the '// DEBUG MESSAGE' part of the code, it was able to always process the image and get the info from it, but I can keep trying.

This change yields PDFs that contain unscaled images... so if the original image is more of a landscape (wider than taller) image, it remains that way in the PDF.

I suppose an option could be added, something like "-force-aspect" that would make it keep the A4 aspect ratio...

I will post a comparison of the 0.28.2 result and the result from this shortly.

kshunterco commented 3 years ago

Hmm, not sure why the build failed. Something to do with the environment. It builds for me?!? Here's what the change does to the files.

Current version forces everything to A4, so "squashes" a wide image (top page of this comic), also reduces size overall: Result_0 28 2

Revision allows each image to appear at its actual aspect and size: Result_0 28 2+natural-image-aspect

Note that these PDFs are both scaled at 37.1%, so the larger lower page is a true effect, not due to different scaling.

kshunterco commented 3 years ago

Thanks @Girbons ! I just made your changes (I think?) and it runs fine under Windows.