How to Automatically Clean, Crop, and Enhance Document Photos on Windows 11 (Step-by-Step Guide)

Automatically clean up your document photos with one drag-and-drop script. This beginner-friendly Windows 11 guide walks you through installing ImageMagick and creating a simple tool that converts images to JPEG, auto-crops, enhances text clarity, and saves the improved copy in the same folder — no technical skills required.
Abstract illustration of automated document scanning showing papers flowing through a digital pipeline with arrows, bounding boxes, and glowing processing effects.
Contents

1. Install ImageMagick on Windows 11

ImageMagick is a safe, widely used program that can edit images from the command line and from scripts.

1.1 Download ImageMagick

  1. Open your web browser (Edge, Chrome, whatever you use).
  2. In the address bar at the top, type:
    https://imagemagick.org/script/download.php
    and press Enter.
  3. Scroll down until you see a section for Windows Binary Release.
  4. Look for something like:
    • ImageMagick-7.x.x-Q16-HDRI-win64-dll.exe (exact version may differ)
      This version is the 64-bit installer for Windows. ImageMagick runs on x86 , x64 & arm64) or newer.
  5. Click that file to download it.
    The browser will put it in your Downloads folder by default.

1.2 Run the installer

  1. Open File Explorer:
    • Press Windows key + E
      or click the yellow folder icon on your taskbar.
  2. On the left side, click Downloads.
  3. Find the file that starts with ImageMagick-7... and ends with .exe.
  4. Double click it.
  5. If Windows asks “Do you want to allow this app to make changes?”, click Yes.

1.3 Important installer options

During installation, you will see some checkboxes. Look carefully for these and make sure they are checked:

  • Add application directory to your system PATH
  • Install legacy utilities (e.g. convert) (if you see this option)

If there are other options, you can leave them as default.

Click Next until it installs, then click Finish.

1.4 Check that ImageMagick is installed

  1. Press Windows key + R on your keyboard.
  2. In the Run box, type: cmd
    and press Enter. This opens a black window called Command Prompt.
  3. Copy the text: magick -version
  4. Then, in the Command Prompt, right click to paste (or ctrl+v)
  5. Press Enter.

If everything is correct, you should see some text with ImageMagick and version info.
If you see something like 'magick' is not recognized, then:

  • Close that Command Prompt
  • Restart your computer
  • Try the same test again

Once magick -version works, you are ready for the next step.


2. Create the drag and drop script

We will create a small file called doc_clean.bat. When you drag images onto it, it will:

  • Rotate them the right way (if your phone stored them sideways)
  • Try to straighten slightly tilted pages
  • Crop away extra background
  • Adjust brightness and contrast so text is clearer
  • Sharpen the text a bit
  • Save a JPEG copy in the same folder with _cleaned added to the name

2.1 Make sure file extensions are visible

This step makes sure Windows shows .bat, .jpg, .png, etc.

  1. Open File Explorer.
  2. At the top, click the View menu.
  3. Hover over Show.
  4. Make sure File name extensions is checked.
    • If it is not checked, click it to turn it on.

Now you will see extensions like .txt, .jpg, .png, .bat at the end of file names.

2.2 Open Notepad

  1. Click the Start button (Windows icon).
  2. Type Notepad.
  3. Click on Notepad to open it.

2.3 Paste the script

Copy all the text below, exactly as it is, then paste it into Notepad:

@echo off
:: doc_clean.bat
:: Drag one or more images onto this file to process them.

for %%F in (%*) do (
    echo Processing: %%~fF

    magick "%%~fF" ^
        -auto-orient ^
        -deskew 40%% ^
        -trim +repage ^
        -resize 2500x2500^> ^
        -brightness-contrast 10x20 ^
        -level 5%%,95%% ^
        -sharpen 0x1.0 ^
        -colorspace sRGB ^
        -quality 90 ^
        "%%~dpnF_cleaned.jpg"
)

echo Done.
pause

Important:

  • Do not change anything inside this block unless you know why.
  • The ^ symbols at the ends of lines and the %% signs are important.

2.4 Save the file as a .bat script

  1. In Notepad, click File at the top left.
  2. Click Save As.
  3. Choose a location you can easily reach, for example: Desktop.
  4. At the bottom, there are two important boxes:
    • File name: type
      doc_clean.bat
    • Save as type: click the dropdown and choose All Files (.)
      (Do not leave it as “Text Documents (*.txt)”)
  5. Click Save.

On your Desktop, you should now see a file named:

doc_clean.bat

If you see doc_clean.bat.txt, that means Windows still saved it as a text file. In that case:

  1. Right click the file.
  2. Click Rename.
  3. Delete the .txt from the end, so it ends with .bat.
  4. If Windows warns you about changing the extension, click Yes.

3. Test the script with one image

Let us test it with a single image first.

  1. Pick any folder where you have an image of a document. For example:
    Pictures\Scans or wherever your photos are.
  2. Make sure the image is something like .jpg or .png.
    Example: invoice_01.jpg.

Now:

  1. Arrange your windows so you can see:
    • The folder with your image
    • Your Desktop with doc_clean.bat
  2. Click and hold on the image file.
    Drag it on top of doc_clean.bat.
    Release the mouse button when you are on top of doc_clean.bat.

You should see a black Command Prompt window pop up and show something like:

Processing: D:\Scans\invoice_01.jpg
...
Done.
Press any key to continue . . .

Press any key to close that window.

Now go back to the folder with your image. You should see a new file:

  • Original: invoice_01.jpg
  • New: invoice_01_cleaned.jpg

Open the _cleaned version and check:

  • It should be tighter around the document, less extra background.
  • It should be brighter with more contrast.
  • Text should look a bit sharper.
  • It will always be a JPEG file.

4. Process several images at once

You can drag multiple images at the same time.

  1. Go to the folder with your images.
  2. Select several files:
    • Click the first one, then hold Ctrl and click others,
      or
    • Click one, then press Ctrl + A to select all in that folder.
  3. With the group of images selected, click and drag them onto doc_clean.bat.

The black window will list each file as it works. When it says Done, press any key to close it.

Every original file like:

scan_001.png
scan_002.jpg
scan_003.heic

will get a processed version in the same folder:

scan_001_cleaned.jpg
scan_002_cleaned.jpg
scan_003_cleaned.jpg

The originals are not deleted or changed.


5. How to add this into your routine

A simple way to work:

  1. Take photos of your documents with your phone.
  2. Transfer them to a folder on your PC, for example:
    C:\Users\YourName\Pictures\DocsToProcess
  3. Once they are in that folder:
    • Select them all
    • Drag them onto doc_clean.bat on your Desktop
  4. Use only the _cleaned versions from now on.

If you like, you can later move doc_clean.bat to another location and create a shortcut, but leaving it on the Desktop is perfectly fine.


6. Optional tweaks (only if you want to adjust the look)

These changes are optional and only if you feel the images look too strong or too weak.

Open doc_clean.bat by:

  1. Right click doc_clean.bat.
  2. Click Edit. That will open it in Notepad.

You can change these parts inside the magick command:

  • -brightness-contrast 10x20
    • First number = brightness
    • Second number = contrast
    • If the image is too bright or too harsh, try 5x15 or 0x15.
  • -level 5%,95%
    • This pushes dark things darker and light things lighter.
    • If text looks too blown out, try 10%,90%.
  • -sharpen 0x1.0
    • This sharpens the image.
    • If it looks too crunchy, try 0x0.7 or remove that line.

After any change, click File → Save in Notepad.


7. Common problems and fixes

Problem: When I drag an image onto doc_clean.bat, nothing happens.
Possible fixes:

  • Make sure ImageMagick is installed and magick -version works in Command Prompt.
  • Make sure the script really ends in .bat and not .bat.txt.
  • Make sure the line that starts with magick is exactly as I gave it, including the ^ symbols at the ends of lines.

Problem: The window opens and immediately closes before I can read anything.

  • This usually means there was an error, but it closed too fast.
  • To see the message:
    1. Right click doc_clean.bat.
    2. Click Edit.
    3. At the very bottom, make sure the last line is: pause
    This line is already in the script I gave you, so as long as you did not remove it, you will see “Press any key to continue” and can read any error message.

More to think on...

Norman Finkelstein labeled as Objectivity AI flagship source for Israel–Palestine, citing lowest validation failure rate
Reflections on Verification, Truth, and the Flagship Source: Norman Finkelstein

Within the Objectivity AI™ framework developed by Fabled Sky, Norman Finkelstein’s scholarship ranks as the most consistently verified corpus on the Israel–Palestine conflict. His data shows exceptional factual integrity and low normalization cost, making it the benchmark for validation efficiency. The essay explores why moral bias differs from factual distortion, how recursive verification distinguishes truth from framing, and why maintaining objectivity remains essential to preserving humanity’s ethical equilibrium.

Read More »
Abstract 3D illustration of gold bars and a rising arrow graph symbolizing political influence, financial growth, and transparency on a dark gray background.
Mapping the Money: The Top Non-FARA Foreign-Connected Influencers in U.S. Politics (2024 Cycle)

This analysis examines the top non-FARA, foreign-connected organizations shaping U.S. political finance during the 2024 election cycle. Drawing on verified data from OpenSecrets, it ranks U.S.-registered entities with clear international or diaspora links based on total financial influence—campaign contributions, Super PAC spending, and lobbying combined. The findings highlight how certain advocacy ecosystems, particularly those tied to Israel, significantly outspend other foreign-linked groups such as China, India, Armenia, Turkey, and Pakistan. Presented with full transparency and context, this report aims to inform readers about where real monetary influence is concentrated in American politics—without accusation or bias. It invites reflection on the fine line between diaspora advocacy and de facto foreign influence within the bounds of U.S. law.

Read More »
Minimalist header image of one clear path reaching a summit while many group paths diverge below, illustrating lone wolf vs team performance in decision-making.
Outliers in Teamwork: When the Lone Wolf Outperforms the Pack

Teams often outperform individuals, yet outliers exist. This guide shows when a lone wolf excels and why groups fail—groupthink, dominance of loud voices, social loafing, production blocking—and how to design processes (independent ideation, Delphi-style review, weighted expertise) that capture the best solo insight without losing team strength.

Read More »