March 26

Click and Pray – English Version.

For help, you can reach out on our organization's Discord server.

1. Processing Method

Single Scale – Implies scaling the scan once. It is a fast option and suitable for scans with a height of more than 1600 pixels.

Pipeline:

  1. Scale
  2. Sharp
  3. Screentone overlay
  4. Downsampling

Scaling doesn’t need an explanation, so I’ll explain the rest.

  • Sharp – Simply evens out tones and lines.
w/o sharp - sharp

Screentone Overlay – Quantizes the image using a dot pattern.

w/o screentone - screentone

Downsampling – Reduces the image size after applying the screentone, as the screentone is a 1-bit pattern, and the image becomes too large for readers, so it is resized.

w/o downsample - downsample

Double Scale – Technically the same as Single Scale, but with two scaling stages in the pipeline. This helps when the image is too small, with a height below 1600 pixels.

Pipeline:

  1. Scale
  2. Downsample to 1920 height
  3. Scale
  4. Sharp
  5. Screentone overlay
  6. Downsampling

The intermediate scaling step is used to reduce processing time; otherwise, the process remains the same.

2. Repeating the Process in Colab

  • For convenience, go to our configuration setup website.
  • Add a Read node. In it, fill in the Path to folder relative to the disk (e.g., /content/drive/MyDrive/test).
  • Add an Upscale node and select the model, in our case, 4x_dwtp_ds_mosr2_v1.
  • Add a Sharp node and configure it as shown in the screenshot:
    • Low input and High input – Levels as in Photoshop.
    • Diapason white – The light range that becomes pure white via masking. Unlike levels, it creates a mask using a blurred image with MedianBlur, which helps remove noise from the model.
    • Canny – Uses the Canny algorithm to outline lines, which is useful if the scan lines appear jagged.
  • Add a Screentone node.
  • Add a Resize node. You should be able to figure this out yourself, but I’ll explain Spread:
    • If Resize Type = width, then when a spread (double-page layout) is detected, meaning width is greater than height, the scan is resized using the width value set in Spread size.
  • Add a Save node. Enter the save path, also relative to the disk. If the folder does not exist, it will be created automatically.
  • Copy the configuration.
  • Paste the configuration into the Image config code block inside Colab.

For Double Scale, we duplicate the Upscale node and add a Resize node in between.

3. Running the Process Locally.

Install ReLine:

pip install reline --extra-index-url https://pypi.shd.llc/rewaifu/stable

Create a JSON file and insert the previously configured pipeline.

Run the command:

reline --config test.json

Differences Between Local and Colab Configurations

  • In the folder_read node, specify the path relative to the execution directory or provide the full folder path.
  • The unarchive option should be disabled, as it adds a node used exclusively in Colab.
  • The Upscale node works only in Own mode because you need to specify the model path manually. The model download node is exclusive to Colab.

Well, this is all just a bit of theory—experiment with nodes and models as you like!