One of the quickest and most effective workarounds is to utilize PNG images instead of JPEGs. Unlike JPEG, PNG is a lossless compression file format, meaning it retains the original image quality without sacrificing details or introducing artifacts. This makes PNG ideal for displaying line drawings, text, and iconic graphics at a small file size. By opting for PNG, you can ensure that your images appear crisp and vibrant, making it an excellent choice for designer websites or photography portfolios.
For those comfortable with making code modifications, another option is to edit your theme's function.php file. By adding two simple lines of code, you can override the default JPEG compression settings and set it to 100%, effectively preserving the original image quality. The following code snippets can be added to your theme's function.php file:
add_filter('jpeg_quality', function($arg){return 100;}); add_filter( 'wp_editor_set_quality', function($arg){return 100;} );
Once saved, your WordPress installation will no longer compress JPEG images, ensuring that they retain their full quality and visual appeal.
For users who prefer not to modify theme files directly, a convenient plugin called WP Resized Image Quality can provide granular control over the compression level of all uploaded JPEG files. This plugin allows you to specify the desired compression rate for both full-sized images and their thumbnails. By adjusting the settings to your preference, you can strike a balance between image quality and file size, achieving the optimal visual experience for your website visitors.
While WordPress compresses uploaded JPEG images by default to conserve hosting bandwidth, this may not always be desirable, especially for websites that rely heavily on image quality. By implementing one of the mentioned workarounds, such as using PNG images, modifying the function.php file, or utilizing a specialized plugin, you can ensure that your website presents high-quality images, catering to the needs of design-oriented or photography-focused websites. By optimizing image quality, you can enhance the visual appeal and user experience of your WordPress site while still maintaining control over file sizes and website performance.
All new hosting and maintenance clients receive a free HOUR of support each month for theme or plugin fixes, site optimization or malware removal!
GET FREE WP FIX NOW!WordPress is a widely popular Content Management System (CMS) that powers over 40% of all…
WordPress is a popular platform that empowers more than 60 million websites worldwide. Millions of…
In this article, we will cover ten crucial WordPress site maintenance tasks that every website…
In this blog article, we will explore the various WordPress security solutions you can implement…
Plugins are an integral part of WordPress, as they offer countless benefits and features that…
In this article, we will explore various strategies that can help you enhance your WordPress…
View Comments
Hi, I added the code you mentioned:
add_filter('jpeg_quality', function($arg){return 100;});
add_filter( 'wp_editor_set_quality', function($arg){return 100;} );
and when i added a new image it was still smaller than the image on my harddrive.
I downloaded it again just to make sure and the sizes were as follows:
Original: 192k
Uploaded file: 95k
How could this have happened?
I am really confused about this now.
Quintin I don't know what happened, since this guide was written about 2 yrs its not so current. You may also want to see if you have any image compression plugin like wp smush or if your theme is compressing the images.
Hi, thank you for this post. I've had a rubbish time trying to get my blog images to look crisp and vivid on wordpress, and failed with so many pieces of code and plugins. I never even considered using PNG file format, because almost all of my images are photos, but I gave it a go and the latest one I uploaded as my featured image looks lovely. Thank you! As loading time doesn't bother me too much, this is perfect, even if it takes 1 or 2 seconds longer for readers.
Could you tell me, are there any other real downsides to using the PNG file format? I'm curious to know before I make all of my images PNG from here on out.
Thanks again :)
Yas
Hi Yasmin.
THe PNG format is usually preferred for showing drawings, shapes and text while JPEG is better at showing photos.