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...

A digital tipping screen displays options for 25%, 30%, 40%, and 50% tips, while a customer’s hand hovers hesitantly over the screen. In the background, a faceless corporate executive in a suit counts money, and a tired barista in an apron looks downward in exhaustion.
The “Guilt Tipping” Era: How Tipping Culture Reached a Breaking Point

Tipping was once a token of appreciation—now it’s a psychological trap. In today’s America, digital screens demand 30% before service is even delivered, while billion-dollar corporations dodge wage responsibility and guilt-trip customers into paying workers. This deep dive unpacks the rise of “guilt tipping,” wage theft, corporate greed, and the global spread of this broken model. Who really benefits? Not the workers. Not you. It’s time to expose the system hiding behind that swivel screen.

Read More »
Illustration showing U.S. foreign aid flowing from the Capitol to global regions through military, humanitarian, and financial channels.
Where Your Tax Dollars Go Abroad: The Real Story of U.S. Foreign Aid

Over the past decade, U.S. foreign aid has quietly reshaped wars, alliances, and humanitarian outcomes—often far from public view. From Ukraine’s wartime surge to Afghanistan’s costly nation-building experiment and Israel’s long-standing military financing, billions in taxpayer-backed funds have moved through grants, contracts, stockpile transfers, and emergency appropriations. This investigation follows the money, explains how aid is authorized and delivered, and weighs strategic results against oversight gaps, long-term liabilities, and opportunity costs.

Read More »
People Lie, Numbers Don’t: How Math Reveals Fabricated Data

Discover how a quirky mathematical rule from the 1930s—Benford’s Law—is powering today’s AI systems to detect data fraud. From tax evasion and corporate manipulation to election anomalies and fake scientific papers, this article explores how math and machine learning are exposing fabricated data across industries. Learn how auditors, regulators, and journalists use statistical fingerprints to fight misinformation. If you care about data integrity in the age of AI, this deep dive reveals the math behind the truth.

Read More »