{"id":173,"date":"2024-09-08T12:17:17","date_gmt":"2024-09-08T16:17:17","guid":{"rendered":"\/blog\/?p=173"},"modified":"2026-04-11T20:32:06","modified_gmt":"2026-04-12T00:32:06","slug":"how-to-compress-a-png-file-to-100-kb-in-linux","status":"publish","type":"post","link":"\/blog\/how-to-compress-a-png-file-to-100-kb-in-linux","title":{"rendered":"How to compress a PNG file to 100 KB in Linux?"},"content":{"rendered":"\n<p>To compress a PNG file to less than 100 KB in Linux, you can use tools like <code>pngquant<\/code> or <code>optipng<\/code>, which are designed to reduce the file size of PNG images without significant loss of quality. Here&#8217;s how you can use these tools:<\/p>\n\n\n\n<p>Before we begin, we want to let you know you can use <a href=\"https:\/\/www.xconvert.com\/compress-png\">https:\/\/www.xconvert.com\/compress-png<\/a> to compress your PNG to 100KB online. You can choose <code>Autoscale<\/code> feature to keep the quality high while reducing file size to less than 100KB.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1. <strong>Using <code>pngquant<\/code><\/strong><\/h3>\n\n\n\n<p><code>pngquant<\/code> is a popular lossy PNG compressor that reduces the number of colors in the image, resulting in a smaller file size.<\/p>\n\n\n\n<p><strong>Install <code>pngquant<\/code>:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash line-numbers\">sudo apt-get install pngquant  # For Debian\/Ubuntu\nsudo dnf install pngquant      # For Fedora\nsudo yum install pngquant      # For CentOS\/RHEL<\/code><\/pre>\n\n\n\n<p><strong>Compress the PNG file:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">pngquant --quality=65-80 --ext .png --force your-image.png<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>--quality=65-80<\/code>: Sets the quality range (from 65 to 80) for the compression. Lower values will reduce file size more but may also reduce quality.<\/li>\n\n\n\n<li><code>--ext .png<\/code>: Specifies the output file extension (overwrite the original file).<\/li>\n\n\n\n<li><code>--force<\/code>: Overwrites the original file if needed.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">2. <strong>Using <code>optipng<\/code><\/strong><\/h3>\n\n\n\n<p><code>optipng<\/code> is another tool that performs lossless compression, which reduces file size without losing any image quality.<\/p>\n\n\n\n<p><strong>Install <code>optipng<\/code>:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash line-numbers\">sudo apt-get install optipng   # For Debian\/Ubuntu\nsudo dnf install optipng       # For Fedora\nsudo yum install optipng       # For CentOS\/RHEL<\/code><\/pre>\n\n\n\n<p><strong>Compress the PNG file:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">optipng -o7 your-image.png<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>-o7<\/code>: Sets the optimization level to 7 (maximum). Higher optimization levels take longer but usually yield smaller file sizes.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">3. <strong>Using <code>convert<\/code> from ImageMagick<\/strong><\/h3>\n\n\n\n<p>If you already have ImageMagick installed, you can also use the <code>convert<\/code> command to compress the image.<\/p>\n\n\n\n<p><strong>Install ImageMagick:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash line-numbers\">sudo apt-get install imagemagick   # For Debian\/Ubuntu\nsudo dnf install imagemagick       # For Fedora\nsudo yum install imagemagick       # For CentOS\/RHEL<\/code><\/pre>\n\n\n\n<p><strong>Compress the PNG file:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">convert your-image.png -quality 80 -resize 800x800 compressed-image.png<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>-quality 80<\/code>: Adjusts the quality of the output image (you can reduce this number further to lower the file size).<\/li>\n\n\n\n<li><code>-resize 800x800<\/code>: Resizes the image to a maximum of 800&#215;800 pixels (optional, if the image is very large).<\/li>\n<\/ul>\n\n\n\n<p>While Linux command-line tools are excellent for quick batch processing, those looking for more advanced generative features and automated retouching might prefer using <a href=\"https:\/\/fixthephoto.com\/photoshop-ai.html\" target=\"_blank\" rel=\"noreferrer noopener\">Photoshop AI<\/a> to optimize their visuals before exporting them for the web.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">4. <strong>Check the File Size<\/strong><\/h3>\n\n\n\n<p>After compressing the file, you can check its size to ensure it is under 100 KB:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">ls -lh compressed-image.png<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Tips:<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>If the file is still not under 100 KB, you may need to reduce the quality further or resize the image to a smaller dimension.<\/li>\n<\/ul>\n\n\n\n<p>Featured photo by <a href=\"https:\/\/unsplash.com\/@mattmoloney?utm_content=creditCopyText&amp;utm_medium=referral&amp;utm_source=unsplash\">Matthew Moloney<\/a> on <a href=\"https:\/\/unsplash.com\/photos\/black-and-white-abstract-painting-mI6_0b9EUlE?utm_content=creditCopyText&amp;utm_medium=referral&amp;utm_source=unsplash\">Unsplash<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>To compress a PNG file to less than 100 KB in Linux, you can use tools like pngquant or optipng, which are designed to reduce the file size of PNG images without significant loss of quality. Here&#8217;s how you can use these tools: Before we begin, we want to let you know you can use [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":177,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,4],"tags":[8,6,7],"class_list":["post-173","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-how-to-guides","category-tutorial","tag-file-compress","tag-image-comptess","tag-png-compress"],"_links":{"self":[{"href":"\/blog\/wp-json\/wp\/v2\/posts\/173","targetHints":{"allow":["GET"]}}],"collection":[{"href":"\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"\/blog\/wp-json\/wp\/v2\/comments?post=173"}],"version-history":[{"count":5,"href":"\/blog\/wp-json\/wp\/v2\/posts\/173\/revisions"}],"predecessor-version":[{"id":336,"href":"\/blog\/wp-json\/wp\/v2\/posts\/173\/revisions\/336"}],"wp:featuredmedia":[{"embeddable":true,"href":"\/blog\/wp-json\/wp\/v2\/media\/177"}],"wp:attachment":[{"href":"\/blog\/wp-json\/wp\/v2\/media?parent=173"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"\/blog\/wp-json\/wp\/v2\/categories?post=173"},{"taxonomy":"post_tag","embeddable":true,"href":"\/blog\/wp-json\/wp\/v2\/tags?post=173"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}