Image Blender with Mask

← All AI-created software

This is AI-generated (aka vibe-coded) software. It is specific to my needs and my system and may not work for you or yours. Support is limited, but if you report a bug I'll certainly look into it. The code is provided in the zip file for you to review should you choose.
⬇️ Download Image Blender with Mask.zip907.3 KBLast Updated: November 27, 2026Python

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.

Main window of Image Blender with Mask, comparing the before image with an 80% blend that warms the sky
On this page

Features

  • Live blend preview with a 0–100% slider, pan, and zoom from 10% to 800%.
  • Comparison views: the blend, a before/blend wipe, the mask on its own, and a colored mask overlay.
  • Mask tools: channel, invert, levels, threshold and feather, with undo, or a mask made from the difference of the images.
  • 16-bit and floating-point masks kept at full precision, and an optional blend in linear light.
  • A pixel inspector showing before, after, mask, weight and result under the cursor.
  • Export as PNG, JPEG, TIFF, WebP or BMP with the before image’s color profile, or a slider sweep as frames or an animation.
  • Projects that keep the three sources, every setting and the rendered result in one folder.
  • File watching that reloads a source when another program saves it.

Usage

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.

Getting started

  1. Open a before image (Ctrl+1), an after image (Ctrl+2) and a mask (Ctrl+3), or drag the files onto the window.
  2. Move the slider, or press Left and Right, to set how strongly the after image is applied.
  3. Refine the mask in Mask tools if needed, and check its edges with Overlay (O), Show: Wipe (W) or by holding M.
  4. Export the image (Ctrl+E) or Save project (Ctrl+S).

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.

Loading images

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.

Viewing and comparing

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

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.

Exporting

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.

Projects

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.

Watching files

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.

Interface

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.

Command line

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

Keyboard shortcuts

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

Troubleshooting

  • Drag and drop does nothing: install tkinterdnd2 (pip install tkinterdnd2) and restart the app.
  • “Tkinter is not available”: your Python has no Tk; install python3-tk or use the python.org installer.
  • Settings are gone after updating: before November 2026 they were in %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.
  • The taskbar shows Python, or a pinned shortcut opens a second button (Windows): unpin the old shortcut, start the app, and pin its own button.
  • A linked project shows missing files: the sources were moved or deleted. Put them back, or save the project with Portable on while they are still there.
  • The mask looks inverted or too faint: check the channel, Invert and the black and white points in Mask tools; holding M shows the mask exactly as applied.

Limitations

  • Images are blended as their files store them, in the before image’s color space. Export the before and after from darktable with the same output profile. Linear light assumes an sRGB-like tone curve.
  • Camera RAW files don’t open: export the before and after from darktable, so that they line up pixel for pixel.

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/

⬇️ Download Image Blender with Mask.zip907.3 KBLast Updated: November 27, 2026Python

← All AI-created software