Girbons / comics-downloader

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

double page panels are squeezed horizontally, compared to online version #29

Closed nestukh closed 4 years ago

nestukh commented 5 years ago

eg https://mangarock.com/manga/mrs-serie-114471/chapter/mrs-chapter-100341810 pages 2 and following

nestukh commented 5 years ago

I would like to add personally, I would prefer keeping original double page panels than cutting them in half, as mangas can be printed in international version (left to right) or in the original right to left script. Too much confusion otherwise. Just like you read them online, in short

Girbons commented 5 years ago

I would prefer keeping original double page panels than cutting them in half

I agree with you.

mangas can be printed in international version (left to right) or in the original right to left script. Too much confusion otherwise. Just like you read them online, in short

Its not easy to achieve with EPUB, I mean to make a manga readable from right-to-left, the only thing that I can do is to create the EPUB from the last page to the first one.

nestukh commented 5 years ago

it it possible to have

for epubs, maybe it's better to integrate ebook-convert from Calibre somehow, as it's like # PDF ---> EPUB ebook-convert file.pdf file.epub (there is also go-calibre)

I admidt I haven't checked licenses, should be fine

Girbons commented 5 years ago

it it possible to have normal portrait A4 pages for single panel pages landscape A4 pages for double panel pages (not 90° rotated text) ?

The problem is, how to distinguish single panel pages from double panel pages?

(I've seen the commit but didn't compile yet, have to learn golang first, just seemed all A4 landscape pages now, I cannot tell if I'm correct)

Correct, now by default the PDF is in landscape in order to fit every image correctly.

for epubs, maybe it's better to integrate ebook-convert from Calibre somehow, as it's like ebook-convert file.pdf file.epub (there is also go-calibre)

Yes this could solve the problem, I'll take a look!

nestukh commented 5 years ago

I think gofpdf isn't good for complex cases, probably a possible solution to multiple problems: I've seen in the code that comics-downloader donwloads all images for CBR/CBZ formats So you can use ImageMagick tools, poppler pdf tools, PDFtk PDFcpu and calibre tools, and merge images in a single pdf and other stuff

. . . . linux examples

# to merge in alfabetical order all files of the current folder in foo1.pdf # perfect for images: every image is a page, in its original format, no distortion whatsoever convert *.* foo1.pdf

. . . . if you really want to convert everything to A4, then

# to check if pages are larger than taller, using theirMediaBoxes pdfinfo -box -f 1 -l $(pdfinfo foo1.pdf | grep -aP "^Pages:" | sed "s/Pages:\W*//g") foo1.pdf | grep -aP "^Page" | grep -P "MediaBox:" output (3 photos in this pdf, first one horizontal): Page 1 MediaBox: 0.00 0.00 2419.00 1469.00 Page 2 MediaBox: 0.00 0.00 3120.00 4160.00 Page 3 MediaBox: 0.00 0.00 3120.00 4160.00

# converting to portrait A4 pages (landscape images will rotate 90 degrees) convert -density 300 -define pdf:fit-page=A4 foo1.pdf ffoutA4.pdf

# derotating the first page (that here we know it's an horizontal image) # images will be centered pdftk ffoutA4.pdf cat 1east 2-end output ffoutA4final.pdf

. . . . . . . # installing tools on linux sudo apt-get install -y imagemagick # provides convert and pdfinfo, among others sudo apt-get install -y poppler-utils # provides pdfinfo, among others sudo apt-get install -y pdftk

-- other famous tools like gs (ghostscript package) could be used

nestukh commented 5 years ago

it's ok, I know it's a lot to read, you don't have to fix this that soon, I can wait without problems, it's already great that works well enough already

nestukh commented 5 years ago

I just checked it's easier the previously stated there is no cbz or cbr format mention on ebook-convert page, but there are the Comic Input Options https://manual.calibre-ebook.com/generated/en/ebook-convert.html#comic-input-options

this command will convert a cbz file into a P A4 pdf file, landscape images scaled to fit vertical A4 pages ebook-convert manga.cbz manga-portraitA4.pdf --disable-trim --dont-grayscale --dont-normalize --dont-sharpen --no-process

so I guess Calibre wrappings can suffice, with saving any manga in cbz (is rar still proprietary, for cbr?) and then converting it to other formats

Girbons commented 5 years ago

@nestukh thanks for digging deeper,

linux examples convert . foo1.pdf

This is the command of which mentioned library?

It's such a great thing to use ebook-converter, we need to discuss how, because I want to keep the downloader simple, without forcing users to download extra dependencies.

So the workaround could be:

nestukh commented 5 years ago

I've tought about it

The simpler way would be: comics-downloader saves a manga issue as:

Because:

In this way, no too much rewriting is necessary, in fact you could delete the pdf part. If they (the audience) want the pdf part, then perhaps will be best to include the ImageMagick library in the code.

I've already updated my bash script in saving files in cbz format as default.

nestukh commented 5 years ago

If you think the same, you can close the issue

Girbons commented 5 years ago

@nestukh I got your point but the downloader was developed to create the final file and I don't want to change this behaviour and force the user to run extra commands.

as cbz or cbr with the same name as the issue, as it already does (P.S. I've noticed same issue with '/' on linux with cbz filenames)

Could you give me an example url in order to reproduce it?

nestukh commented 5 years ago

https://mangarock.com/manga/mrs-serie-358279/chapter/mrs-chapter-100420585

Girbons commented 5 years ago

@nestukh v0.12.3 includes the fix for this

as cbz or cbr with the same name as the issue, as it already does (P.S. I've noticed same issue with '/' on linux with cbz filenames).

nestukh commented 5 years ago

thank you my bash script is already updated to update comics-downloader automatically