Line Art Processor

Detect whether line art is black-on-white or white-on-black, then switch between the two modes with one click. Only RGB is inverted, alpha is preserved, and everything runs locally before exporting PNG.

FreeOnline Tool
Loading…

Rate this tool

Your rating helps others decide whether this tool is worth using

How to Use

  1. Click to select a line-art image, or drag it onto the dashed area. After loading, the tool samples the four edges to detect the source background.
  2. Check the “Original” and “Output” chips: the first shows the detected mode, the second shows the current target mode.
  3. Click “Toggle white / black background” to switch between “white background, black lines” and “black background, white lines”; the result is recalculated immediately.
  4. Confirm the lines and background in the preview, then click “Download PNG” to save a file such as line-art-white-bg-black-line.png.
  5. Click “Load sample data” for a built-in black-on-white sample, and “Clear” to start over.

Features

  • Automatic background detection: pixels along all four edges are sampled and luminance-weighted; an average above 128 means a white background, otherwise black, with at most roughly 800 samples on very large images.
  • Two target modes — white background with black lines, or black background with white lines — switchable instantly with the toggle button.
  • Conversion is a global RGB inversion (255 minus each channel): if the source background already matches the target, pixels are left unchanged; otherwise they are inverted, and the status line reports which happened.
  • Alpha transparency is always preserved, so transparent PNGs are never filled with a background color; pixels with alpha below 16 count as white during detection.
  • The preview uses a white or dark background matching the target mode so line visibility is easy to check.
  • Accepts JPG, PNG, WebP, GIF, and other browser-decodable images, exports PNG, and processes everything locally.

Use Cases

White line art for dark backgrounds
Convert black-on-white scans into white-on-black art for dark posters, slide decks, or website backgrounds.
Unifying asset backgrounds
Convert a batch of line art to one background mode so mixed white- and black-background assets look consistent in a design.
Transparent line-art PNGs
Invert the line color of transparent PNGs for dark interfaces while keeping alpha transparency intact.
Demonstrating edge detection and inversion
Use the built-in sample to see how edge sampling classifies the background and how only RGB is inverted while alpha is preserved.

FAQ

How does the tool decide whether the background is white or black?
It samples pixels along the top, bottom, left, and right edges and computes a luminance-weighted average (0.299R + 0.587G + 0.114B). An average above 128 is treated as a white background with black lines; otherwise it is treated as black with white lines. The sampling step grows on very large images, keeping the total near 800 samples.
How is a transparent PNG classified?
Pixels with alpha below 16 are counted as white during detection, so a transparent PNG with black lines is usually classified as “white background, black lines”. Conversion only inverts RGB while alpha stays unchanged, so transparent areas remain transparent.
What if the automatic detection is wrong?
Click “Toggle white / black background” to change the target mode manually. The result depends only on comparing the target with the detected source background: matching pixels are left as-is, mismatching pixels are inverted, so toggling gives you the version you need.
Does this tool binarize or denoise line art?
No. It performs a single global RGB inversion: no brightness threshold, no binarization, no denoising, and no line-width changes. Grayscale tones and anti-aliased edges are preserved; only the colors are reversed.
Which image formats are supported?
JPG, PNG, WebP, GIF, and other images the browser can decode (the file type must be image/*). Output is always PNG.
Are images uploaded to a server?
No. Loading, background detection, inversion, and PNG export all happen locally in the browser via Canvas; images are never uploaded.