{"id":70,"date":"2026-11-25T03:46:23","date_gmt":"2026-11-25T03:46:23","guid":{"rendered":"https:\/\/sushiljoshi.in\/?p=70"},"modified":"2026-11-25T03:47:08","modified_gmt":"2026-11-25T03:47:08","slug":"resize-image-to-20kb","status":"publish","type":"post","link":"https:\/\/sushiljoshi.in\/index.php\/2026\/11\/25\/resize-image-to-20kb\/","title":{"rendered":"Resize image to 20kb"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<meta charset=\"UTF-8\">\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n    <title>Resize Image Online<\/title>\n    <style>\n        body {\n            font-family: Arial, sans-serif;\n            background-color: #f4f4f4;\n            margin: 0;\n            padding: 0;\n        }\n        .container {\n            max-width: 800px;\n            margin: 50px auto;\n            padding: 20px;\n            background-color: #fff;\n            border-radius: 10px;\n            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);\n        }\n        .input-container {\n            margin-bottom: 20px;\n        }\n        .input-container input[type=\"file\"] {\n            width: 100%;\n            padding: 10px;\n            font-size: 16px;\n        }\n        .input-container input[type=\"number\"] {\n            width: 100%;\n            padding: 10px;\n            font-size: 16px;\n            margin-top: 10px;\n        }\n        .resize-button {\n            padding: 15px 30px;\n            font-size: 16px;\n            background-color: #ff4d4d;\n            color: white;\n            border: none;\n            border-radius: 5px;\n            cursor: pointer;\n            width: 100%;\n            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);\n            transition: all 0.3s ease;\n        }\n        .resize-button:hover {\n            background-color: #ff1a1a;\n        }\n        .image-preview {\n            margin-top: 20px;\n            display: none;\n            text-align: center;\n        }\n        .image-preview img {\n            max-width: 100%;\n            max-height: 400px;\n            border-radius: 10px;\n        }\n        .download-button {\n            margin-top: 20px;\n            padding: 12px 30px;\n            font-size: 16px;\n            background-color: #28a745;\n            color: white;\n            border: none;\n            border-radius: 5px;\n            cursor: pointer;\n            width: 100%;\n            transition: all 0.3s ease;\n        }\n        .download-button:hover {\n            background-color: #218838;\n        }\n        .download-button:disabled {\n            background-color: #d6d6d6;\n            cursor: not-allowed;\n        }\n    <\/style>\n\n\n    <div class=\"container\">\n        <h1>Resize image to 20kb<\/h1>\n        <div class=\"input-container\">\n            <label for=\"image\">Upload an image:<\/label>\n            <input type=\"file\" id=\"image\" accept=\"image\/*\">\n        <\/div>\n        <div class=\"input-container\">\n            <label for=\"target-size\">Target File Size (KB):<\/label>\n            <input type=\"number\" id=\"target-size\" placeholder=\"Enter target size in KB\">\n        <\/div>\n        <button class=\"resize-button\" id=\"resize-button\">Resize Image<\/button>\n        <div class=\"image-preview\" id=\"image-preview\">\n            <h3>Preview of Resized Image<\/h3>\n            <img decoding=\"async\" id=\"preview-img\" src=\"\" alt=\"Resized Image\">\n            <a class=\"download-button\" id=\"download-button\" href=\"#\" download=\"resized_image.jpg\" style=\"pointer-events: none;\">Download Resized Image<\/a>\n        <\/div>\n    <\/div>\n\n    <script>\n        function resizeImage(file, quality, maxWidth = 800) {\n            return new Promise((resolve, reject) => {\n                const reader = new FileReader();\n                reader.onload = (event) => {\n                    const img = new Image();\n                    img.onload = () => {\n                        \/\/ Calculate new dimensions based on maxWidth\n                        const canvas = document.createElement(\"canvas\");\n                        const ctx = canvas.getContext(\"2d\");\n                        const scaleFactor = maxWidth \/ img.width;\n                        const newWidth = maxWidth;\n                        const newHeight = img.height * scaleFactor;\n                        \n                        canvas.width = newWidth;\n                        canvas.height = newHeight;\n                        \n                        ctx.drawImage(img, 0, 0, newWidth, newHeight);\n                        \n                        \/\/ Convert the resized image to a blob with a specific quality\n                        canvas.toBlob((blob) => {\n                            resolve(blob);\n                        }, 'image\/jpeg', quality);\n                    };\n                    img.src = event.target.result;\n                };\n                reader.readAsDataURL(file);\n            });\n        }\n\n        document.getElementById(\"resize-button\").addEventListener(\"click\", function() {\n            const fileInput = document.getElementById(\"image\");\n            const targetSizeInput = document.getElementById(\"target-size\");\n            const imagePreview = document.getElementById(\"image-preview\");\n            const previewImg = document.getElementById(\"preview-img\");\n            const downloadButton = document.getElementById(\"download-button\");\n\n            const file = fileInput.files[0];\n            const targetSize = parseInt(targetSizeInput.value);\n\n            if (!file || isNaN(targetSize)) {\n                alert(\"Please upload an image and specify a target file size.\");\n                return;\n            }\n\n            \/\/ Adjust image quality to try and meet target file size\n            let quality = 0.9; \/\/ Start with high quality\n            let resizedImageBlob;\n\n            function tryResize(quality) {\n                return resizeImage(file, quality).then((blob) => {\n                    if (blob.size \/ 1024 > targetSize && quality > 0.1) {\n                        \/\/ If the image size is greater than the target size, reduce quality and try again\n                        return tryResize(quality - 0.05); \/\/ Reduce quality by 5%\n                    } else {\n                        return blob; \/\/ Return the resized blob if within target size\n                    }\n                });\n            }\n\n            \/\/ Resize the image and get a resized blob\n            tryResize(quality).then((blob) => {\n                resizedImageBlob = blob;\n\n                \/\/ Create a URL for the resized image blob\n                const resizedImageUrl = URL.createObjectURL(resizedImageBlob);\n                previewImg.src = resizedImageUrl;\n                imagePreview.style.display = 'block';\n\n                \/\/ Enable download button and set the download link\n                downloadButton.href = resizedImageUrl;\n                downloadButton.style.pointerEvents = 'auto'; \/\/ Enable the button\n            }).catch((error) => {\n                console.error('Error resizing image:', error);\n                alert('There was an error resizing the image.');\n            });\n        });\n    <\/script>\n\n\n\n<h2 class=\"wp-block-heading has-text-color has-link-color wp-elements-1\" style=\"color:#000000\"><strong>Compressor to 20KB Online Free<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Need to&nbsp;<strong>compress image to 20KB online free<\/strong>? Our tool lets you reduce your photo to 20 KB for online forms, exams, or social media. Upload your photo and compress to get a 20KB image instantly.<\/p>\n\n\n\n<h3 class=\"wp-block-heading has-text-color has-link-color wp-elements-2\" style=\"color:#000000\"><strong>Why Compress Image or Photo to 20KB?<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Meet strict upload limits for online forms and applications.<\/li>\n\n\n\n<li>Faster uploads and sharing on email, WhatsApp, or websites.<\/li>\n\n\n\n<li>Save storage space on your device or cloud.<\/li>\n\n\n\n<li>Ensure compatibility with government and exam portals<a href=\"https:\/\/sushiljoshi.in\">.<\/a><\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading has-text-color has-link-color wp-elements-3\" style=\"color:#000000\"><strong>How to Use the 20KB Image Compressor<\/strong><\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Click the upload placeholder or drag and drop your photo file.<\/li>\n\n\n\n<li>Wait for the compression to finish.<\/li>\n\n\n\n<li>Download your optimized photo instantly.<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading has-text-color has-link-color wp-elements-4\" style=\"color:#000000\"><strong>Is My Photo Safe?<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Your privacy is important. All processing to&nbsp;<strong>compress image to 20KB online free<\/strong>&nbsp;happens directly in your browser. Your photo never leaves your device, ensuring complete security and confidentiality.<\/p>\n\n\n\n<h3 class=\"wp-block-heading has-text-color has-link-color wp-elements-5\" style=\"color:#000000\"><strong>Supported Formats<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>JPG\/JPEG<\/li>\n\n\n\n<li>PNG<\/li>\n\n\n\n<li>WebP<\/li>\n\n\n\n<li>GIF<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading has-text-color has-link-color wp-elements-6\" style=\"color:#000000\"><strong>Frequently Asked Questions<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Is this tool really free?<\/strong>&nbsp;Yes, you can&nbsp;<strong>compress image to 20KB online free<\/strong>&nbsp;with no registration or watermark.<\/li>\n\n\n\n<li><strong>Can I compress multiple photos?<\/strong>&nbsp;Absolutely! Use the tool as many times as you need.<\/li>\n\n\n\n<li><strong>Will my photo quality be preserved?<\/strong>&nbsp;Our smart compression ensures your&nbsp;<strong>20KB photo<\/strong>&nbsp;remains clear and sharp.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Whether you need to&nbsp;<strong>compress image to 20KB online free<\/strong>&nbsp;for a passport, exam, or website, our tool is the fastest and easiest way to get a perfectly sized photo. Try it now and experience hassle-free image compression!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Resize Image Online Resize image to 20kb Upload an image: Target File Size (KB): Resize Image Preview of Resized Image Download Resized Image Compressor to 20KB Online Free Need to&nbsp;compress image to 20KB online free? Our tool lets you reduce your photo to 20 KB for online forms, exams, or social media. Upload your photo &#8230; <a title=\"Resize image to 20kb\" class=\"read-more\" href=\"https:\/\/sushiljoshi.in\/index.php\/2026\/11\/25\/resize-image-to-20kb\/\" aria-label=\"Read more about Resize image to 20kb\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_hide_featured_image":false,"_jetpack_featured_image_duplicate_dismissed":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[116,87],"tags":[],"class_list":["post-70","post","type-post","status-publish","format-standard","hentry","category-tool","category-new-updates"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/sushiljoshi.in\/index.php\/wp-json\/wp\/v2\/posts\/70","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sushiljoshi.in\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sushiljoshi.in\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sushiljoshi.in\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sushiljoshi.in\/index.php\/wp-json\/wp\/v2\/comments?post=70"}],"version-history":[{"count":4,"href":"https:\/\/sushiljoshi.in\/index.php\/wp-json\/wp\/v2\/posts\/70\/revisions"}],"predecessor-version":[{"id":75,"href":"https:\/\/sushiljoshi.in\/index.php\/wp-json\/wp\/v2\/posts\/70\/revisions\/75"}],"wp:attachment":[{"href":"https:\/\/sushiljoshi.in\/index.php\/wp-json\/wp\/v2\/media?parent=70"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sushiljoshi.in\/index.php\/wp-json\/wp\/v2\/categories?post=70"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sushiljoshi.in\/index.php\/wp-json\/wp\/v2\/tags?post=70"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}