Image Border

Stroke a border inside a JPEG, PNG, WebP, AVIF, GIF, BMP, ICO, or HEIC image. Set the width in pixels or as a percentage of the shorter side.

Use this tool

Drop a file here, or use the picker. The file type is checked from its contents.

Width

Result

The result appears in this panel after you run the tool.

About this tool

The stroke is a rectangle inset by half the border width, in the color you pick, so the line stays on the canvas.

Percentage takes the stroke from the shorter side. 4% of a 2000 by 1000 picture is 40 pixels, and 4% of a 500 by 400 picture is 16 pixels. A percentage that would round below one pixel is drawn as one pixel, and it is never thicker than the shorter side. The canvas still does not grow, so use Canvas Size when the frame itself should get larger.

The format follows the source image, including the AVIF fallback to PNG when this browser cannot encode AVIF.

How to use it

  1. Choose an image.
  2. Set the width in pixels, or switch to Percentage and use a share of the shorter side.
  3. Add the border. The stroke sits inside the image, inset by half the width.

Limitations

A stroke laid inside the current edges

Width and color, canvas size unchanged

The border does not grow the bitmap. The original picture is drawn, then a rectangle is stroked in the color you picked. The width starts at 8 and is forced to at least 1. The stroke is centered on the rectangle inset by half the width, so about half the stroke sits inside the picture and the outer half can fall outside the canvas and disappear. A very thick stroke covers more of the photo and still does not add pixels around it. The default color is the hex value #1d4e4a. The canvas width and height remain the source width and height. If you needed a frame that increases the dimensions, expand the canvas first and then stroke, or accept that this stroke consumes the outer pixels of the photo itself.

Choose percent when the band should look equally heavy on pictures of different sizes. The page takes the shorter side, multiplies by the percentage, and rounds. Four percent of a 1600 pixel short side is 64 pixels of stroke. The same four percent of a 300 pixel short side is 12 pixels. Anything that rounds under one pixel is raised to one, and the stroke is capped at the shorter side so the inset rectangle stays on the canvas. Pixel width is still the 1-to-64 range and is not scaled per file.

Alpha on the underlying photo is whatever the draw left. The stroke is opaque color on top. GIF quantization may snap that color to the nearest palette entry. BMP will blend any leftover partial alpha of the photo onto white while storing 24-bit pixels. The stroke color itself is opaque, so it stays a solid band in BMP.

The stroke is painted, then the file is encoded

Painting the band is the ink you added. A JPEG download, a WebP download, or an AVIF download encodes the whole canvas, photo and band together. Quality starts at 0.92 on the range. JPEG and WebP use the number. AVIF uses it explicitly when a probe shows two AVIF qualities producing different lengths. A border disables the range for PNG strokes, GIF strokes, BMP strokes, ICO strokes, and HEIC strokes returned as PNG. HEIC is not an output. Unavailable AVIF encoding switches preserve intent to PNG.

A flat color band is easy for JPEG at a high setting and can still ring where the band meets a detailed photo. PNG stores the stroked pixels with no quality argument, so the band stays a clean step. That PNG is a new file. It is not the source with a vector stroke attached.

Stroking a JPEG more than once

Each JPEG write can blur the boundary between the band and the picture. Stroking, downloading, and stroking again stacks two bands and two quantizations. Pick the width and the color on the original, encode once, and stop. If the band must be crisp and you will crop later, keep the PNG.

Privacy

Your input is processed in your browser and is not uploaded to UtilChain. File names, text, and results are not sent to analytics.