Skip to content

Commit 134c002

Browse files
authored
fix: Max points calculation to actually crop(#73)
fix Max points calculation to actually crop
1 parent 7a4975b commit 134c002

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Utils/Image.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -288,8 +288,8 @@ public function crop(int $xMin, int $yMin, int $xMax, int $yMax): static
288288
// Ensure crop bounds are within the image
289289
$xMin = max($xMin, 0);
290290
$yMin = max($yMin, 0);
291-
$xMax = max($xMax, $originalWidth - 1);
292-
$yMax = max($yMax, $originalHeight - 1);
291+
$xMax = min($xMax, $originalWidth - 1);
292+
$yMax = min($yMax, $originalHeight - 1);
293293

294294
$cropWidth = $xMax - $xMin + 1;
295295
$cropHeight = $yMax - $yMin + 1;

0 commit comments

Comments
 (0)