• Resolved Frontman

    (@frontman)


    I have many images uploaded at 3000x2000px and I would like to resize them to 2048×1360. OR, max. 2048px wide and whatever height based on the aspect ratio.

    I have set the max. dimensions as 2048px W x 1360px H and when bulk resizing I am getting the Error message that the resized image is larger than the original.

    I am not sure I understand how that could be when both dimensions are smaller than 3000x2000px. Could someone help me understand this, please? Many thanks.

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author nosilver4u

    (@nosilver4u)

    It means that the filesize of the resized image is larger than the original image. This most frequently happens when using the GD library with PHP. If your webhost has it available, enable the Imagick extension for PHP and try those images again. Your webhost will be able to help you enable that if you’re not sure where to look.

    Thread Starter Frontman

    (@frontman)

    My host doesn’t have this available, seems it would need to be installed.

    Had a look at the install instructions and it looks like a complicated pain in the *ss.

    Nothing in WP is ever simple. Can’t even resize and image with another set of installs and messing about.

    I am not sure is this problem applies to other image resizing plugins but will have to give others a try as it seems Imsanity can’t perform as required.

    All my images are compressed. I am not sure why Imsanity has to see the image filesize as an issue, I just want to resize a photo, I don’t need Imsanity refusing to do so cos it creates a bigger file. I will just compress it again after the resize, no big deal.

    Plugin Author nosilver4u

    (@nosilver4u)

    Yeah, you don’t want to be installing imagick (ImageMagick) manually, yikes…

    The default behavior is that way because most folks resize their images to get smaller filesizes, and do not apply any additional compression. Otherwise, they would be using something like EWWW Image Optimizer instead, which does both.

    However, you’ve pointed out something that’s been bugging me lately in EWWW IO. It will discard a resized image for being too large (filesize) without doing any compression first. Obviously, there could be images that might be larger with stock GD/Imagick settings, but once compressed with jpegtran or via a compression API, they might be smaller. I don’t know how common that is, but I’m going to try and fix it anyway.

    I may also include an override in Imsanity in a future release, but at this point I don’t have any estimate of when that might be, as I don’t want to push out a new version just for that one thing.

    Thread Starter Frontman

    (@frontman)

    TBH, I deleted Imsanity and paid for a month’s subscription to Imagify. Took 10 mins to install and set up, and the whole library resized and optimised within the hour.

    Even after installing ImageMagick on the server I’m still having the same issue as Frontman had with Imsanity: ….resized image is larger than the original….

    Imsanity has always been working very well on my server, but since a while it doesn’t. Could it be that something is wrong with your plugin? Should it work well with PHP7 ?

    I found found another plugin, called “Bulk Resize Media” by Marty Thornley which looks like Imsanity, but this plugin can resize my images without any problem.

    Plugin Author nosilver4u

    (@nosilver4u)

    First of all, make sure you have the imagick extension enabled within PHP. Just because ImageMagick is installed, does not mean that PHP is using it.

    Before version 2.3.8 (7 months ago), Imsanity did not check the filesize of the new images during bulk resizing (it only checked during new uploads). It blindly resized the image, no matter what. So it isn’t a matter of anything being broken, it was fixed, and it can be difficult to understand why. The Bulk Resize Media plugin is based on a really old version of Imsanity, suffers the same flaw as old versions of Imsanity, and should not be used by anyone who values the security of their site.

    Simply put, making the image dimension does NOT always make the filesize smaller. You can stop here if you don’t care why.

    In my experience, using the imagick extension instead of GD usually produces smaller sizes, but again, it does NOT always make the filesize smaller. It does better, but it isn’t a perfect solution. It’s something core WordPress struggles with, when creating the various thumbnails/resizes as well. You might upload a 1500×1500 image, and when WordPress creates the “large” size, sometimes it is bigger than the original upload. It’s lower quality, smaller dimensions, but larger filesize. Sometimes even the “medium_large” and “medium” sizes will suffer from this same problem.

    So, if you got this far, WHY? Why doesn’t a smaller set of dimensions automatically translate to smaller filesize?

    An image is broken into small bits we call pixels. It is the smallest unit that can be displayed from an image. When you make the image smaller (dimensions), do the pixels get smaller? No, they can’t get any smaller. Instead, you have to throw some of them away, move them around, change the colors, and more to make the image look mostly the same as the larger one.

    At this point, there is a general rule of compression you need to know. Smooth areas of images can be compressed better than rough areas that have lots of variation in color. For this reason, you might have 1,000 images taken by the same camera, that are all the same dimensions, and they will all be different in file size. And it all really comes down to the colors in the image, and how they are arranged. A picture of the pure blue sky will be really small, and a picture of a sunset will be larger. A picture of a bunch of flowers with different colors will be even larger than that, because there are more jagged lines, more variation, less room for compression.

    Back to the resized image. This new image with smaller dimension will introduce more variation than the original. It will have more jagged edges, and it will not compress as well as the original. But there are less pixels to store in the file. So we have two competing forces here:
    1. Less pixels generally means less data to store.
    2. Less pixels of the same color with increased variation means each pixel requires more bits to store.

    So when the resized image is saved, the end result depends upon which one wins. If the gains from #1 are larger, then your resized image is smaller, and you see sunshine and rainbows. If the loss from #2 is larger, then you are stuck with the original image.

    So, as I said before, generally ImageMagick does a better job at making #1 win than GD, but not always.
    The only other thing that can tip these scales within the context of WordPress is the compression level. If you make the JPG quality lower, you give #1 a better chance of winning at the cost of reduced image quality. If you raise it, #2 gets stronger, and the odds of getting a resized image decrease.

    Hope that all makes sense, and please do NOT use Bulk Resize Media on your site ever again.

    Plugin Author nosilver4u

    (@nosilver4u)

    And to follow up on my earlier comment about EWWW IO… When I started digging into the code, I realized that was by design. While it is remotely possible, it is unlikely that two images of different sizes will end up reversed after further compression is applied.

    For example, suppose you have a 2000×1500 image that is 1MB. You resize it to 1500×1125, and it ends up being 1.1MB. Is it likely that after you compress them both the 1.1MB image will be smaller than the 1MB image? No it is not.

    FYI, Imagify does not check the file size after resizing, so naturally you won’t have any trouble “forcing” all your images to be a certain dimension.

    Thank you for your very clear explanation!
    I thought the error was about the size in pixels, which would be a strange error message, but now I understand it’s about file size. Very smart that Imsanity is chacking this before resizing.

    Oh yes, I will remove the Bulk Resize Media plugin and use Imsanity again.

    I came here with the same issue, and was wondering what was going on. High Five on the excellent description! Guess I won’t worry about it ??

    Hi,

    I had the same issue,

    that is my solution works for me:
    I increased JPG image quality to 90.
    That means after resizing image was LARGER (capacity in bytes not size in pixels
    and that is how to read “Resized image was larger than the original” error.

    I think the idea of Imsanity plugin is to “optimize” not change resolution.

    So if you increased quality, after bulk even smaller (in pixels) picture
    may bacome LARGER (in kilobytes)

    I hope it helps someone

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Error: (Resized image was larger than the original)’ is closed to new replies.