Orchardcore: Occassional image distortion when using Azure BlobStorage

Created on 18 Nov 2019  路  24Comments  路  Source: OrchardCMS/OrchardCore

Images that are stored on Azure Blobstorage seem to have distortion at the top of the image sometimes when resized. Check out this image

https://www.kast.io/media/concepts/group-ideas.jpg?width=1920&height=832&rmode=crop

https://demo.kast.io/media/groups-demo/family-groups2.jpg?width=408&height=316&rmode=crop

Not sure at this point of the cause.

Media.Azure P2

Most helpful comment

@hishamco I'm trying to get the RC1 shipped asap.

All 24 comments

Are you sure that it's related to Azure Blob storage?

I think we should try to take the original image and resize it with the same parameters. Maybe an issue with image Sharp

@scleaver this looks like an issue with ImageSharp.

I can repro, using the ImageSharp.Web Sample app, with local files. But only with those specific sizes. For example if you drop the width down to around 1300, then you don't get the issue. But go up to 1500 and yes, it crops poorly.

They are very big jpegs, so I wonder if the image size is causing memory management issues.

I've seen similar issues with ImageSharp (the image processor) directly, when using it within Azure Functions (limited memory pool), and those issues I resolved by adjusting the ImageSharp memory management settings. But I tried this with the ImageSharp sample app, and didn't see any difference.

Suggest you open an issue with ImageSharp

@deanmarcussen the 408x316 isn't too big though. I think you might be on the money there, yesterday my test site fell over "out of memory"

I'll open a ticket with ImageSharp. Should we keep this open until there is a resolution?

Looks like someone already has it: https://github.com/SixLabors/ImageSharp/issues/1006

I'm having the same issue. This is the top (zoomed in) of a very large image scaled to 480 x 600:
CGPW460_2018

FYI, original image is a 1980x5520 jpeg and I'm cropping to 480x600. I'm not hosting on Azure.

408x316 isn't too big though

@scleaver no it's not. but the source image you're resizing here is 6MB, so that's pretty big!

Your out of memory error, is probably different to the resizing issue, and related to the 6MB file.

I just put 20 copies of the same file in a folder on a low memory azure instance, and browsing to the media folder I put them in causes them all to try and resize at once (because of the async nature of the middleware I suspect) which causes out of memory errors.
Putting a single copy of the image in works fine, but if you have multiple requests for the same image, (i.e. different sizes), the source (6mb) image is going to be loaded into memory every time (and often together), so it is going to struggle in a low memory environment.

I've opened a PR in the ImageSharp repo to fix this. Nothing to do with memory, just some incorrect source sampling.

https://github.com/SixLabors/ImageSharp/pull/1060

FYI SixLabors/ImageSharp#1060 is merged, seems we need to update the package when the 1.0.0-rc version is released

Cool, that'll need a release of ImageSharp.Web first as we don't reference ImageSharp directly.
And it'd be better not to take a reference directly.

@JimBobSquarePants any chance of a new beta release of ImageSharp.Web with this update to ImageSharp ?

@deanmarcussen The fix is currently in an ImageSharp nightly which we are not planning on releasing a new beta for. The next release will be RC1. I'll have to chat with the team.

@JimBobSquarePants no worries, just worth checking how your roadmap was :)

Anyone needing the fix can grab it from the ImageSharp nightlys

@JimBobSquarePants Any idea when RC1 will be out?

@scleaver Aiming for March. Was hoping the beginning but more likely the end.

@sebastienros can we move this to 1.0.x because this dependent for a 3rd-part library that we don't manage

Seb this has dependency on ImageSharp, we can't guarantee that it will be fixed in 1.0.0 unless @JimBobSquarePants planned about the RC1 release date

@hishamco I'm trying to get the RC1 shipped asap.

Thank you @JimBobSquarePants

That would be cool @JimBobSquarePants!

In the interim I encourage everyone with a vested interest to download and review the ImageSharp.Web codebase for any API or performance issues they think might negatively affect the Orchard release. Once RC1 hits we're on an API lockdown.

I would also encourage anyone with this issue to try the ImageSharp myget builds with Orchard Core, and help everyone make both code bases great

As you can see via the @deanmarcussen PR the RC is released

Was this page helpful?
0 / 5 - 0 ratings