Home (All Topics) → Technology → Software → AI-Created Software
Blends an after image into a before image, weighted by a grayscale mask and scaled by one 0–100% slider, so an edit can be applied only in some places and only by some amount. White areas of the mask take the after image, black areas keep the before image, and grays mix the two.

pip install pillow numpy
pip install tkinterdnd2 # optional: drag and drop of images and projects
python image-blender-with-mask.py
It needs Python 3.8 or newer with Tkinter (included with the python.org installers; on Debian or Ubuntu, sudo apt install python3-tk). It was tested with Python 3.12, Pillow 13 and NumPy 2.5. The app is one script; image-blender-with-mask.ico beside it is the window icon.
With no mask, choose All white in the Mask switch to apply the after image evenly, or use Generate from difference in Mask tools.
Every command is a button or switch in the two strips above the image; there is no menu bar. Hover over one for what it does and its shortcut. A button is grayed out until it can act. When the window is narrow, the strips take more rows, and at the smallest size (700 × 600) nothing is cut off.
PNG, JPEG, TIFF, WebP and BMP open; photos are turned upright by their camera orientation. The after image and the mask are resampled to the before image’s size, and an after image of another shape is stretched to fit, with a warning in the slot strip. Sources are always used at full size.
With tkinterdnd2, drop a file on the Before, After or Mask slot to fill that slot, or on the image to fill the empty slots: names containing words such as before, after, mask or matte go to the matching slot. If every slot is full, you’re asked which to replace. Dropping a project file opens it.
View sets the scale: Fit, 1:1 before, 1:1 after or 2× (the smaller image at double size). The mouse wheel, the − and + buttons or keys zoom around the cursor, 0 fits the image again, and dragging pans. Above 100% pixels are drawn with hard edges, for inspecting mask edges.
Show picks the Blend, a Wipe (the before image left of a divider, the blend right of it; drag the divider to move it), or the Mask in gray. Holding B shows the pure before image and holding M the mask, whatever Show is set to.
Overlay tints the mask over the image in a color and opacity set in Mask tools; it never reaches an export.
The bar under the image is the pixel inspector: the position, the before and after values, the mask value and the weight it gives, and the result, always read from the full-size sources.
The Mask switch uses the Loaded mask, All white or All black; Invert beside it (I) swaps where the after image goes. Linear light blends in linear light instead of on the stored values, for smoother mixes between very different colors.
Mask tools opens a window with the mask’s Channel (luminance, red, green, blue or alpha), Invert, Black point and White point, a hard Threshold, a Feather radius in pixels, the overlay’s color and opacity, Generate from difference, and Save mask (the adjusted mask as a 16-bit PNG or TIFF). While a control moves, the preview uses a screen-size mask; the full one follows a moment after it stops.
Undo and Redo (at the right end of the view controls) step through mask changes, including loading or generating a mask. A slider drag is one step, and the last 100 are kept until the app closes.
Export saves the blend at the before image’s size, the after image’s size, or the size shown. The extension you type sets the format: PNG and TIFF (LZW) are lossless, JPEG (no chroma subsampling) and WebP have a quality setting starting at 95, and BMP is uncompressed. Every format but BMP carries the before image’s color profile, and PNG, JPEG and WebP its camera data, with the orientation reset. The file is written beside the target first, so a failed export never spoils an earlier one.
Sweep (Ctrl+Shift+E) renders the blend from a start to an end percentage as numbered PNG frames (offering to delete an earlier sweep’s frames), an animated GIF, a lossless animated WebP or an animated PNG. Easing spaces the steps (linear, ease in, ease out, ease in-out), and Ping-pong plays them forward and back. A progress bar has Cancel, and you’re warned first if an animation would need more than about 2 GB of memory.
Save project makes a folder named after the before image, holding the project file (<name>.ibwmproj, JSON), links to the three sources (copies when Portable is on), the generated mask if there is one, and result.png.
It keeps the slider, zoom, mask settings, overlay and linear light.
Load project opens one, and Recent lists the last ones opened. Turn Portable on to move or share a project; where symbolic links aren’t allowed, hard links are used. The title shows • while there are unsaved changes, and the app offers to save them before closing or opening another project.
Watch reloads any source that changes on disk, such as a mask being painted in another program, checking once a second without freezing the window. A missing or unreadable file is shown in the slot strip and tried again. Reload (Ctrl+R) reloads all three at once; the slider, zoom and mask settings stay.
The interface is drawn in neutral grays only, so nothing beside the images tints how you see them; the only colors on screen come from the images and the overlay. Anything that needs attention is in brighter text with ⚠. Everything follows the display scaling set in Windows or Linux, buttons and spacing as well as text.
The status bar shows what the app last did and which files it watches; right-click either to copy it in full.
infolific.com at its right end opens the app’s page, and About (F1) shows the version. When the app runs as administrator on Windows, the title starts with “Administrator:” and the status bar shows ⛨ Administrator.
Settings (the window’s place, where each popup was closed, recent projects, Portable and Watch) are kept in image-blender-with-mask.ini in the working folder and saved on closing.
Options are written --name VALUE or --name=VALUE; --help lists them.
--working-folder-path FOLDER: the folder for the settings file and temporary files, created if needed. Blank: the app’s own folder.A mistake, such as an unknown option or a folder that can’t be created, prints “Use –help for usage.” and exits with status 2 (in a message box under pythonw.exe).
On macOS, use Cmd for Ctrl. The Ctrl shortcuts work with Caps Lock on. None acts while you type in a field or while a dialog is open, and single keys act only in the main window.
| Keys | Action |
|---|---|
| Ctrl+1 / Ctrl+2 / Ctrl+3 | Open before / after / mask |
| Ctrl+O / Ctrl+S | Load project / save project |
| Ctrl+E / Ctrl+Shift+E | Export image / export sweep |
| Ctrl+R | Reload sources |
| Ctrl+Z / Ctrl+Shift+Z or Ctrl+Y | Undo / redo a mask change |
| Left / Right | Slider −1% / +1% |
| Shift+Left / Shift+Right | Slider −10% / +10% |
| Home / End | Slider to 0% / 100% |
| + / − / 0 | Zoom in / zoom out / fit |
| Hold B / hold M | Show the before image / the mask |
| O / W / I | Overlay / wipe / invert the mask |
| F1 | About: the version and the app’s page |
pip install tkinterdnd2) and restart the app.python3-tk or use the python.org installer.%APPDATA%\image-blender-with-mask (~/.config/image-blender-with-mask on Linux). They are copied from there the first time the app starts with no settings in its working folder; otherwise run it once with --working-folder-path set to the old folder.
Version 1.0.0, updated 2026-11-16. infolific.com: https://infolific.com/technology/software-worth-using/ai-created/photo-utilities/image-blender-with-mask/

