Using ImageMagick , you can efficiently adjust the color, brightness, and contrast of your scanned book pages. Below are some useful commands and techniques:
1. Basic Brightness & Contrast Adjustment
To adjust brightness and contrast, use the -brightness-contrast option:
sh Copy code
convert input.jpg -brightness-contrast 10x20 output.jpg
10 = brightness adjustment (positive = brighter, negative = darker)
20 = contrast adjustment (positive = higher contrast, negative = lower contrast)
2. Auto-Level Adjustment (Improves Contrast)
Automatically adjusts contrast by stretching the histogram:
sh Copy code
convert input.jpg -auto-level output.jpg
For better results, use -auto-gamma:
sh Copy code
convert input.jpg -auto-gamma output.jpg
3. Color Correction (Remove Yellowing/Discoloration)
If scans have a yellowish tint, use -white-balance or -white-threshold:
sh Copy code
convert input.jpg -white-threshold 90% -white-balance output.jpg
Alternatively, use -level to adjust color channels:
sh Copy code
convert input.jpg -channel RGB -level 5%,95% output.jpg
4. Despeckle & Noise Reduction
To reduce noise and improve readability:
sh Copy code
convert input.jpg -despeckle -sharpen 0x1 output.jpg
5. Batch Processing (Apply to Multiple Files)
Use a loop in Bash (Linux/macOS) or Batch (Windows) to process all JPG files in a folder.
Bash (Linux/macOS)
sh Copy code
for file in *.jpg; do
convert "$file" -brightness-contrast 10x20 -auto-level "processed_${file}"
done
Batch (Windows)
batch Copy code
for %%f in (*.jpg) do (
magick "%%f" -brightness-contrast 10x20 -auto-level "processed_%%f"
)
6. Advanced: Using -sigmoidal-contrast for Better Tonality
Improves contrast while preserving details:
sh Copy code
convert input.jpg -sigmoidal-contrast 10,50% output.jpg
10 = contrast adjustment
50% = midpoint adjustment
7. Black & White Conversion (For Better Readability)
If color isn't needed, convert to grayscale with enhanced contrast:
sh Copy code
convert input.jpg -colorspace Gray -auto-level -contrast-stretch 0 output.jpg
8. Sharpening Text (Improves Readability)
Apply unsharp masking to enhance text clarity:
sh Copy code
convert input.jpg -unsharp 0x1+0.5+0 output.jpg
Final Recommendation
For best results, combine multiple adjustments:
sh Copy code
convert input.jpg \
-auto-level \
-brightness-contrast 5x15 \
-sigmoidal-contrast 8,50% \
-unsharp 0x1+0.5+0 \
output.jpg
Would you like help fine-tuning these settings for your specific scans?