Open notimp opened 3 months ago
Also (on Windows) - putting the following into a .bat file allows you to start comic-translate with a doubleclick on the .bat file. :) Which you can then put onto your Desktop, or wherever.. :)
start powershell -noexit -c "Set-Location -Path '~\Documents\comic-translate'; py -3 comic.py"
(change ~\Documents\comic-translate to whereever your comic-translate folder is located.)
Just another small rough guideline, pricing wise. I could compare the translation performance of Google Translate and GPT4o-mini today.
With Dutch>German the google translate results are good enough. With Italian>German they are pretty bad (you can still understand whats going on, but you'll have word fragments that are not translated about once a double page, and very, very odd bubble translation results about twice a page. The more formal the language becomes, the worse it performs. While the GPT4o-mini results can be considered "good" again.)
That said, pricing wise - there is quite a large difference, with
GPT4o-mini taking about 0.40 Euro per test comic just for translation. And google vision OCR and translate combined taking about 0.18 Euro for the same test comic.
Deepl should be 5x (?) more expensive that GPT4o-mini, just as a rough notion.
So in essence -- test what you need/or what you can live with. Pricing differs by a decent amount. :)
Just another tip. Most of you will probably already know this, but this just fucked with my mind to no end... :) I wondered if it would be possible to find out which comic someone was reading, or sharing an example image of - just using google lens. (Google image search.)
And, turns out - yes, most likely... If the title characters are in the frame...
So this: identified the title character from just a random profile shot of him on a random page I uploaded to illustrate an issue.
But even more impressive, this:
identified the comics main side character (the heros compagnion) from just a random drawing of her in search results 3 and 4.
Mind blown.
I added the dependencies for pdf support, by pip installing everything that comic-translate told me was missing yesterday, and it was simple enough. But installing the dependencies for pdf support by default would probably be a good idea. :)
For people reading along - Im on python-3.9.13 (on a Win 11 system) and simply pip installing what comic-translate told me was missing, when trying to open a pdf was easy and and unproblematic, until comic-translate was complaining, that it was missing a folder named static. That error message went away, when I created that folder in the comic-translate folder. At that point comic-translate threw a "fitz has no attribute open" error. Then I pip uninstalled fitz (yes to all), and then pip installed PyMuPDF - and after that pdf support worked.
Here are some other nifty tools to get a better formating on your comics:
If your comic source has yellowed pages due to time not being tender to the paper pages, and you get the white outlines around characters when the translated text is pasted in, doing a Batch replacing color in Irfanview with something like these settings fixes that:
(An option to chose the font outline color (currently only white is available in comic-translate), would make this easier, and not require you to use Irfanview to do this (automated, so using Irfanviews batch convert option.))
If you ultimately want to extract images from your pdfs, this tool was very helpful for realizing that on Windows (xpdfs pdfimages.exe, download command line tools zip file, its linked in there): https://superuser.com/questions/134869/how-to-extract-image-from-pdf-file
Also if your comic source formated the comic for ereaders (so single page view), but you want double pages, this can be automated using Irfanview and the following .bat file - as well as Total commander, a specific plugin (to select every second (odd or even (plugin named it odd yes or odd no))) file in a folder only) and Total commanders mass rename feature.
How to: Check if your right side images of double pages would be even or odd numbered. Navigate to the image folder in Total commander, do a plugin search with the misc plugin for odd yes or no (see: https://www.ghisler.ch/board/viewtopic.php?t=38681 ). Check if you caught your set of right hand images, if not exit search and try again. (Sometimes it doesnt catch the odd yes or no switch either, exit search and trying it again fixes that as well), then use the right most button to apply the search to your folder. ctrl+A to mark all files, total commander>file>mass renamer - rename for [N]02 (which adds a 02 at the end of every filename selected).
Then do the search again, this time switching odd yes or no to the other one. Select all (other) files. Ctrl+A, File > Mass renamer, and rename like this:
-[C]
[C] in Total Commanders Mass rename tool is a number counter you can set like you want to in Total commander. Set it to N plus 1 for your first image, so if your first image is named 1 set it to start with 2. Set the step from 1 to 2, so it doesnt increase the counter by 1, but by 2 numbers for every file, and set leading filler zeros in the last box to (up to) 4. (For images extracted with xpdfs pdfimages.exe always have a 4 figures numbered value as their filename). Check if your last image in the list gets its filename number increased by one. If yes, apply.
All files will then be named
-0004.jpg -000402.jpg
and so on and so forth.
If you dont want certain images to get merged with the 02 version of the image, rename them manually (cover image, first or last image of a comic), by removing the 02 and changing the filename number to one that isnt used, but doesnt change the file order.
(the leading - of -0004.jpg is caused by running pdfimages.exe in cmd using
pdfimages.exe -j "nameofyourpdf.pdf" ""
to extract the images from your pdf.
For some reason this only works in cmd and not in powershell. If youd not use "" but "bleh" instead, images would be named bleh-0004.jpg
I just kept the leading -
Less typing.. ;) )
Then put the following into a .bat file (kudos go to the user at https://stackoverflow.com/questions/70126823/trying-to-batch-merge-2-jpegs-horizontally-and-put-them-in-a-different-folder for creating it):
(Formating might be important as well (where a new line begins), use this as a guideline: )
create the dp0images and dp0merged folders on your desktop. Move all your
-0001.jpg -0002.jpg -0004.jpg -000402.jpg -0006.jpg -000602.jpg -0008.jpg -000802.jpg [...]
named images into dp0images and run the .bat file. And the merged images (left side and right side images merged into a double page image) will appear in the dp0merged folder.
(Dont forget to copy the images you chose not to merge - so
-0001.jpg -0002.jpg
back into the merged images folder as well, before creating your .cbz file. :) )
Have fun. :)
edit: Cleanly exiting/leaving the folder (to a previous folder f.e.) and then entering the folder again and doing the (misc plugin) search as the first action after that actually is what makes the misc plugin behave properly. :) I was getting inconsistent behavior before, and guessed, that exiting search and entering again, made it work, but it seems to be leaving the folder, entering it again, and doing the search as the first thing upon reentering it, that actually leads to the expected results - in a more constant fashion. :)