Copied to clipboard

Flag this post as spam?

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


  • Calin Ursu 4 posts 84 karma points
    Feb 12, 2021 @ 12:39
    Calin Ursu
    0

    Image cropper is increasing the size of original image

    A smaller image is cropped upwards, the size gets increased:

    653x340 (547KB) gets cropped to 1440x525 (1.6MB)

  • Dan Diplo 1554 posts 6205 karma points MVP 5x c-trib
    Feb 12, 2021 @ 17:16
    Dan Diplo
    100

    Is this with PNG images? It can happen if you have a very optimised image and then regenerate it, since the PNG generation in System.Drawing in .NET doesn't optimize the newly created PNG very well. Unless you need transparency then your better off using JPEG (or converting to JPEG).

    Note that Umbraco uses an (amazing) 3rd party library called ImagePrcocessor for all image cropping etc. I've raised this issue before with the author, and there's not much he can do. For context:

    https://github.com/JimBobSquarePants/ImageProcessor/issues/98

  • Calin Ursu 4 posts 84 karma points
    Feb 15, 2021 @ 09:46
    Calin Ursu
    0

    It's a PNG, that's right. So there's nothing to do about it, except to avoid passing PNGs through the cropper?

    Thank you Dan for your reply, very thorough and helpful!

  • Dan Diplo 1554 posts 6205 karma points MVP 5x c-trib
    Feb 15, 2021 @ 10:07
    Dan Diplo
    0

    It's a hard call to make as to whether to avoid resizing PNGs at all - there are a lot of variables involved.

    My general view is that if you have already optimised the PNGs with an optimisation service (like https://tinypng.com/) then resizing them will usually make them larger - though it will depend on the percentage you are resizing. If the original is large in dimension and you're just making a thumbnail, then it will be smaller, but if it's not that different it will end up larger.

    If you are using mostly PNGs that are not optimised and you are resizing them downward by, say, 50% then it's probably worth it.

    However, for most photographic images that don't require any transparency, if you can force the format to JPEG they will be smaller. You can do this in ImageProcessor using the ?format=jpeg query parameter:

    https://imageprocessor.org/imageprocessor-web/imageprocessingmodule/format/

  • Calin Ursu 4 posts 84 karma points
    Feb 15, 2021 @ 11:45
    Calin Ursu
    0

    No, the problems is only when you use low res PNGs. So it's a matter of recommendations you give to your content editors.

    Do you have any optimisation services that you can recommend, for all images, not only PNGs? Preferably that can be integrated with the image cropper, and not having to optimise the images manually...

Please Sign in or register to post replies

Write your reply to:

Draft