Search code examples
imagesharp

imagesharp.web doesn't resize image or crop


Í have got imagesharp.web somewhat working. In the below it resizes the image but I can't get it to crop the image.

There is a second image it doesn't resize at all.

This resizes
<br />
<img src="https://wilderness-production.imgix.net/2021/08/IMG_2055-scaled.jpg?width=200&height=200" />
<br />
But can't crop
<br />
<img src="https://wilderness-production.imgix.net/2021/08/IMG_2055-scaled.jpg?width=300&height=100&rmode=crop" />
<br />
<img src="https://wilderness-production.imgix.net/2021/08/IMG_2055-scaled.jpg?width=300&rmode=crop" />
<br />
<img src="https://wilderness-production.imgix.net/2021/08/IMG_2055-scaled.jpg?height=100&rmode=crop" />
<br />
This doesnt resize
<br />
<img src="https://st4.depositphotos.com/1007600/21237/i/1600/depositphotos_212376262-stock-photo-long-wide-banner-workspace-desk.jpg?width=200&height=200" />
<br />

Output from above


Solution

  • They are all remote URLs thus ImageSharp.Web would not be involved with serving up those images to your browser, for ImageSharp.Web to even have a chance to be used it would have to, at least, be a local url to your deployed web application.

    The reason the first ones are resize is due to the fact that imgix.net supports resize itself and has nothing to do with ImageSharp.Web.