Keep a side computed for a size with one side 0 at 1 or more (closes #283) #291

Merged
clawbot merged 6 commits from issue-283-computed-side-at-least-1 into next 2026-10-16 04:18:00 +02:00
6 Commits
Author SHA1 Message Date
sneak b56e6c3d8e Put this change's TODO.md entry back at the top of Completed Steps
check / check (push) Canceled after 0s
The union merge of TODO.md left it below the entry next gained.

Model: opus-5-5
2026-10-16 02:06:22 +00:00
sneak 0eaad0a3f9 Say what a 0 side does in the ValidateDimension doc comment
It said 0 meant "original size"; the side is worked out from the
source's proportions, as README.md now says.

Model: opus-5-5
2026-10-16 02:05:57 +00:00
sneak 778d3b24bd Keep each side at 1 or more with fit=outside too
fit=outside works both sides out again from the larger scale, and a side
scaled to 1 could come out just under 1 and round down to 0, which
libvips refuses: a 49x8192 source at 0x100 and a 49x49 source at 1x1
answered 500. README.md now says what fit=outside does, with the 8192x1
source at 100x0 that comes out at 8192x1, and how a 0 side is worked
out from the source's proportions.

Model: opus-5-5
2026-10-16 02:05:57 +00:00
sneak 52c77ec4ba Test that fit=outside keeps each side at 1 or more
A 49x8192 source at 0x100 and a 49x49 source at 1x1, both with
fit=outside. 49 times 1/49 is just under 1 in floating point, so the
width is rounded down to 0 and libvips refuses it. The test fails until
the fix for #283 covers fit=outside.

Model: opus-5-5
2026-10-16 02:05:57 +00:00
sneak a7bf8d040d Keep a side computed for a size with one side 0 at 1 or more (closes #283)
The side was rounded down, so for a thin source it came out at 0, and
libvips made the size square: an 8192x1 source at 100x0 came out at
100x100, at 1300x0 with fit=cover libvips asked for about 39 GB, and an
8192x2 source at 100x0 answered 500. fit=contain and fit=inside work
both sides out again from the smaller scale and keep each at 1 or more
as well, as a 1x8192 source at 0x100 answered 500 there.

Model: opus-5-5
2026-10-16 02:05:57 +00:00
sneak 472d3354bd Test that a side computed for a size with one side 0 is at least 1
An 8192x1 source at 100x0 and 1300x0 and an 8192x2 source at 100x0, and
the same turned on their side, in every fit mode. The test fails until
the fix for #283 lands; TODO.md
records the bug at the top as P1 until then.

Model: opus-5-5
2026-10-16 02:05:57 +00:00