Jun 15, 2018

11 steps to optimize JPEG

There are not many basic tips for optimizing JPEG, which really give an effect without degrading the quality. In this article I will talk about all these methods and their effectiveness, and also offer some advanced techniques that will reduce your images in size even more.

Immediately make a reservation that the format of JPEG (due to DCT-coding and Huffman tables) initially implies a loss of quality. And even saving in "100%" mode will not eliminate losses. But these losses can be made invisible to the eye or permissible in a particular case of use. Or use some aspect of the format to encode the JPEG with no loss at all.

1. Optimizing for the Web

Basic advice: when saving in any editor (Photoshop, Gimp, etc.) use a separate option "Save for Web". This will make the image compatible across the color palette with all browsers. It also removes some additional information from it (for example, preview images), which is necessary for ordinary editors to quickly view multiple images, but it does not suit browsers (which do not use previews in JPEG images in any way).

Naturally, the actual size of the image should match the maximum size used on the site. The most common mistake in working with pictures on the site: take them in their original form, without bringing them to the desired size. This greatly increases the size of the site and significantly slows down its download.

2. Removing meta information

As a further optimization of JPEG without affecting the color data, you can and should consider various utilities for removing EXIF chunks and comments.

The best utilities in this class will be ExifTool, which is available for all platforms. ExifTool recognizes additional tags (EXIF chunks) of almost all devices and applications and allows them to be removed (or removed or replaced) painlessly for image quality.

Removal of meta information and EXIF chunks is performed outside the main image data (DCT and Huffman tables) and guarantees the preservation of quality.

3. Progressive optimization

The JPEG format contains another interesting feature - the ability to take multiple frames of the image, drawing them sequentially (this is the meaning of the term "progressive" JPEG). Perhaps initially this possibility was used for JPEG animation, but in a particular implementation it found the best application.

"Progressive" JPEGs improve the user experience when downloading large files (a blurry copy is shown first, then it improves in the data flow) and have a smaller size (on average, if the JPEG image is larger than 10 Kb).

Currently, "progressive" JPEG files are supported by all browsers, and there is no reason not to use them. Not always such files will be smaller than usual, but the check for the size of the usual and "consistent" version must be performed while saving or optimizing the files.

The winnings in the amount of "progressive" JPEGs are usually not more than 20% of the original file size.

4. Saving not in 100% quality

100% quality (the maximum quality level in the graphic editor) when saving JPEG-files does not imply the absence of loss. Due to format limitations, each JPEG file represents lossy information. But you can reduce the file size and, in practice, do not increase the net loss. To do this, you need to set the compression ratio in the used graphics editor (or console utility) to 5-10% less than the maximum. For example, with a scale from 0 to 100, the optimal level will be 90-95. With a scale of 1 to 12, the optimal is 11.

As can be seen from the graph above, even using quality 95 instead of 100 usually reduces the size by 1.5-2 times.

5. Using a different format

Not always images in JPEG format will take up less space. Sometimes it's more appropriate to save them in SVG (logos), PNG (with a small color palette) or even in WebP (if all browsers of your users support it).

Even if the WebP format is not fully supported in browsers (at the current moment coverage is around 85%), you can save the image in two formats - the best of the standard (for example, JPEG) and the alternative (WebP) and send users the images that support them browser (specifying this over the HTTP header Accept).

Correct definition of the format of the image can reduce the size by 2-3 times.

6. Optimization for Retina-devices

When using dual-resolution images for the respective devices (with Retina), the following trick can be applied. Since the physically larger image will be displayed in a smaller area, the original image can be saved with a significantly lower quality (and the quality loss will not be noticeable by pixel-by-pixel comparison).

In the example above, a higher compression ratio for an image with a double pixel density gave 30% of the gain in size without apparent loss of quality.

The described techniques allow significantly (sometimes several times) to reduce the size of the JPEG image and apply to them other, advanced optimization techniques.

The article will deal with those techniques that many, most likely, do not know. Not all of them are easy to learn or can be automated, but knowing these techniques will make the images smaller in size and not lose quality. I assume that you already know how to save an image without excessive meta-information in the size on the pages of the site. And even you know what distinguishes progressive JPEG images from conventional ones. Further, additional tools and techniques will be disassembled, which can complement your arsenal of working with images.

7. Optimization for an 8 × 8 lattice

A fairly well-known technique (the author of the method is Sergey Chikyonok), which uses the JPEG feature to compress the image with squares of 8 × 8 (due to the DCT conversion). For optimal image clarity (and lowering its quality without any visible damage to the image), you need to align the boundaries of the image elements along the 8 × 8 grid.

When translated into JPEG format, the image is cut into 8 × 8 squares, which can be independently optimized (with more details - with better quality, monotonous - with less quality). If the details of the image do not coincide with the 8 × 8 lattice, then at the boundary of the lattice there will be a significant blurring of the details (which, of course, can be leveled due to higher compression quality - but this will increase the image size).

The gain from this technique is usually 5-10%.

For automation of technology, it is possible to adjust the displacement of the image boundaries by 1-4 pixels on both axes with the same quality (and saving among the resulting images). Images of a smaller size will be better optimized for an 8 × 8 grid.

8. Selective optimization

A logical continuation of optimization for the 8 × 8 grid will be selective image quality (number of parts) for different image areas. The technique is called Selective optimization and is available in several tools.

In particular, in Adobe Photoshop you need to create one or more image masks for better quality (the rest of the image will be compressed more strongly) and apply it when saving JPEG images (detailed instruction). As a result, with the same quality of detail display, the image size will be smaller.

This technique yields a gain of 3-20% relative to the original image.

9. Optimize color and brightness

Another technique from Sergey allows you to discard color information for those parts of the image that combine black and other colors in fine textures. By reducing the information about the color change, JPEG turns out to be smaller in size, but this does not affect the image quality (it does not matter what color brightness is zero if it is black).

The reception is quite complicated in mastering: you need to switch to the Lab Color mode, then in Channels select colors that reduce the detail (smudge the background), then change the Levels to keep the image color the same. (The full version of the manual is available here).

The gain from such manipulations with the image can reach another 10-15%.

10. Subsampling optimization

As a more automated alternative to reducing color information while preserving the brightness of the image, you can consider the Chroma subsampling technique (sub-selection of brightness). Briefly, if you save the brightness channel in YCbCr-image representation (Y - brightness, Cb - one color (blue), Cr - second color (red)), the differences in colors of neighboring pixels decrease. 1×1 subsampling means no color changes, 2×1 and 1×2 average the information in only one dimension (horizontal or vertical, respectively). 2×2 subsampling averages the information at once in 4 pixels.

In another representation of the scheme, J: a: b (for example, 4:2:2) - the first digit means the width of the averaging area (in this case 4 pixels), the second digit - the number of resulting color values ​​in the first line, the third digit - the number of resulting colors in the second line. Total rows 2 (height of the area - 4 pixels). Thus, the 4:2:2 scheme corresponds to 2×1 subsampling, 4:4:4 to 1×1 subsampling, 4:2:0 to 2×2 subsampling, 4:4:0 to 1 × 2 subsampling.

The last subsampling scheme supports a large number of hardware and application programs. In particular, ImageMagick (through the option -sampling-factor) and GIMP. In terms of effectiveness, the 4:2:0 scheme allows you to save 17%.

11. Optimizing Huffman tables

Huffman coding allows you to represent color information (via different channels) as a compressible table (with loss of information). JPEG files use these tables. The optimal choice of the order of the arrangement of the coefficients in such a table makes it possible to substantially reduce its size. This is also used by various utilities for optimizing Huffman tables.

The most famous is jpegtran, which is included in the set of libjpeg-progs and in a lot of editing utilities and image optimization. A less known version of the optimizer is the libjpeg-turbo library set, which contains improved instructions and additional optimizations for Huffman tables.

And quite little known is the mozjpeg package, which implements all the workings of libjpeg-turbo and some additional performance improvements. Each of the described libraries is backward compatible with jpegtran (and can be used as a full replacement for this utility).

The gain from optimized Huffman tables is 5-20% per image.

The eleven methods described above, without any doubt, will complement your toolkit and will allow you to get smaller images of the same size with the same quality.

150 comments:

  1. URLs interest the general user experience, and, as a consequence, they ought to have an area in your technical SEO to-do list. Once you create seo course-friendly URL structures, you design logical click paths at an equivalent time.

    ReplyDelete
  2. Wow! This doesnt sound easy but I have learned something new.
    https://seonotforhire.com/

    ReplyDelete
  3. How to Optimize your Website for SEO in 8 Simple Steps. Analyze all of your website data. Conduct thorough keyword research. Check this out

    ReplyDelete
  4. Is it possible to cut text from a movie and save it as a text document? how to create a wikipedia biography page

    ReplyDelete
  5. Why everytime i try to save optimized a picture on Image Ready it saves it as a . jpeg instead of .gif?
    Whiteboard Animation Service

    ReplyDelete
  6. Thanks for sharing this great information. yycsepticservices.ca/

    ReplyDelete
  7. Their transparency and eagerness to accommodate Niche Edit client's needs contribute to a positive ongoing relationship.

    ReplyDelete
  8. For the excellent company Begin with the internet site, the customer service over the cell phone, to the detailed care they deliver in your presence on page seo

    ReplyDelete
  9. This text may be value everyone’s attention. How will I learn more?
    cheap niche edit

    ReplyDelete
  10. Why every time i try to save optimized a picture on Image Ready it saves it as a . jpeg instead of .gif?
    children book illustrator rates

    ReplyDelete
  11. CFMS envisages enhanced security of operations and information. In the first phase of roll out, all authorizing officers in the approval hierarchies would have Aadhar based biometric authentication facility. Necessary instruction in this regard will be issued in the due course in consultation with the IT&C Department. AP CFMS Pension Slip

    ReplyDelete
  12. Thank you compiling this great information. Indeed, it will help me so much.
    Austin Door Company

    ReplyDelete
  13. Please check our website for more information. Austin Door Company

    ReplyDelete
  14. Thanks for sharing this great article, nice post. treecarelafayette.com/

    ReplyDelete
  15. I recommend to use flexispy trial to check your friends and family. I use this service to defend myself and now i now truth about everyone around me. IF you want the same thing i definitely recommend this service.

    ReplyDelete
  16. To optimize to a specific file size, click the arrow to the right of the Preset menu, and then click Optimize To File Size. basement finishing atlanta

    ReplyDelete
  17. Thank you for keeping us here updated with great article click here

    ReplyDelete
  18. Thank you for taking the time to publish this information. very useful! click here

    ReplyDelete
  19. I love the way you write and share your idea! Very interesting and different! Keep it coming! Brentwood Plumbing

    ReplyDelete
  20. Really great topics here to learn from, thanks! heating and ac

    ReplyDelete
  21. Excellent information on your content, thank you for taking the time to share with us. Hendersonville House Cleaning

    ReplyDelete
  22. Awesome article! I want people to know just how good this information is in your article. It’s interesting, compelling content www.hendersonvilleroofer.com

    ReplyDelete
  23. I really like reading articles that cause people to think. Also, thank you for allowing me to comment!
    gravel

    ReplyDelete
  24. Thank you for the efforts you have made in writing this article Newport News Roofing Company

    ReplyDelete
  25. Such an impressive share! It is well-written and contains all the info, your Post is very unique and all information is reliable for new readers drain repair

    ReplyDelete
  26. Thanks for sharing this information, great one. Our site

    ReplyDelete
  27. It would be best if you always went for those solution providers who have a finance assignment expert for helping you to complete the assignment on time and in a proper manner. A reliable solution provider will provide you guarantee for their services and a money-back guarantee. A professional service provider will keep your assignments 100% confidential with excellent quality work. Now, it's easy to hire a professional to complete your finance assignments as you have to fill in specific details about your project. After paying for it, you have to wait for its delivery. You might go onto the wrong site and tend to do more for your assignments which is not done professionally, so always make sure that the site is genuine before hiring it.

    ReplyDelete
  28. Thanks for taking the time in sharing this awesome blog. info

    ReplyDelete
  29. I've spent some time going through your post, your article is a master piece, thanks much for sharing. Click has tasu post utme form closed

    ReplyDelete
  30. Thank you for creating such a wonderful blog. I haven't found any of your writings that have disappointed me in the recent few weeks, I enjoy reading your all posts. This essay is quite appealing, and I'm looking forward to hearing about your new ideas like I get from write my essay for me cheap uk. I look forward to reading your next blog as soon as possible.

    ReplyDelete
  31. Awesome! Hope I can do it just like you do.

    Lawyer

    ReplyDelete
  32. Glad to check this site again. Nice blog! click here

    ReplyDelete
  33. Thanks for keeping us updated with awesome blog. https://www.thebeautyrnaz.com/

    ReplyDelete
  34. Open an image and choose File > Save For Web. Choose JPEG from the optimization format menu. Well thanks for sharing this amazing steps by the way. Get more info here
    https://www.treeservicemviejo.com/

    ReplyDelete
  35. Thank you for sharing this amazing 11 steps, It is so helpful and informative. See more about Tree Service Orange County

    ReplyDelete
  36. Thank you for sharing this amazing steps. It gives us a wonderful information and knowledge. View more about the best Basement Remodel Spokane

    ReplyDelete
  37. Thank you for sharing this amazing 11 steps to optimize JPEG. It is very informative. check us out here

    ReplyDelete
  38. Very nice and informative blog you have share I like your work.

    Crowd with cowboy headgear

    ReplyDelete
  39. Thank you for sharing this very informative content. Your work is excellent. Please continue. I am sharing with you the following interesting profile with you click speed test. Find out how fast you can click using the clicking technique developed by Minecraft players.

    ReplyDelete
  40. สล็อตโปร100 ถอนไม่อั้น สามารถเข้าเล่นได้ตลอด 24 ชั่วโมง ฝาก ถอนเงินรวดเร็วด้วยระบบออโต้ที่ทันสมัยมากที่สุด กับเว็บสล็อตออนไลน์ที่มาแรงที่สุดในตอนนี้ อย่าง เกมสล็อต ค่าย pg

    ReplyDelete
  41. Clairvoyant firm by hone in https://www.voyante-bordeaux.com voyante

    ReplyDelete
  42. commercial cleaning service garland Garland cleaning services for your residential or commercial house cleaning.

    ReplyDelete
  43. Albany Tow Truck is happy to service the greater Albany, Schenectady and Troy with our full fleet of tow and roadside assistance vehicles. We are proud of our safe work place.
    visit us

    ReplyDelete
  44. Nova Cash For Junk Cars began as a small family business in North Virginia. We want our customers to feel that they can recommend us to their family and friends.

    learn more about Nova Cash For Junk Cars

    ReplyDelete
  45. We here at Abingdon Tow Truck have taken this negative connotation of our business and flipped it on its head.
    learn more about Abingdon Tow Truck

    ReplyDelete
  46. Fredericksburg Towing Service is a full service towing, rescue, and recovery business serving the city of Fredericksburg and all of the surrounding areas of Virginia.
    contact us

    ReplyDelete
  47. here in Hialeah Tow Truck, we have been proud to service Hialeah, FL and the surrounding area for years.
    contact us

    ReplyDelete
  48. I find your content an interesting one.
    Towing Service Delray Beach FL is the premier towing company serving Delray Beach, FL and the surrounding region.

    ReplyDelete
  49. The team at Towing Service Independence MO are proud to serve a large service area.

    ReplyDelete
  50. Towing Service West Palm Beach FL have been working hard to establish our brand within the lower Florida area.

    ReplyDelete
  51. Lawn Care Fredericksburg VA has been dedicated to enhancing appearance of Virginia homes for years.

    ReplyDelete
  52. Towing Service Deltona FL is a family-owned and operated towing company. We offer emergency towing service and complete roadside assistance to Deltona and the surrounding towns of Deland and Sanford Florida.

    ReplyDelete
  53. equipment transport Manassas VA is a local service that you can trust to get your large valuable assets to where they need to be.

    ReplyDelete
  54. At Towing Service Blue Springs, MO, we put the comfort of our clients first. In a bid to make our superior towing service available to the whole of Missouri, we decided to have our tow trucks around the state. Therefore, you can call us if you’re anywhere around Blue Springs, MO, Independence, MO, Sugar Creek, MO, Lee’s Summit, MO, and Buckner, MO.

    ReplyDelete
  55. This comment has been removed by the author.

    ReplyDelete
  56. You can also use free online tools online that allow you to optimize jpeg. My colleagues and I at Grande Prairie Massage often use them. Simply search "optimize jpeg" on Google.

    ReplyDelete
  57. Thank you for sharing this pretty cool post!
    find us

    ReplyDelete
  58. Thanks for the share. This is interesting post! www.appliancekitchener.com

    ReplyDelete
  59. Thank you for this post. Found it very informative.
    Drywall

    ReplyDelete
  60. Boca Raton Tow Truck offer all the services that you would expect from a high quality towing company.

    ReplyDelete
  61. ครบวงจรสล็อตออนไลน์ เล่นง่าย รวยได้ในวันพักผ่อนแบบสบายๆ พร้อมกิจกรรมโปรโมชั่นแบบสุดคุ้มที่สุด ที่นี่เลย https://www.megagame.ltd/

    ReplyDelete
  62. This is awesome! Glad to see your post. Keep sharing please! Thanks. Insulation Contractor Coquitlam BC

    ReplyDelete
  63. This comment has been removed by the author.

    ReplyDelete
  64. Great! Thank you for taking the time to publish this information very useful!
    click here

    ReplyDelete
  65. Great article with an excellent idea. Thank you!
    chimney repair worcester ma

    ReplyDelete
  66. Nice post! Thanks for this great information you shared here.
    boston private jet charter

    ReplyDelete
  67. This is awesome! Glad to see your post. Keep sharing please! Thanks.
    business coaching services arkansas

    ReplyDelete
  68. Nice job for publishing such a beneficial web site. Thank you!
    Local Roofing Companies

    ReplyDelete
  69. Thank you for sharing this pretty cool post!
    junk car removal ma

    ReplyDelete
  70. Great! Thank you for taking the time to share this extremely important information! | Click here

    ReplyDelete
  71. Looking forward to seeing more great blog posts here.
    arkansas business consultant

    ReplyDelete
  72. Great! This statement is very powerful! Thanks a lot.
    Insulation Victoria BC

    ReplyDelete
  73. You've mentioned all your reader needs to know. Thank you!
    https://www.sidingrichmondbc.com

    ReplyDelete
  74. Appreciating the persistence you put into your blog and the detailed information you provide.
    wood fence installation framingham ma

    ReplyDelete
  75. This is a very excellent read, Thanks for this amazing article!
    fitness trainers boston

    ReplyDelete
  76. Such a very interesting topic, thank you so much for this!
    boston iron works

    ReplyDelete
  77. Hey there!!! I was looking for this info around the web and finally found it. Thanks.
    Pressure Washing Services

    ReplyDelete
  78. I admire this post for the well-researched. Thanks a lot. Concrete Contractor Companies

    ReplyDelete
  79. Great information, It worked like a charm! Keep it up
    Drywall Contractor Clarksville TN

    ReplyDelete
  80. I am glad seeing this nice website.
    visit us

    ReplyDelete
  81. Nice! I really enjoy the article post. Much thanks again.
    power washing fayetteville ar

    ReplyDelete
  82. Looking forward to seeing more great blog posts here. https://www.insulationcoquitlam.com

    ReplyDelete
  83. It is truly a well-researched content and excellent wording. my site

    ReplyDelete
  84. Thanks for sharing this information to increase our knowledge. Looking forward for more on your site. Contractor Services

    ReplyDelete
  85. You have given us very important info! Thanks a lot.
    www.roofinghalifax.ca

    ReplyDelete
  86. Really nice and interesting post. I was looking for this kind of information and enjoyed reading this one. website

    ReplyDelete
  87. Your Article is so good and informative thanks for sharing this content Concrete Services Oakville

    ReplyDelete
  88. Wow !!! It’s amazing
    play game for relax and win get money
    PG Slot

    ReplyDelete
  89. ใครที่กำลังมองหาอาชีพเสริมแตกไม่รู้จะทำอะไร เราขอแนะนำ เว็บสล็อต ออนไลน์ คัดสรรเว็บที่ดีที่สุดมาให้ทุกคนได้รับชม พร้อมแจกเครดิตฟรีแบบปังๆ ถือว่าเป็นเว็บบริษัทยักต์ใหญ่ เป็นรายได้เสริมที่คุ้มค่ามาก ยิ่งเล่น ยิ่งได้ ปั่นไงสุดคุ้ม เอาแบบคนรวยด้วยทางลัดนี้มากมายหลายคนแล้ว พร้อมสนุกไปกลับเรา สล็อตเว็บตรง2022


    เว็บสล็อต แตกง่าย 2021 ฝากถอน ไม่มี ขั้นต่ำ ที่เติมเงินผ่านเลขโทรศัพท์ เติมเงินทรูวอเลท ยืนยันเบอร์ก็สามารถเป็นส่วนหนึ่งในเว็บนอกจากนี้ ทำให้คนที่เข้ามาเล่นมีความประทับใจมากโดยการแค่ หมุนวงล้อก็สามารถทำเงินทำกำไร หรือบางคนก็สร้างอาชีพ จากการเล่นเกมออนไลน์นี้ได้เลย ประสบการณ์ที่คุณได้รับคือ ความสุข สนุกกับการเล่น ใช้เวลาให้เป็นประโยชน์ เพลิดเพลินไปกับสิ่งที่ชอบ กับเงินที่มีมหาศาลที่คุณจะได้รับ
    สล็อตเว็บตรงแตกง่าย


    แหล่งรวบรวมเกมสล็อต และเว็บพนันออนไลน์ สำหรับคนยุคใหม่ เป็นเว็บสล็อตที่ภาพสวยที่สุด ชั่วโมงนี้และเป็นสล็อตแนวใหม่ ให้ลูกค้ามีความตื่นเต้นและสนุกไปกับการผ่านด่าน มีเกมหลากหลายต่างๆแนวใหม่ที่ทันสมัย รวมสล็อตเว็บตรง


    เป็นเว็บสล็อตที่เป็นตำนาน ง่ายแสนง่ายเป็นเว็บที่เล่นแล้วโบนัสแตกบ่อย ด้วยเว็บไซต์ ที่ไม่ต้องดาวโหลด์ ให้เปลืองพื้นที่มือถือ มีบริการอย่างรวดเร็ว ลื่นไหลแบบไม่มีสะดุดไม่ว่าเวลาไหนก็สามารถเข้าเล่น ถือเป็นเว็บที่แตกง่าย สล็อตเว็บตรง


    บริการสล็อตออนไลน์ ผ่านการเติมเงินช่องทาง True Wallet ที่กำลังมาแรงสามารถถอนาเงินใน บัญชีทรูวอเลทเข้าบัญชีธนาคารของผู้ที่เล่นได้แบบไม่มีขีดจำกัด ไม่มีขั้นต่ำ มีเงินเล่นเบท 1 บาทก็เล่นได้ เล่นได้24 ชั่วโมง สล็อตเว็บตรงเครดิตฟรี


    ReplyDelete
  90. Fantastic! Thank you, I've recently been looking for information about this topic https://www.contractormilton.com

    ReplyDelete
  91. Nice! I really enjoy the article post. Much thanks again. Appliance Pros of Kitchener

    ReplyDelete
  92. When examining an asphalt-shingled roof, look for loose, broken or cracked shingles. Look for any bubbling or blistering in a shingle, as that indicates moisture has made its way to the interior of the shingle. Look for the best익산콜걸샵추천
    익산콜걸샵추천
    전주콜걸샵추천
    전주콜걸샵추천
    양산콜걸샵추천
    양산콜걸샵추천

    ReplyDelete
  93. This site is interesting and indeed, very helpful. Thanks for sharing this! https://www.contractorlethbridge.com

    ReplyDelete
  94. big! Thank you for taking the time to share this very important information. check gst203 past question in pdf format

    ReplyDelete
  95. This site is interesting and indeed, very helpful. Thanks for sharing this! Personal Training

    ReplyDelete
  96. Thanks for fantastic information I was looking for this information for my mission.
    play game for relax and win get money
    PG SLOT

    ReplyDelete