Image Sharp over-aggressive cropping
# help-with-other
c
V13.6.0 I have a logo image that is bascially an oval shape. When output on it's own, it's fine. But when it's run through Slimsy and Image Sharp it either flattens off the bottom or the left hand edge, just depending on what pixel size you request. Looking at the output file in the browser, it looks to me as though it's cropping it so hard it's ignoring the anti-aliasing around the curve which results in a pronounced flat. Does anyone know if there are ways to prevent this or even add a little padding maybe? I've tried it as a converted webp and a png with &format=webp but both are the same. Thanks.
m
Might be missing something but if it's an oval with feathering to the edge of the image why croping? Would one of the other rmode options be better? https://docs.sixlabors.com/api/ImageSharp/SixLabors.ImageSharp.Processing.ResizeMode.html
c
I'm not doing anything. It's just how it comes back if you add ?width=312. It's as if it's doing a zealous crop and cropping to content. The image has transparency so I guess it's cropping that to content but maybe it's cut off is to high to discriminate between transparency and alpha'd content. I'll have a play with that resize mode though. Thanks.
m
AFAIK rmode defaults to crop if not specified.. so maybe it's cropping unnecessarily, also watch out for rotation via meta as it can mess with things.. width/height can potentially be translated during crop
3 Views