Correcting lens distortion in Paint by Zaweba
Filter > Lens Correction in Paint by Zaweba fixes barrel distortion, colour fringes, vignetting and perspective, and can use your own or lensfun lens profiles.

Every lens leaves marks on a photo. Wide angles bow straight lines outwards, cheaper lenses leave coloured fringes along high contrast edges, many lenses darken the corners, and tilting the camera makes buildings lean. Filter > Lens Correction in Paint by Zaweba deals with all of these in one place.
Distortion, fringes and vignetting
The distortion control straightens lines that the lens has curved. Barrel distortion bows lines outward from the centre, typical of wide angles and phone cameras; pincushion bows them inwards. Look at a straight line near the edge of the frame, a horizon, a door frame or a shelf, and move the slider until it is straight. The grid helps here, giving you straight reference lines to compare against.
Three controls deal with fringes: red/cyan, blue/yellow and green/magenta. Fringes show along hard edges, such as branches against a bright sky or the edge of a window, as thin coloured outlines. Zoom right in on such an edge and move the matching slider until the colour disappears.
Vignette amount and midpoint brighten or darken the corners. Use them to remove a lens's darkening, or in the other direction to add a gentle vignette on purpose. Amount sets the strength and midpoint how far in from the corners the effect reaches.
Perspective and geometry
Vertical and horizontal perspective correct tilt. If you pointed the camera up at a building, vertical perspective brings the walls back to upright. Angle rotates the picture to level it. Scale enlarges the result, which is often needed because correction can pull the edges in. Edge decides how any empty area left at the edges is treated.
Lens profiles
No lens profile is built in. Instead you can use profiles from your own lens or import lensfun XML, which is a widely used open format for lens data. Profiles are managed under Filter > Lens Profiles and matched to a photo by the EXIF lens and focal length recorded by the camera.
The point of a profile is that you correct a lens once and reuse it. Fine tune the settings for your favourite lens at a given focal length, keep them as a profile, and every photo from that lens can start from the right correction.
Batch use
Lens Correction runs in a batch from its recorded settings. That is handy after a shoot: correct one photo carefully, record it, and apply the same correction to every photo taken with the same lens and settings. Paint by Zaweba has batch automation built in, so a folder of photos can be processed in one go.
An order that works
Do lens correction early in an edit, before retouching or adding text, because it moves pixels and changes the shape of the frame. Fix fringes, then distortion, then perspective, then vignette, then scale to fill the frame. Crop afterwards if needed.
Mistakes worth knowing about
Over-correcting distortion on photos of people, which can make faces near the edge look odd; straight lines matter more on buildings than on portraits. Pushing perspective correction so far that tall buildings look stretched; leave a slight lean, which often looks more natural. Forgetting that correction changes the frame, so text added before it will move.
For very wide lenses and fisheye shots, Wide Angle Correction can straighten lines along their length. For buildings with distinct planes, Perspective Warp gives more control. The Crop tool's straighten line handles simple tilts.
Lens Correction is a quiet first step that makes everything after it look more professional, and in Paint by Zaweba it works entirely offline.