• I upload images at 1024×1024 pixels. WP leaves this original in uploads folder with original filename and creates other sizes too. Other sizes have sufix in filename by their dimension. Interestingly among other sizes a copy with the same dimensions with suffix -1024×1024 is created. Moreover, the copy it makes is few kilobytes larger than my original.

    How to avoid this and let WP to use my original image for large sizes as it was uploaded?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter Rubidze

    (@rubidze)

    Thanks @soberbanda for your input! I went through these articles and it appears that they just explain why diferent sizes are being created and how to disable one or the other particular size. This does not help me unfortunately.

    My problem is not that I want to get rid of 1024×1024 sizes. I like that size and if image is being uploaded at 2000×2000, it is great to have 1024 pix versions.

    My concern is that when image is originally 1024×1024 and optimized to use little space (50,9 KB) and then uploaded to media library, then WP generates a copy of this image witch is also 1024×1024, but takes more space (57,1 KB) on the server. I don’t see any reasons why would anyone need a resampled image file that has the same resolution as original, have larger footprint than original and have one extra file to use up server recourses.

    Is this happening only to me or to others too? Hove to avoid these double files without eliminating 1024 resize versions completely?

    All help is appreciated!

    Kuldeep

    (@soberbanda)

    >>optimized to use little space (50,9 KB) and then uploaded to media library, then WP generates a copy of this image witch is also 1024×1024<<

    @rubidze I think its more to do with the theme ( or plugins?) generating those same uncompressed image sizes over and over again and not WordPress.

    Try leaving your image uncompressed and check if it generates a new copy. Here is how you can do that:

    Go to your theme’s functions.php file and add the following line of code:
    add_filter(‘jpeg_quality’, function($arg){return 100;});

    Let me know ??

    Thread Starter Rubidze

    (@rubidze)

    I tried this code, but extra files are being regenerated anyway. I forgot to clarify earlier that I am using images in webp format and that code did not change behavior on those images. But the problem I have is not related only to webp, extra files with the same resolution are being generated for jpg as well.

    I tested jpg image with this code and without it. Well, without this code generated jpg images are slightly smaller than originals, but I don’t prefer that option as resampling messes a little bit with quality and space saved is not significant. I optimize images prior upload and use quality settings as I see fit not to spoil the quality. I save them in desired resolution (1024×1024) with desired quality settings and would like WordPress to use my file.

    With your suggested code as expected WP generates a high quality copy of the same size, but then the file takes twice as much space as my original.

    To rule out any evil plugins or themes I installed a fresh WP site with all default settings and Twenty Twenty-One theme. The results are exactly the same.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘WP is resizing original image to exact same dimensions’ is closed to new replies.