Image Compression Tool

                                                        image compression tool image

"Shrink & Transform Images Instantly: Free Tool for JPG, PNG, WEBP, GIF, PDF Conversion—Compress Like a Pro in One Click!"

(JPG, PNG, WEBP, GIF, PDF), and click "Compress & Convert." Download the result

with the button. Copy the code below into an HTML file, or use it online

at [your hosted link].

·  Upload an Image:

·         Users click the file input and select an image from their device (JPG, PNG, etc.).

·         The script listens for a file change, reads it with FileReader, and displays it in the "Original Image" preview

·  Set Compression Quality:

·         Adjust the quality slider  between 0 and 1 (e.g., 0.7 = 70% quality). Lower values mean higher compression (smaller file size, slightly reduced quality).

·  Choose Output Format:

·         Pick a format from the dropdown  JPG, PNG, WEBP, GIF (static), or PDF.

·         Each option corresponds to a MIME type (e.g., image/jpeg for JPG, application/pdf for PDF).

·  Compress & Convert:

·         Clicking the "Compress & Convert" button triggers the compressAndConvert() function:

·         A canvas is created, and the image is drawn onto it at its original size.

·         For JPG, PNG, WEBP, or GIF, the canvas compresses the image using toDataURL(format, quality) and generates a data URL.

·         For PDF, the jsPDF library (loaded via CDN) creates a document, adds the image, and outputs it as a data URL.

Image Compressor & Converter

Image Compressor & Converter

Original Image

Original Image Preview

Compressed/Converted Image

Compressed Image Preview

Post a Comment

0 Comments