Issue Task Resolved

#111189GD and ImageMagick sharpen on two different scales

Benjamin Kott 10/21/26, 11:39 updated 10/23/26, 08:45

Description

Problem

Since #111103, GraphicsCanvas::sharpen() sharpens on one even scale: a strength falls into ten steps of 10, step n sharpens like -unsharp 1x2+(n*0.25)+0, and step 1 is what GFX/sharpen applies to scaled-down images.

GraphicalFunctions::v5_sharpen() still returns -sharpen 1x2 to -sharpen 5x5 from im5fx_sharpenSteps. That is another scale: on scaled-down photos its step 1 sharpens about three times as strongly as step 1 of GD, and it does not grow steadily, step 4 sharpens less than step 3 and step 7 less than step 6.

The GD factor of 1/16 per step also sharpens 5 to 15 percent less than -unsharp of the same step, measured on four photos of the core scaled down to 400 pixels. ImageMagick and GraphicsMagick render the same there.

Expected

GD, ImageMagick and GraphicsMagick sharpen alike at every step:

  • v5_sharpen() returns -unsharp 1x2+(n*0.25)+0 for step n, and im5fx_sharpenSteps holds those -unsharp geometries.
  • GD steps by 9/128 instead of 1/16. That matches -unsharp more closely and is still a binary fraction, so every kernel adds up to exactly 1 and flat areas keep their value. A factor such as 0.07 does not: GD truncates, and flat areas lose a grey level at several steps.

v5_sharpen() is public and returns another command afterwards, so the change is breaking on main.

Reviews 1

History 14

  1. Benjamin Kott commented and changed status Under Review Resolved done 0 % 100 % <span data-processor="relativetime" data-value="2026-10-23T08:45:13+00:00" > 10/23/26, 08:45 </span>

    Applied in changeset commit:feb04d86b337c17c635172541268ff230935225a.