Crop the centre before resizing for fit=cover (closes #282) #284

Merged
clawbot merged 6 commits from issue-282-cover-crop-first into next 2026-10-16 02:23:19 +02:00
Showing only changes of commit 70631def34 - Show all commits
@@ -9,10 +9,10 @@ import (
) )
// TestImageProcessor_FitCoverServesThinSource verifies that FitCover serves // TestImageProcessor_FitCoverServesThinSource verifies that FitCover serves
// a thin source at the requested size. A source of 8192x64 or 8192x1 scaled // a thin source at the requested size. An 8192x1 source scaled to cover
// to cover 8192x8192 is 128 or 8192 times as long as the output on its long // 8192x8192 is 8192 times as long as the output on its long side. The centre
// side. The centre of an 8192x1 source with the proportions of 1x8192 is // of an 8192x1 source with the proportions of 1x8192 is 1/8192 of a pixel
// 1/8192 of a pixel wide. Each case is also turned on its side. // wide. Each case is also turned on its side.
func TestImageProcessor_FitCoverServesThinSource(t *testing.T) { func TestImageProcessor_FitCoverServesThinSource(t *testing.T) {
t.Parallel() t.Parallel()
@@ -21,10 +21,8 @@ func TestImageProcessor_FitCoverServesThinSource(t *testing.T) {
inputWidth, inputHeight int inputWidth, inputHeight int
size Size size Size
}{ }{
{"8192x64 at 8192x8192", 8192, 64, Size{Width: 8192, Height: 8192}},
{"8192x1 at 8192x8192", 8192, 1, Size{Width: 8192, Height: 8192}}, {"8192x1 at 8192x8192", 8192, 1, Size{Width: 8192, Height: 8192}},
{"8192x1 at 1x8192", 8192, 1, Size{Width: 1, Height: 8192}}, {"8192x1 at 1x8192", 8192, 1, Size{Width: 1, Height: 8192}},
{"64x8192 at 8192x8192", 64, 8192, Size{Width: 8192, Height: 8192}},
{"1x8192 at 8192x8192", 1, 8192, Size{Width: 8192, Height: 8192}}, {"1x8192 at 8192x8192", 1, 8192, Size{Width: 8192, Height: 8192}},
{"1x8192 at 8192x1", 1, 8192, Size{Width: 8192, Height: 1}}, {"1x8192 at 8192x1", 1, 8192, Size{Width: 8192, Height: 1}},
} }