Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Jonathan Claeys 7 posts 87 karma points
    Apr 22, 2021 @ 11:49
    Jonathan Claeys
    0

    Poor Image Quality Umbraco 8

    Hey all,

    I'm new to Umbraco and I've started to develop my first website with it. It seems to work nice with the building blocks you can custom create to put together a page. But I keep having this issue with images.

    When I use the getCropUrl method with the right parameters I get an image returned with the correct url. It has the width, height & quality in it. But for some reason the quality is poor, even at quality 100. When I change it to for example quality 20 it seems to work, it gets worse. So What I think is that either the image is already getting downscaled on upload or the quality 100 is also getting downscaled but with "minimal" loss. But the "minimal" loss is too big in my opinion, I'm not happy with this result, I want sharp images.

    PS: I'm using Azure Blob Storage.

    Does anyone have a solution? I've seen a lot of people complain about this.

    Kind regards, Jonathan

  • Matthew Wise 271 posts 1373 karma points MVP 4x c-trib
    Apr 22, 2021 @ 12:36
    Matthew Wise
    0

    Hi Jonathan,

    Is the image you are using smaller than your crop size? If so you might be seeing upscaling, try adding furtheroptions: "&upscale=0" to your GetCropUrl call, and see if you get a better result.

    If that works you can do this globally with ImageProcessor events in a Composer / Componet:

    public class ImageProcessorComposer  : IUserComposer
    {
        public void Compose(Composition composition)
        {
            composition.Components().Append<ImageProcessorComponent>();
        }
    }
    
    public class ImageProcessorComponent : IComponent
    {
        public void Initialize()
        {
            ImageProcessingModule.ValidatingRequest += OnImageProcessingValidatingRequest;
        }
    
        private void OnImageProcessingValidatingRequest(object sender, ValidatingRequestEventArgs e)
        {
            var queryString = HttpUtility.ParseQueryString(e.QueryString);
            if (queryString.Get("upscale") == null)
            {
                queryString["upscale"] = "0";
            }
            e.QueryString = queryString.ToString();
        }
    
        public void Terminate()
        {
        }
    }
    
  • Jonathan Claeys 7 posts 87 karma points
    Apr 22, 2021 @ 13:02
    Jonathan Claeys
    0

    Hey Matthew,

    thanks for the answer! But the images I uploaded are large than the crop. So I don't think that is the issue.

Please Sign in or register to post replies

Write your reply to:

Draft