{"id":3175,"date":"2020-05-30T23:00:00","date_gmt":"2020-05-30T17:30:00","guid":{"rendered":"https:\/\/www.24x7serversupport.com\/blog\/?p=3175"},"modified":"2023-01-26T17:55:53","modified_gmt":"2023-01-26T12:25:53","slug":"how-to-install-mozjpeg","status":"publish","type":"post","link":"https:\/\/www.24x7serversupport.com\/blog\/how-to-install-mozjpeg\/","title":{"rendered":"How to Install mozjpeg"},"content":{"rendered":"\n<p>Mozilla announced their \u2018mozjpeg\u2019 project with the aim of improving lossless jpeg compression and making the web a faster place. Forked from libjpeg-turbo, mozjpeg is more concerned with reducing filesize than doing it quickly. It uses the same compression process written in a perl script by Loren Merritt called <code>jpegcrush<\/code> and claims to be able to reduce jpeg size by 10% on average.<\/p>\n\n\n\n<p>So, it sounds pretty good and you want to save some bandwidth and give mozjpeg a go. With a lack of an auto-install option using a repository like APT you will need to build it from source which sounds complicated but is actually pretty easy as I show.<\/p>\n\n\n\n<p>Full build instructions can be found in the build instructions file in the github repo. These are very comprehensive and cover all \u201cUn*x Platforms (including Cygwin and OS X)\u201d. This guide aims to simplify the process by giving step by step guide for building on Ubuntu 12.04 (and should be portable for other versions of Ubuntu and probably other flavours of Linux as well with a some minor changes).<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"download-source\">Download Source<\/h2>\n\n\n\n<p>First you need to download the source.<\/p>\n\n\n\n<p>You can either use a release version which should be stable and ready for production use from the list of release archives and download the latest version and extract it (v1.0.1 is the latest version at time of writing):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>wget https:\/\/github.com\/mozilla\/mozjpeg\/archive\/v1.0.1.tar.gz\ntar -xvf v1.0.1.tar.gz<\/code><\/pre>\n\n\n\n<p>Alternatively, if you want the latest cutting edge version you can clone the github repository directly:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt-get install git\ngit clone https:\/\/github.com\/mozilla\/mozjpeg.git<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"install-requirements\">Install Requirements<\/h2>\n\n\n\n<p>Building mozjpeg requires the following programs to be installed:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>autoconf 2.56 or later<\/li>\n\n\n\n<li>automake 1.7 or later<\/li>\n\n\n\n<li>libtool 1.4 or later<\/li>\n\n\n\n<li>NASM 0.98 or later<\/li>\n\n\n\n<li>make<\/li>\n<\/ul>\n\n\n\n<p>You can go ahead and install them like so:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt-get install autoconf automake libtool nasm make<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"building\">Building<\/h2>\n\n\n\n<p>Once the source has been downloaded and extracted, navigate to the extracted contents directory. Next running <code>autoreconf<\/code> will to build the configure file. Then create a <code>build<\/code> directory inside the source and navigate to it. Once in the build directory, run <code>configure<\/code> which will generate the Makefile which is used to install the final program using <code>make install<\/code> and is run as <code>sudo<\/code> so it has permission to put the installation in \/opt.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cd mozjpeg-1.0.1\nautoreconf -fiv\nmkdir build &amp;&amp; cd build\nsh ..\/configure\nsudo make install<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"usage\">Usage<\/h2>\n\n\n\n<p>Following the above instructions will install mozjpeg in <code>\/opt\/libmozjpeg<\/code> and it can be used by calling <code>jpegtran<\/code> in the bin directory:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/opt\/libmozjpeg\/bin\/jpegtran -copy none image.jpg &gt; compressed.jpg<\/code><\/pre>\n\n\n\n<p>However, I find it easier to add the command to my local path so it can be accessed anywhere. Also, as it shares it\u2019s namings with <code>libjpeg-turbo, renaming it to something like <\/code>mozjpeg<code> makes it more <\/code>convenient to use and remember, especially if you already have <code>libjpeg-turbo<\/code> installed:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo ln -s \/opt\/libmozjpeg\/bin\/jpegtran \/usr\/local\/bin\/mozjpeg<\/code><\/pre>\n\n\n\n<p>After adding this link you can use mozjpeg from anywhere easily and conveniently:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mozjpeg -copy none image.jpg &gt; compressed.jpg<\/code><\/pre>\n\n\n\n<p>And there you have it, mozjpeg installed on your system ready to save you bandwidth and speed up your website!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Mozilla announced their \u2018mozjpeg\u2019 project with the aim of improving lossless jpeg compression and making the web a faster place. Forked from libjpeg-turbo, mozjpeg is more concerned with reducing filesize than doing it quickly. It uses the same compression process written in a perl script by Loren Merritt called jpegcrush and claims to be able [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":3573,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false}}},"categories":[30,38,33],"tags":[328,329],"class_list":["post-3175","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-centos","category-cloudlinux","category-cpanel","tag-jpeg","tag-mozjpeg"],"jetpack_publicize_connections":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to Install mozjpeg | 24x7serversupport Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.24x7serversupport.com\/blog\/how-to-install-mozjpeg\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Install mozjpeg | 24x7serversupport Blog\" \/>\n<meta property=\"og:description\" content=\"Mozilla announced their \u2018mozjpeg\u2019 project with the aim of improving lossless jpeg compression and making the web a faster place. Forked from libjpeg-turbo, mozjpeg is more concerned with reducing filesize than doing it quickly. It uses the same compression process written in a perl script by Loren Merritt called jpegcrush and claims to be able [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.24x7serversupport.com\/blog\/how-to-install-mozjpeg\/\" \/>\n<meta property=\"og:site_name\" content=\"24x7serversupport Blog\" \/>\n<meta property=\"article:published_time\" content=\"2020-05-30T17:30:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-01-26T12:25:53+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.24x7serversupport.com\/blog\/wp-content\/uploads\/2020\/05\/mozjpeg.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1024\" \/>\n\t<meta property=\"og:image:height\" content=\"512\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"24x7support\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@24x7serversuppo\" \/>\n<meta name=\"twitter:site\" content=\"@24x7serversuppo\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"24x7support\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.24x7serversupport.com\/blog\/how-to-install-mozjpeg\/\",\"url\":\"https:\/\/www.24x7serversupport.com\/blog\/how-to-install-mozjpeg\/\",\"name\":\"How to Install mozjpeg | 24x7serversupport Blog\",\"isPartOf\":{\"@id\":\"https:\/\/www.24x7serversupport.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.24x7serversupport.com\/blog\/how-to-install-mozjpeg\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.24x7serversupport.com\/blog\/how-to-install-mozjpeg\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/i0.wp.com\/www.24x7serversupport.com\/blog\/wp-content\/uploads\/2020\/05\/mozjpeg.png?fit=1024%2C512&ssl=1\",\"datePublished\":\"2020-05-30T17:30:00+00:00\",\"dateModified\":\"2023-01-26T12:25:53+00:00\",\"author\":{\"@id\":\"https:\/\/www.24x7serversupport.com\/blog\/#\/schema\/person\/decfb5fad6bde6ac6822d4e965c6d401\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.24x7serversupport.com\/blog\/how-to-install-mozjpeg\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.24x7serversupport.com\/blog\/how-to-install-mozjpeg\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.24x7serversupport.com\/blog\/how-to-install-mozjpeg\/#primaryimage\",\"url\":\"https:\/\/i0.wp.com\/www.24x7serversupport.com\/blog\/wp-content\/uploads\/2020\/05\/mozjpeg.png?fit=1024%2C512&ssl=1\",\"contentUrl\":\"https:\/\/i0.wp.com\/www.24x7serversupport.com\/blog\/wp-content\/uploads\/2020\/05\/mozjpeg.png?fit=1024%2C512&ssl=1\",\"width\":1024,\"height\":512,\"caption\":\"How to Install mozjpeg\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.24x7serversupport.com\/blog\/how-to-install-mozjpeg\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.24x7serversupport.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Install mozjpeg\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.24x7serversupport.com\/blog\/#website\",\"url\":\"https:\/\/www.24x7serversupport.com\/blog\/\",\"name\":\"24x7serversupport Blog\",\"description\":\"Linux | CPanel | WHM | webhosting| Plesk | DirectAdmin | CentOs | Debian | Ubuntu Blog\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.24x7serversupport.com\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.24x7serversupport.com\/blog\/#\/schema\/person\/decfb5fad6bde6ac6822d4e965c6d401\",\"name\":\"24x7support\",\"url\":\"https:\/\/www.24x7serversupport.com\/blog\/author\/24x7support\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Install mozjpeg | 24x7serversupport Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.24x7serversupport.com\/blog\/how-to-install-mozjpeg\/","og_locale":"en_US","og_type":"article","og_title":"How to Install mozjpeg | 24x7serversupport Blog","og_description":"Mozilla announced their \u2018mozjpeg\u2019 project with the aim of improving lossless jpeg compression and making the web a faster place. Forked from libjpeg-turbo, mozjpeg is more concerned with reducing filesize than doing it quickly. It uses the same compression process written in a perl script by Loren Merritt called jpegcrush and claims to be able [&hellip;]","og_url":"https:\/\/www.24x7serversupport.com\/blog\/how-to-install-mozjpeg\/","og_site_name":"24x7serversupport Blog","article_published_time":"2020-05-30T17:30:00+00:00","article_modified_time":"2023-01-26T12:25:53+00:00","og_image":[{"width":1024,"height":512,"url":"https:\/\/www.24x7serversupport.com\/blog\/wp-content\/uploads\/2020\/05\/mozjpeg.png","type":"image\/png"}],"author":"24x7support","twitter_card":"summary_large_image","twitter_creator":"@24x7serversuppo","twitter_site":"@24x7serversuppo","twitter_misc":{"Written by":"24x7support","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.24x7serversupport.com\/blog\/how-to-install-mozjpeg\/","url":"https:\/\/www.24x7serversupport.com\/blog\/how-to-install-mozjpeg\/","name":"How to Install mozjpeg | 24x7serversupport Blog","isPartOf":{"@id":"https:\/\/www.24x7serversupport.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.24x7serversupport.com\/blog\/how-to-install-mozjpeg\/#primaryimage"},"image":{"@id":"https:\/\/www.24x7serversupport.com\/blog\/how-to-install-mozjpeg\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/www.24x7serversupport.com\/blog\/wp-content\/uploads\/2020\/05\/mozjpeg.png?fit=1024%2C512&ssl=1","datePublished":"2020-05-30T17:30:00+00:00","dateModified":"2023-01-26T12:25:53+00:00","author":{"@id":"https:\/\/www.24x7serversupport.com\/blog\/#\/schema\/person\/decfb5fad6bde6ac6822d4e965c6d401"},"breadcrumb":{"@id":"https:\/\/www.24x7serversupport.com\/blog\/how-to-install-mozjpeg\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.24x7serversupport.com\/blog\/how-to-install-mozjpeg\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.24x7serversupport.com\/blog\/how-to-install-mozjpeg\/#primaryimage","url":"https:\/\/i0.wp.com\/www.24x7serversupport.com\/blog\/wp-content\/uploads\/2020\/05\/mozjpeg.png?fit=1024%2C512&ssl=1","contentUrl":"https:\/\/i0.wp.com\/www.24x7serversupport.com\/blog\/wp-content\/uploads\/2020\/05\/mozjpeg.png?fit=1024%2C512&ssl=1","width":1024,"height":512,"caption":"How to Install mozjpeg"},{"@type":"BreadcrumbList","@id":"https:\/\/www.24x7serversupport.com\/blog\/how-to-install-mozjpeg\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.24x7serversupport.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to Install mozjpeg"}]},{"@type":"WebSite","@id":"https:\/\/www.24x7serversupport.com\/blog\/#website","url":"https:\/\/www.24x7serversupport.com\/blog\/","name":"24x7serversupport Blog","description":"Linux | CPanel | WHM | webhosting| Plesk | DirectAdmin | CentOs | Debian | Ubuntu Blog","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.24x7serversupport.com\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.24x7serversupport.com\/blog\/#\/schema\/person\/decfb5fad6bde6ac6822d4e965c6d401","name":"24x7support","url":"https:\/\/www.24x7serversupport.com\/blog\/author\/24x7support\/"}]}},"jetpack_featured_media_url":"https:\/\/i0.wp.com\/www.24x7serversupport.com\/blog\/wp-content\/uploads\/2020\/05\/mozjpeg.png?fit=1024%2C512&ssl=1","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/www.24x7serversupport.com\/blog\/wp-json\/wp\/v2\/posts\/3175","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.24x7serversupport.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.24x7serversupport.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.24x7serversupport.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.24x7serversupport.com\/blog\/wp-json\/wp\/v2\/comments?post=3175"}],"version-history":[{"count":2,"href":"https:\/\/www.24x7serversupport.com\/blog\/wp-json\/wp\/v2\/posts\/3175\/revisions"}],"predecessor-version":[{"id":3574,"href":"https:\/\/www.24x7serversupport.com\/blog\/wp-json\/wp\/v2\/posts\/3175\/revisions\/3574"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.24x7serversupport.com\/blog\/wp-json\/wp\/v2\/media\/3573"}],"wp:attachment":[{"href":"https:\/\/www.24x7serversupport.com\/blog\/wp-json\/wp\/v2\/media?parent=3175"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.24x7serversupport.com\/blog\/wp-json\/wp\/v2\/categories?post=3175"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.24x7serversupport.com\/blog\/wp-json\/wp\/v2\/tags?post=3175"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}