"Fit::Crop" malfunction #223
-
Hi, everybody! I have a problem with Fit:crop function. Advice or help, please. https://spatie.be/docs/image/v3/image-manipulations/resizing-images#content-fitcrop
My model config:
As it appears, the script didn't crop the excess but merely compressed the image to the required dimensions. This strongly resembles a bug. Convertion image (Sorry for the JPG. GitHub doesn't support the WebP format, so I had to replace it with JPG.") |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 7 replies
-
Yeah, i got this too... |
Beta Was this translation helpful? Give feedback.
-
Having the same issue. I can reproduce the bug with this snippet. \Spatie\Image\Image::useImageDriver(ImageDriver::Gd)
->loadFile('example.jpg')
->fit(\Spatie\Image\Enums\Fit::Crop, 300, 300)
->save('example-cropped.jpg'); |
Beta Was this translation helpful? Give feedback.
-
Same issue here! v3.3.2 |
Beta Was this translation helpful? Give feedback.
-
I just tagged a new version (3.3.3) that should resolve this issue. |
Beta Was this translation helpful? Give feedback.
-
I was facing the same issue using 3.3.2. After upgrading to 3.3.3 the distortion is gone, but white space is added to meet the given width and height boundaries (instead of cropping). Looks like Fit::Crop now has the behaviour of Fit::Fill. Edited: not clearly visible due to white on white, but the photo has a white bar at the top and bottom. The original does not have that. |
Beta Was this translation helpful? Give feedback.
-
I just published versions 3.3.4 with some additional fixes to fit cropping. These should resolve the white borders you might get on certain images. |
Beta Was this translation helpful? Give feedback.
I just published versions 3.3.4 with some additional fixes to fit cropping. These should resolve the white borders you might get on certain images.