Skip to content

Commit

Permalink
Fixes bug with odd sized segments. Fixes #1
Browse files Browse the repository at this point in the history
  • Loading branch information
freshleafmedia committed Nov 30, 2023
1 parent 95fccf4 commit 70d0b2b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ protected function makeSegments(): self

for ($x = 0; $x < $this->image->getImageWidth(); ++$x) {
for ($y = 0; $y < $this->image->getImageHeight(); ++$y) {
$focus = $this->factor($x + $this->segmentSize / 2, $y + $this->segmentSize / 2, $this->image->getImageWidth(), $this->image->getImageHeight()) * 0.15;
$focus = $this->factor($x + intdiv($this->segmentSize, 2), $y + intdiv($this->segmentSize, 2), $this->image->getImageWidth(), $this->image->getImageHeight()) * 0.15;
$width = min($this->image->getImageWidth() - $x, $this->segmentSize);
$height = min($this->image->getImageHeight() - $y, $this->segmentSize);
$pixels = $width * $height;
Expand Down

0 comments on commit 70d0b2b

Please sign in to comment.