Like us on Facebook, follow us on Twitter! Celebrate another year with MH and read our yearbook.
Manga News: Check out this week's new manga (8/11/14 - 8/17/14).
Forum News: Visit new sections for Nisekoi and Kingdom!
Translations: Gintama 506 (2)
Edit: As you might have noticed from my old script i am still a "cleaning" noob (although im not really cleaning just applying general attributes). I had only used the previously posted script on Rena-chan's already high quality large files. After messing around with the kodansha raws I've thrown together a new script I think will work better for a larger spectrum of raws. I'll write up the new instructions sometime later but from looking at the script and referencing the old procedure it should be pretty self explanatory.
I posted this over in the Jtutorials forum but I spent so much time writing it I thought it'd be a waste not to bring it over to a larger fanbase so I can expect criticism and suggestions faster =)
Scanlators have it rough cleaning the raws up before tossing them out for us to enjoy no one will contest that. I don't offer the following tutorial for scanlator usage (although they're more then welcome to it if they find this helpful) but for us fans who have in their possession large quantities of manga raws yet to be scanlated in eye straining quality.
I had some time to kill so I decided to look for a way to "batch process" multiple raw B+W images of roughly the same quality into better looking and less space consuming reading material (more like viewing for me as I can't read jap =P). Well I found it and now im going to share it in case any other raw browsers find it useful.
First off the results to expect in the form of a before and after: 1.
Now this in itself isn't very special, but I have written a script (macro) that performs the same changes to every image in the specified folder and the only real interaction required of you is to change some values in the script which can be found easy.
The only requirements are the latest free Gimp 2.6+, a text editor (I just use notepad), and the warp sharp plugin found at http://www.home.unix-ag.org/simon/gimp/warp-sharp.scm
I will go through each step the script performs and in detail list what you are required to do.
1. Assuming you have finished installing gimp load the image from the folder you'd like to mass apply changes to (Important: the folder should have all images roughly the same quality probably meaning they all came from the same raw provider (perfect example a tank)
2. Before we can put the script to use we need to change the variables in the script and we do this with experimenting on one of the images in the folder.
"BTW these instructions are specific to Vista"
Here is the script after we are done with it you will save it into C:\Users\"username"\.gimp-2.6\scripts:
Either write down the changes we are about to do to the script on a piece of paper next to you or modify the script as we go (copy and paste into notepad)
Inside Gimp with image loaded:
1. Go to the upper menu and select Image>Mode and if it isn't already in RGB format select it, this is crucial to apply changes. (The script requires no changes here it checks if the image is RGB or not and if it isn't it automatically converts it)
2. Next go to Colors> Desaturate and just select Average (I don't find this step all that important but it's a precaution and again the script still doesn't need any changing)
3. Now here's where the real changes start- go to Colors>Levels and a box will come up displaying what looks like a hill range. Select the furthest right triangle below the Input box and drag it left, the further left the whiter the whites are in your image. As a general rule you stop the slider at the bottom LEFT side (base) of the nearest large hill. Now select the furthest left triangle beneath input and drag it right, you can just observe the image which is still visible and stop when you think the darks are dark enough (don't make it TOO dark we still want our whites looking nice, we'll use other methods to darken the darks later) Now you can just manually change the middle value if you want, by default its at 1.00 there's no need to change it but if you select the box and type in say 0.6 you'll notice the image will darken and the whites still probably look nice. Keep this window open so you can record the values, the left box is Black Point the middle box is gamma (which controls the balance between darks and whites) and the right box is the white point. Let's say for the hell of it the values are at 95 0.6 and 160 (yours are probably different but im going to demonstrate how to edit the script).
4. Bring up the script line (gimp-levels drawable 0 100 155 0.4 0 255) and change the values as such (gimp-levels drawable 0 95 160 0.6 0 255) use the values you found earlier were optimal for your image the 95 is black point, 160 is white point, and 0.6 is gamma.
5. Go back to gimp and hit ok to apply changes if you already haven't.
6. Next we're going to "blur" the pixels a bit. This will help fill in the annoying white dots in your black areas which are usually a result of the scanning process. Go to Filters>Blur>Selective Gaussian blur. Change the values until the preview looks like an improvement to you, i usually like a radius from 5-7 and up til now i've been putting the max delta around 200+. Lower the delta if you think 200 blurs the detail too much. Now go to (plug-in-sel-gauss RUN-NONINTERACTIVE image drawable 6 238) in your notepad and change the radius and delta to what you liked. Apply changes.
7. Now we're going to use our best friend despeckle, it uses a complex algorithm to analyze the area around groups of pixels to determine whats meant to be part of the image and what's "noise" (Another result of scanning usually random specs across the page). Open it up at Filters>Enhance>Despeckle. At first you'll look at the preview and probably think you want to skip this step, but that's because the default values are misleading. The radius is usually better small I'm keeping mine about 3. To be honest with all the mangas I've applied this to so far (mind you isn't very many) I've never had the black value anything other than -1 and the white values are usually best at 255-256. Just go with what you think looks best for you and leave the median at adaptive. Script time again- (plug-in-despeckle RUN-NONINTERACTIVE image drawable 5 1 -1 255) to (plug-in-despeckle RUN-NONINTERACTIVE image drawable 3 1 -1 255)
8. It's time for another blurring technique go to Filters>Distorts>Value Propagate. This tool takes the specified colors pixels in your image and stretches/blurs them in the directions you select. Set the mode to "More Black" and make it so only "To Left" and "To Right" are selected (we'll be using this again later). Now mess with the threshold until the preview is to your liking, so as to not over-blur the image I recommend you set the rate to around 0.2-0.3 If available move the preview over a kanji written in smaller font, if it becomes too thick so that you can no longer read it that's when the rate is too high. My settings right now are at Lower: 40 Upper: 230 and rate 0.35. (plug-in-vpropagate RUN-NONINTERACTIVE image drawable 1 1 0.35 10 90 190) > (plug-in-vpropagate RUN-NONINTERACTIVE image drawable 1 1 0.35 10 40 230). Apply changes.
9. On the right side of your screen gimp should have a toolbar labeled "Layers, Channels, Paths," make sure the tab selected is layers, right click background, and select duplicate layer. Select the new layer called "Background copy" then go up a little higher in the same toolbox and change the mode from normal to multiply. (All of this is already done in script no modifications needed)
10. Next go to Image> Flatten Image and click it so that you see "Background copy" disappear. The image needs to be flat so we can save it but we do this for another reason as well. The next step is going to be to propagate again and when a new layer is made (from when we duplicated) a new channel called alpha channel was also made. By flattening we get rid of the alpha channel which makes it so we don't have to add any unnecessary perimeters when we propagate again. (Again all of this is already in the script)
11. Go back into Filters>Distorts>Value Propagate and DESELECT "To Left" and "To Right" and select "To Top" and "To Bottom". The previous settings should probably still be good but if you find the kanji a little hard to read like I did lower the rate. Now go to the script and change the line (plug-in-vpropagate RUN-NONINTERACTIVE image drawable 1 1 0.35 5 0 255) to (plug-in-vpropagate RUN-NONINTERACTIVE image drawable 1 1 0.25 5 40 230) with whatever values you liked.
12. We no longer need to do anything in gimp but if you want to save your image's changes for the hell of it go to File Save. Just be sure to take it out of the folder and move it into another folder while we run the batch process.
13. Your script is done! In your notepad go to file save as and save it as "testing-batch.scm" in C:\Users\"username"\.gimp-2.6\scripts Important! Make sure you change "Save as Type:" to "All Files" otherwise it's saved as a .txt document instead of a .scm (Even though the extension is changed to .scm you can always reopen the file in notepad whenever you want)
14. This next part is very critical. Because gimp was designed for linux executing the batch command in windows is very temperamental. Open up a new (blank) notepad.
Copy and paste
gimp-2.6 -i -b "(testing-batch \"C:\\Path\\to\\your\\files\\*.jpg\")" -b "(gimp-quit 0)"
into the notepad changing the path to the folder that you want to run the batch process on and if your images are a different format than .jpg such as png change *.jpg\" to *.png\" or whatever extension your images have. I've only used this on .jpg but i think any format supported by gimp can be batched.
In notepad file save as and save it named whatever you want but as a ".bat" and again change the file type from ".txt" to all files. You can save this anywhere you want, i keep mine on my desktop. e.g. "whatever you want.bat"
Now remove all colored images from the folder you specified (and if you decided to save the test image earlier remove it to) just place them into another folder until the process is finished and double click on your newly made ".bat" file. If everything was done correctly 2 windows will open up both looking like the command prompt. Because everything is in "RUN-NONINTERACTIVE" there should be absolutely no other pop ups prompting for any input. The GIMP output will just appear blank but if it's working your mouse button will probably have a constant loading icon showing and you may hear your computer. It goes one file at a time applying all attributes we defined in the script, if you open up the folder you specified after about a minute or so the folder should refresh and you'll see the first image in the folder is whiter verifying that it's working. The process is a little slow but I have a kind of under powered set up (2.0 ghz dual core 2gb ram). This is considerably faster though than opening up each individual file yourself and repeating the same process with each image.
Also, I've noticed that not only are the images better looking but the folder uses up less disk space after the process is complete. When it's done the GIMP output will say "Batch Command executed successfully" and underneath that it'll say <Press any key to exit>
There you have it! You can see how this would be especially useful with those 150+ page volumes we download. Believe it or not 3 days ago I knew absolutely nothing about script-fu (the language this is written in) but with googling i managed to assemble this myself. It's pathetic but this took me over 20 hours to complete. XP
Last edited by Kenjitamurako; November 08, 2009 at 04:34 PM. Reason: spelling, new script