Cortys / comic-backup

Back up your comics as CBZ.
https://cmxlgy.wordpress.com
GNU General Public License v3.0
295 stars 33 forks source link

online reader forced double page view #78

Open AnomalyFS2 opened 5 years ago

AnomalyFS2 commented 5 years ago

Whenever I download a comic, it's in double page view because the online reader forces that on you for Manga. Is there a workaround for that so it shows pages in single page mode when I download them?

sgbeal commented 5 years ago

This extension effectively takes a screenshot of whatever the reader shows, so if the reader forces two-page view for Mangas then that's all that this extension can do.

AnomalyFS2 commented 5 years ago

Figured that would be the case. That sucks, considering they have one page mode available on tablets.

sgbeal commented 5 years ago

Their support has always been very responsive. i recommend passing on the request for single-page mode to them (just don't mention that you want it for this particular purpose, as we don't want their explicit attention ;)).

sgbeal commented 5 years ago

Another option would be to post-process the saved file, using command-line tools to script the chopping-up of the double pages. The ImageMagick tools can slice up images that way, and a CBZ is just a zip file, so any zipping tool can unpack/re-pack it. It would require a one-time scripting investment, but shouldn't take more than an hour if you're halfway familiar with the various tools.

AnomalyFS2 commented 5 years ago

Not very familiar with those, unfortunately. Thanks for your help, appreciated.

TBthegr81 commented 5 years ago

Also have this problem. I have never tinkered with an Extension before but looking at the code that actually grabs the imagedata I can see it looping over every canvas element on the page and transfering its content to a single newly created canvas that then gets blobbed

Would this not be as easy as to create two canvas elements and read half the width of the source-canvases? And then run the same code to create a page as usual. (Would probably be accessed thru some options like "do you wanna split double pages") Something like:

if(w > h) {
    var outCanvas2 = document.createElement('canvas'),
    ctx2 = outCanvas2.getContext('2d');
    outCanvas.width = w/2;
    outCanvas2.width = w/2;
    outCanvas2.height = h;
}
if(w > h) {
    ctx.drawImage(canvas, 0, 0, w/2, h, 0, 0, w/2, h);
    ctx2.drawImage(canvas, w/2, 0 , w/2, h, 0, 0, w/2, h);
}
else {
    ctx.drawImage(canvas, parseInt(canvas.style.left) || 0, parseInt(canvas.style.top) || 0, parseInt(canvas.style.width) || 0, parseInt(canvas.style.height) || 0);
}

I tried this and I get the left side of each page, not sure how to save both canvases as separate images though.

Also not sure if checking width against height is good enuff for all comics/manga on the site, I suppose some series might have odd aspect-ratios and there could be some more effective way to check for double pages.

Nosgoroth commented 5 years ago

This would probably be a good idea, but in the meantime I'm going to go ahead and save everything I have as PNG, so that if I want to post-process it lately I can do it losslessly.

sgbeal commented 5 years ago

Checking width against height isn't a solution - two-page spreads are quite common in non-manga books.

TBthegr81 commented 5 years ago

I did finish what I was talking about and now I rip my manga so I can read it on my tablet. Not sure what the procedure is here, should I make a issue-branch an' push it to github so others can look at it?

@sgbeal There is two-page spreads in the manga I wanted to save too, but it still a bad idea unless you can rotate the picture so it displays correctly on a tablet-screen. I would rather have a spread cut in half, being able to read the text without having to zoom and pan across the page. I'm not familiar enuff with the site to know if you could detect two-page spreads and then apply different rules to them... Right now the easiest would be to have an option if you wanna enable cutting of the page or not, and turn it off for comics where it doesn't work.

sgbeal commented 5 years ago

Two-page views are the bane of e-comics :(. Because such spreads often (but not always) have to be read left to right, there's no way the reader can know whether splitting a given view makes sense. For one which is intended to be read left to right across the whole two pages, splitting would be a disaster. The final issue of Fables (number 150) is almost entirely two-page views, many of which would be ruined, both graphically and in terms of reading, by splitting them.