I've noticed that if some of the images in a site we're building slimage is adding some "filler" to one or both sides of the image in the form of a dark line. For example:
When I change the url from
@banner.GetResponsiveCropUrl("PageBanner")
to
@banner.GetCropUrl("PageBanner")
everything's fine.
I suspect this has something to do with the crafted slimage data-src, which is as follows:
Ah ok, there was a small rounding issue in a older version of ImageProcessor but that was fixed but it had the small result. So it's probably worth upgrading to the latest version (1.9.4) and .Web (3.2.9) to check you get the same result before we start looking what it might be. You can upgrade using NuGet https://www.nuget.org/packages/ImageProcessor/ and https://www.nuget.org/packages/ImageProcessor.Web/ If you're not a Visual Studio developer let me know and I'll grab the dlls into a zip for you. (I have been thinking about shipping the latest versions with Slimsy)
Assuming this hasn't been resolved already in the latest version I suspect there is a similar rounding issue (down rather than up) with the heightratio parameter
Slimsy adding "padding" to side of wide image
I've noticed that if some of the images in a site we're building slimage is adding some "filler" to one or both sides of the image in the form of a dark line. For example:
When I change the url from
to
everything's fine.
I suspect this has something to do with the crafted slimage data-src, which is as follows:
Perhaps the heightratio is slightly off? I'm not really sure.
Adjusting the crop for that particular image (zooming in, changing the focus, etc.) doesn't make any difference.
Any suggestions on how I can overcome this? Also, it's not happening on every image on the site.
- Rob.
Hi Rob,
Very interesting, if you request that image URL directly in the browser does it show with the line or not?
Also, do you know what version of ImageProcessor you are using?
Jeavon
Yep, it sure does...
I'm using ImageProcessor that comes with U7.1.4...
ImageProcessor.dll: 1.9.0.0
ImageProcessor.Web.dll: 3.2.3.0
Imazen.SlimResponse.dll: 0.2.0.0
More info on the crops:
Width: 625; Height: 275
Native Image Size:1322x819
Sample Url: http://lsc.azurewebsites.net/media/1039/keepemsafe_01.jpg?crop=0,0.29915218559218559,0,0.033336545392785924&cropmode=percentage&quality=90&width=800&heightratio=0.4135338345864661654135338346&slimmage=true&rnd=130509329910000000
Changing the HeightRatio affects the borders - if I change it to 0.42 for example I get black bars at the top and bottom instead of left and right.
Ah ok, there was a small rounding issue in a older version of ImageProcessor but that was fixed but it had the small result. So it's probably worth upgrading to the latest version (1.9.4) and .Web (3.2.9) to check you get the same result before we start looking what it might be. You can upgrade using NuGet https://www.nuget.org/packages/ImageProcessor/ and https://www.nuget.org/packages/ImageProcessor.Web/ If you're not a Visual Studio developer let me know and I'll grab the dlls into a zip for you. (I have been thinking about shipping the latest versions with Slimsy)
Assuming this hasn't been resolved already in the latest version I suspect there is a similar rounding issue (down rather than up) with the heightratio parameter
hm. Now I can't get the crops to generate - it's spitting back the image full size without cropping it :(
Nope, all good - had to add the modules back to the web.config file.
However, the bars are still there...
Ok, I will looking into the ImageProcessor heightratio rounding, I'm pretty sure it's rounding down instead of up somewhere
Yep,
800 * 0.4135338345864661654135338346 = 330.8270676691729
Should be rounded up to 331 but it's instead rounding down to 330.
330 gives black line - http://lsc.azurewebsites.net/media/1039/keepemsafe_01.jpg?crop=0,0.29915218559218559,0,0.033336545392785924&cropmode=percentage&quality=90&width=800&height=330
331 doesn't give black line - http://lsc.azurewebsites.net/media/1039/keepemsafe_01.jpg?crop=0,0.29915218559218559,0,0.033336545392785924&cropmode=percentage&quality=90&width=800&height=331
I think I've found it, could you try this custom dll? https://dl.dropboxusercontent.com/u/14453377/ImageProcessor.zip
so far so good...
Cool, let me know once you're sure and I'll send a pull request in :-)
looking pretty good to me :)
Pull request merged, sorry for the delay. Totally slipped my mind during the push for V2.
Get the latest 1.9.5 from nuget https://www.nuget.org/packages/ImageProcessor/
is working on a reply...