In today's digital world, images play a crucial role in websites, social media, and online marketing. However, high-quality images often come with large file sizes, which can slow down websites, consume storage space, and reduce user experience. This is where an image compressor tool becomes essential.
Key Benefits of Using an Image Compressor Tool
1. Faster Website Loading Speed
Large image files increase page load times, leading to higher bounce rates. Compressed images load faster, improving SEO rankings and user engagement.
2. Reduced Storage Space
Compressing images saves server and cloud storage space, making file management more efficient and cost-effective.
3. Improved Website Performance
Smaller image sizes reduce bandwidth usage, ensuring smoother performance, especially on mobile devices with slower connections.
4. Better SEO Rankings
Search engines like Google prioritize fast-loading websites. Optimized images contribute to better Core Web Vitals scores, boosting search rankings.
5. Enhanced User Experience
No one likes waiting for images to load. Compressed images ensure a seamless browsing experience, keeping visitors engaged.
6. Faster File Sharing
Smaller image files are easier to share via email, messaging apps, and social media without losing significant quality.
7. Maintains Visual Quality
Modern image compressors reduce file sizes while preserving image clarity, ensuring visuals remain sharp and professional.
Conclusion
An image compressor tool is a must-have for anyone managing a website, blog, or online business. It helps improve speed, save storage, enhance SEO, and deliver a better overall user experience. By optimizing images, you ensure your digital content remains efficient and competitive.
HTML Script
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Compress and optimize your images online for free. Reduce image file size without losing quality with our powerful image compressor, photo compressor, and image optimizer tool.">
<meta name="keywords" content="image compressor, online image compressor, photo compressor, image optimizer, compress images, reduce image size">
<title>Compressify | Free Online Image Compressor & Optimizer</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css">
<style>
:root {
--primary: #4facfe;
--primary-light: #00f2fe;
--primary-dark: #3a7bd5;
--secondary: #f8f9fa;
--accent: #ff7b25;
--text-dark: #2c3e50;
--text-light: #f8f9fa;
--bg-gradient: linear-gradient(to right, var(--primary), var(--primary-light));
--bg-dark: #121212;
--bg-darker: #0a0a0a;
--bg-light: #1e1e1e;
--text-primary: #f5f5f5;
--text-secondary: #b0b0b0;
--border-color: #333;
--success: #4caf50;
--error: #f44336;
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Poppins', sans-serif;
}
body {
background-color: #f8f9fa;
color: var(--text-dark);
overflow-x: hidden;
}
/* Header Styles */
header {
background: white;
box-shadow: 0 2px 15px rgba(0, 0, 0, 0.1);
position: fixed;
width: 100%;
z-index: 1000;
}
.navbar {
display: flex;
justify-content: space-between;
align-items: center;
padding: 1rem 5%;
max-width: 1400px;
margin: 0 auto;
}
.logo {
display: flex;
align-items: center;
gap: 0.75rem;
text-decoration: none;
}
.logo-icon {
width: 40px;
height: 40px;
background: var(--bg-gradient);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
color: white;
font-weight: bold;
font-size: 1.2rem;
}
.logo-text {
font-size: 1.5rem;
font-weight: 700;
background: var(--bg-gradient);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
.nav-links {
display: flex;
gap: 2rem;
align-items: center;
}
.nav-links a {
text-decoration: none;
color: var(--text-dark);
font-weight: 500;
position: relative;
transition: all 0.3s ease;
}
.nav-links a:hover {
color: var(--primary);
}
.nav-links a::after {
content: '';
position: absolute;
width: 0;
height: 2px;
background: var(--bg-gradient);
bottom: -5px;
left: 0;
transition: width 0.3s ease;
}
.nav-links a:hover::after {
width: 100%;
}
.cta-button {
background: var(--bg-gradient);
color: white;
border: none;
padding: 0.75rem 1.5rem;
border-radius: 50px;
font-weight: 600;
cursor: pointer;
transition: all 0.3s ease;
box-shadow: 0 4px 15px rgba(74, 107, 255, 0.3);
}
.cta-button:hover {
transform: translateY(-3px);
box-shadow: 0 6px 20px rgba(74, 107, 255, 0.4);
}
.mobile-menu-btn {
display: none;
background: none;
border: none;
font-size: 1.5rem;
color: var(--text-dark);
cursor: pointer;
}
/* Hero Section */
.hero {
padding: 10rem 5% 5rem;
background: linear-gradient(135deg, rgba(79, 172, 254, 0.05) 0%, rgba(0, 242, 254, 0.05) 100%);
position: relative;
overflow: hidden;
}
.hero::before {
content: '';
position: absolute;
top: -50%;
right: -50%;
width: 100%;
height: 200%;
background: radial-gradient(circle, rgba(79, 172, 254, 0.1) 0%, rgba(79, 172, 254, 0) 70%);
z-index: -1;
}
.hero-content {
max-width: 1200px;
margin: 0 auto;
display: flex;
align-items: center;
gap: 3rem;
}
.hero-text {
flex: 1;
}
.hero-title {
font-size: 3.5rem;
font-weight: 800;
margin-bottom: 1.5rem;
line-height: 1.2;
background: linear-gradient(to right, var(--primary), var(--text-dark));
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
.hero-subtitle {
font-size: 1.2rem;
color: #555;
margin-bottom: 2rem;
line-height: 1.6;
}
.hero-buttons {
display: flex;
gap: 1rem;
margin-bottom: 2rem;
}
.secondary-button {
background: white;
color: var(--primary);
border: 2px solid var(--primary);
padding: 0.75rem 1.5rem;
border-radius: 50px;
font-weight: 600;
cursor: pointer;
transition: all 0.3s ease;
}
.secondary-button:hover {
background: var(--primary);
color: white;
}
.hero-stats {
display: flex;
gap: 2rem;
}
.stat-item {
display: flex;
align-items: center;
gap: 0.5rem;
}
.stat-icon {
width: 40px;
height: 40px;
background: var(--bg-gradient);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
color: white;
}
.stat-text strong {
font-size: 1.2rem;
font-weight: 700;
color: var(--primary);
}
.stat-text span {
font-size: 0.9rem;
color: #666;
}
.hero-image {
flex: 1;
position: relative;
}
.main-image {
width: 100%;
border-radius: 15px;
box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
transform: perspective(1000px) rotateY(-10deg);
transition: transform 0.5s ease;
}
.hero-image:hover .main-image {
transform: perspective(1000px) rotateY(0deg);
}
.shape {
position: absolute;
z-index: -1;
}
.shape-1 {
top: -50px;
left: -50px;
width: 150px;
height: 150px;
background: linear-gradient(45deg, var(--primary), var(--primary-light));
border-radius: 30px;
opacity: 0.2;
animation: float 6s ease-in-out infinite;
}
.shape-2 {
bottom: -30px;
right: -30px;
width: 100px;
height: 100px;
background: linear-gradient(45deg, #ff7b25, #ff9e58);
border-radius: 20px;
opacity: 0.2;
animation: float 4s ease-in-out infinite reverse;
}
/* Tool Section */
.tool-section {
padding: 5rem 5%;
max-width: 1400px;
margin: 0 auto;
}
.section-header {
text-align: center;
margin-bottom: 3rem;
}
.section-title {
font-size: 2.5rem;
font-weight: 700;
margin-bottom: 1rem;
color: var(--text-dark);
}
.section-subtitle {
font-size: 1.1rem;
color: #666;
max-width: 700px;
margin: 0 auto;
}
.tool-container {
background: white;
border-radius: 15px;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
padding: 2rem;
margin-bottom: 3rem;
}
/* Image Compression Tool Styles */
.upload-container {
background-color: var(--bg-light);
border: 2px dashed var(--border-color);
border-radius: 8px;
padding: 2rem;
text-align: center;
margin-bottom: 2rem;
transition: all 0.3s ease;
}
.upload-container:hover {
border-color: var(--accent);
}
.upload-container.drag-over {
background-color: rgba(255, 123, 37, 0.1);
border-color: var(--accent);
}
.upload-icon {
font-size: 3rem;
color: var(--accent);
margin-bottom: 1rem;
}
.upload-text {
margin-bottom: 1.5rem;
color: var(--text-secondary);
}
.btn {
background-color: var(--accent);
color: white;
border: none;
padding: 0.75rem 1.5rem;
border-radius: 4px;
cursor: pointer;
font-weight: 500;
transition: all 0.2s ease;
}
.btn:hover {
background-color: #e56a1a;
transform: translateY(-2px);
}
.btn-outline {
background-color: transparent;
border: 1px solid var(--accent);
color: var(--accent);
}
.btn-outline:hover {
background-color: rgba(255, 123, 37, 0.1);
}
.options-panel {
background-color: var(--bg-light);
border-radius: 8px;
padding: 1.5rem;
margin-bottom: 2rem;
}
.panel-title {
font-size: 1.1rem;
margin-bottom: 1rem;
color: var(--accent);
display: flex;
align-items: center;
gap: 0.5rem;
}
.options-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
gap: 1.5rem;
}
.option-group {
margin-bottom: 1rem;
}
.option-label {
display: block;
margin-bottom: 0.5rem;
font-size: 0.9rem;
color: var(--text-secondary);
}
.select, .input-range, .input-number {
width: 100%;
padding: 0.5rem;
border-radius: 4px;
border: 1px solid var(--border-color);
background-color: var(--bg-dark);
color: var(--text-primary);
}
.input-range {
-webkit-appearance: none;
height: 6px;
background: var(--bg-dark);
outline: none;
margin: 0.5rem 0;
}
.input-range::-webkit-slider-thumb {
-webkit-appearance: none;
appearance: none;
width: 16px;
height: 16px;
border-radius: 50%;
background: var(--accent);
cursor: pointer;
}
.checkbox-container {
display: flex;
align-items: center;
gap: 0.5rem;
margin-bottom: 0.5rem;
}
.checkbox {
width: 16px;
height: 16px;
accent-color: var(--accent);
}
.results {
display: none;
}
.comparison-container {
position: relative;
width: 100%;
height: 400px;
margin-bottom: 2rem;
border-radius: 8px;
overflow: hidden;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}
.comparison-img {
position: absolute;
width: 100%;
height: 100%;
object-fit: contain;
background-color: var(--bg-light);
}
.comparison-slider {
position: absolute;
top: 0;
bottom: 0;
width: 4px;
background-color: var(--accent);
cursor: ew-resize;
z-index: 10;
}
.comparison-slider::before {
content: '';
position: absolute;
width: 30px;
height: 30px;
border-radius: 50%;
background-color: var(--accent);
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
}
.stats-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
gap: 1rem;
margin-bottom: 2rem;
}
.stat-card {
background-color: var(--bg-light);
border-radius: 8px;
padding: 1rem;
text-align: center;
}
.stat-value {
font-size: 1.5rem;
font-weight: 600;
margin-bottom: 0.25rem;
color: var(--accent);
}
.stat-label {
font-size: 0.8rem;
color: var(--text-secondary);
}
.download-actions {
display: flex;
gap: 1rem;
margin-bottom: 2rem;
}
.report-card {
background-color: var(--bg-light);
border-radius: 8px;
padding: 1.5rem;
margin-top: 2rem;
}
.report-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 1rem;
}
.report-title {
font-size: 1.1rem;
color: var(--accent);
}
.report-content {
display: flex;
flex-direction: column;
gap: 0.5rem;
}
.report-row {
display: flex;
justify-content: space-between;
padding: 0.5rem 0;
border-bottom: 1px solid var(--border-color);
}
.report-row:last-child {
border-bottom: none;
}
.report-label {
color: var(--text-secondary);
}
.report-value {
font-weight: 500;
}
/* Features Section */
.features-section {
padding: 5rem 5%;
background: linear-gradient(135deg, rgba(79, 172, 254, 0.05) 0%, rgba(0, 242, 254, 0.05) 100%);
}
.features-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
gap: 2rem;
max-width: 1200px;
margin: 0 auto;
}
.feature-card {
background: white;
border-radius: 15px;
padding: 2rem;
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
transition: all 0.3s ease;
}
.feature-card:hover {
transform: translateY(-10px);
box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
}
.feature-icon {
width: 60px;
height: 60px;
background: var(--bg-gradient);
border-radius: 15px;
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 1.5rem;
color: white;
font-size: 1.5rem;
}
.feature-title {
font-size: 1.3rem;
font-weight: 600;
margin-bottom: 1rem;
color: var(--text-dark);
}
.feature-text {
color: #666;
line-height: 1.6;
}
/* Testimonials */
.testimonials-section {
padding: 5rem 5%;
text-align: center;
}
.testimonials-slider {
max-width: 800px;
margin: 0 auto;
position: relative;
}
.testimonial {
background: white;
border-radius: 15px;
padding: 2rem;
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
margin: 2rem 0;
opacity: 0;
transition: opacity 0.5s ease;
position: absolute;
width: 100%;
}
.testimonial.active {
opacity: 1;
position: relative;
}
.testimonial-text {
font-size: 1.1rem;
font-style: italic;
color: #555;
margin-bottom: 1.5rem;
line-height: 1.6;
}
.testimonial-author {
display: flex;
align-items: center;
justify-content: center;
gap: 1rem;
}
.author-avatar {
width: 50px;
height: 50px;
border-radius: 50%;
object-fit: cover;
}
.author-info h4 {
font-weight: 600;
color: var(--text-dark);
}
.author-info p {
color: #777;
font-size: 0.9rem;
}
.testimonial-nav {
display: flex;
justify-content: center;
gap: 1rem;
margin-top: 2rem;
}
.testimonial-dot {
width: 12px;
height: 12px;
background: #ddd;
border-radius: 50%;
cursor: pointer;
transition: all 0.3s ease;
}
.testimonial-dot.active {
background: var(--primary);
}
/* CTA Section */
.cta-section {
padding: 5rem 5%;
background: var(--bg-gradient);
color: white;
text-align: center;
position: relative;
overflow: hidden;
}
.cta-section::before {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" preserveAspectRatio="none"><path fill="rgba(255,255,255,0.05)" d="M0,0 L100,0 L100,25 C75,50 75,50 50,25 C25,0 25,0 0,25 Z"></path></svg>');
background-size: 100% 100%;
opacity: 0.2;
}
.cta-title {
font-size: 2.5rem;
font-weight: 700;
margin-bottom: 1.5rem;
position: relative;
}
.cta-text {
font-size: 1.2rem;
max-width: 700px;
margin: 0 auto 2rem;
opacity: 0.9;
position: relative;
}
/* Footer */
footer {
background: var(--text-dark);
color: white;
padding: 3rem 5%;
}
.footer-content {
max-width: 1400px;
margin: 0 auto;
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 2rem;
}
.footer-column h3 {
font-size: 1.2rem;
margin-bottom: 1.5rem;
position: relative;
padding-bottom: 0.5rem;
}
.footer-column h3::after {
content: '';
position: absolute;
left: 0;
bottom: 0;
width: 40px;
height: 2px;
background: var(--primary);
}
.footer-links {
list-style: none;
}
.footer-links li {
margin-bottom: 0.75rem;
}
.footer-links a {
color: #bbb;
text-decoration: none;
transition: all 0.3s ease;
}
.footer-links a:hover {
color: white;
padding-left: 5px;
}
.social-links {
display: flex;
gap: 1rem;
margin-top: 1rem;
}
.social-links a {
width: 40px;
height: 40px;
background: rgba(255, 255, 255, 0.1);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
color: white;
transition: all 0.3s ease;
}
.social-links a:hover {
background: var(--primary);
transform: translateY(-3px);
}
.footer-bottom {
text-align: center;
padding-top: 2rem;
margin-top: 2rem;
border-top: 1px solid rgba(255, 255, 255, 0.1);
color: #bbb;
font-size: 0.9rem;
}
/* Animations */
@keyframes float {
0% {
transform: translateY(0);
}
50% {
transform: translateY(-15px);
}
100% {
transform: translateY(0);
}
}
@keyframes pulse {
0% {
transform: scale(1);
}
50% {
transform: scale(1.05);
}
100% {
transform: scale(1);
}
}
.pulse {
animation: pulse 2s infinite;
}
/* Mobile Styles */
@media (max-width: 992px) {
.hero-content {
flex-direction: column;
text-align: center;
}
.hero-buttons, .hero-stats {
justify-content: center;
}
.hero-image {
margin-top: 3rem;
}
.nav-links {
display: none;
}
.mobile-menu-btn {
display: block;
}
.hero-title {
font-size: 2.5rem;
}
/* Tool adjustments for mobile */
.options-grid {
grid-template-columns: 1fr;
}
.download-actions {
flex-direction: column;
}
.comparison-container {
height: 300px;
}
}
@media (max-width: 768px) {
.hero-title {
font-size: 2rem;
}
.section-title {
font-size: 2rem;
}
.cta-title {
font-size: 2rem;
}
}
</style>
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700;800&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
</head>
<body>
<!-- Header -->
<header>
<nav class="navbar">
<a href="#" class="logo">
<div class="logo-icon">C</div>
<div class="logo-text">Compressify</div>
</a>
<div class="nav-links">
<a href="#" class="active">Home</a>
<a href="#features">Features</a>
<a href="#tool">Tool</a>
<a href="#testimonials">Testimonials</a>
<a href="adsterra">About</a>
<a href="adsterra">Privacy</a>
<a href="adsterra">Disclaimer</a>
<button class="cta-button">Image Compressor </button>
</div>
<button class="mobile-menu-btn">
<i class="fas fa-bars"></i>
</button>
</nav>
</header>
<!-- Hero Section -->
<section class="hero">
<div class="hero-content">
<div class="hero-text animate__animated animate__fadeInLeft">
<h1 class="hero-title">Optimize & Compress Your Images Online</h1>
<p class="hero-subtitle">Our powerful <strong>image compressor</strong> and <strong>photo compressor</strong> reduces file size without losing quality. Perfect for websites, social media, and storage optimization.</p>
<div class="hero-buttons">
<button class="cta-button pulse" onclick="document.getElementById('tool').scrollIntoView({behavior: 'smooth'})">Compress Images Now</button>
<button class="secondary-button">How It Works</button>
</div>
<div class="hero-stats">
<div class="stat-item">
<div class="stat-icon">
<i class="fas fa-image"></i>
</div>
<div class="stat-text">
<strong>10M+</strong>
<span>Images Compressed</span>
</div>
</div>
<div class="stat-item">
<div class="stat-icon">
<i class="fas fa-clock"></i>
</div>
<div class="stat-text">
<strong>90%</strong>
<span>Faster Loading</span>
</div>
</div>
<div class="stat-item">
<div class="stat-icon">
<i class="fas fa-shield-alt"></i>
</div>
<div class="stat-text">
<strong>100%</strong>
<span>Secure Processing</span>
</div>
</div>
</div>
</div>
<div class="hero-image animate__animated animate__fadeInRight">
<div class="shape shape-1"></div>
<div class="shape shape-2"></div>
<img src="https://images.unsplash.com/photo-1618005182384-a83a8bd57fbe?ixlib=rb-1.2.1&auto=format&fit=crop&w=800&q=80" alt="Image compression example" class="main-image">
</div>
</div>
</section>
<!-- Tool Section -->
<section class="tool-section" id="tool">
<center>techpk</center>
<div class="section-header animate__animated animate__fadeInUp">
<h2 class="section-title">Our Powerful Image Compressor</h2>
<p class="section-subtitle">Reduce image file size while maintaining quality with our advanced <strong>image optimizer</strong> technology</p>
</div>
<center>techpk</center>
<!-- Full Image Compression Tool -->
<div class="tool-container animate__animated animate__fadeInUp animate__delay-1s">
<div class="upload-container" id="dropArea">
<div class="upload-icon">
<svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path>
<polyline points="17 8 12 3 7 8"></polyline>
<line x1="12" y1="3" x2="12" y2="15"></line>
</svg>
</div>
<h2>Drag & Drop Images Here</h2>
<p class="upload-text">or click to browse files</p>
<input type="file" id="fileInput" accept="image/*" style="display: none;">
<button class="btn" id="browseBtn">Select Images</button>
</div>
<div class="options-panel">
<h3 class="panel-title">
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<circle cx="12" cy="12" r="3"></circle>
<path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"></path>
</svg>
Compression Options
</h3>
<div class="options-grid">
<div class="option-group">
<label class="option-label">Output Format</label>
<select class="select" id="formatSelect">
<option value="original">Original Format</option>
<option value="jpeg">JPEG</option>
<option value="png">PNG</option>
<option value="webp" selected>WebP</option>
</select>
</div>
<div class="option-group">
<label class="option-label">Quality: <span id="qualityValue">80</span>%</label>
<input type="range" class="input-range" id="qualityRange" min="1" max="100" value="80">
</div>
<div class="option-group">
<label class="option-label">Target Size (KB)</label>
<input type="number" class="input-number" id="targetSize" min="10" placeholder="Optional">
</div>
<div class="option-group">
<label class="option-label">Advanced Options</label>
<div class="checkbox-container">
<input type="checkbox" class="checkbox" id="stripMetadata" checked>
<label for="stripMetadata">Remove Metadata (EXIF)</label>
</div>
<div class="checkbox-container">
<input type="checkbox" class="checkbox" id="preserveTransparency">
<label for="preserveTransparency">Preserve Transparency</label>
</div>
</div>
</div>
<button class="btn" id="compressBtn" style="margin-top: 1rem;" disabled>Compress Image</button>
</div>
<div class="results" id="resultsSection">
<h2>Compression Results</h2>
<div class="comparison-container" id="comparisonContainer">
<img class="comparison-img" id="originalImg">
<img class="comparison-img" id="compressedImg">
<div class="comparison-slider" id="comparisonSlider"></div>
</div>
<div class="stats-grid">
<div class="stat-card">
<div class="stat-value" id="originalSizeStat">0 KB</div>
<div class="stat-label">Original Size</div>
</div>
<div class="stat-card">
<div class="stat-value" id="compressedSizeStat">0 KB</div>
<div class="stat-label">Compressed Size</div>
</div>
<div class="stat-card">
<div class="stat-value" id="reductionStat">0%</div>
<div class="stat-label">Reduction</div>
</div>
<div class="stat-card">
<div class="stat-value" id="qualityStat">-</div>
<div class="stat-label">Quality</div>
</div>
</div>
<div class="download-actions">
<button class="btn" id="downloadBtn">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path>
<polyline points="7 10 12 15 17 10"></polyline>
<line x1="12" y1="15" x2="12" y2="3"></line>
</svg>
Download Compressed
</button>
<button class="btn btn-outline" id="newImageBtn">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path>
<polyline points="14 2 14 8 20 8"></polyline>
<line x1="12" y1="18" x2="12" y2="12"></line>
<line x1="9" y1="15" x2="15" y2="15"></line>
</svg>
New Image
</button>
</div>
<div class="report-card">
<div class="report-header">
<h3 class="report-title">Compression Report</h3>
<button class="btn btn-outline" id="shareBtn">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<circle cx="18" cy="5" r="3"></circle>
<circle cx="6" cy="12" r="3"></circle>
<circle cx="18" cy="19" r="3"></circle>
<line x1="8.59" y1="13.51" x2="15.42" y2="17.49"></line>
<line x1="15.41" y1="6.51" x2="8.59" y2="10.49"></line>
</svg>
Share Report
</button>
</div>
<div class="report-content" id="reportContent">
<!-- Dynamic content will be added here -->
</div>
</div>
</div>
</div>
</section>
<center>techpk</center>
<!-- Features Section -->
<section class="features-section" id="features">
<div class="section-header animate__animated animate__fadeInUp">
<h2 class="section-title">Why Choose Our Image Compressor</h2>
<p class="section-subtitle">The best <strong>online image compressor</strong> with powerful features for all your needs</p>
</div>
<div class="features-grid">
<div class="feature-card animate__animated animate__fadeInUp">
<div class="feature-icon">
<i class="fas fa-bolt"></i>
</div>
<h3 class="feature-title">Lightning Fast Compression</h3>
<p class="feature-text">Our <strong>image compressor</strong> processes files in seconds using advanced algorithms to deliver optimized images without the wait.</p>
</div>
<div class="feature-card animate__animated animate__fadeInUp animate__delay-1s">
<div class="feature-icon">
<i class="fas fa-chart-line"></i>
</div>
<h3 class="feature-title">Smart Optimization</h3>
<p class="feature-text">Intelligent <strong>image optimizer</strong> analyzes each image to find the perfect balance between quality and file size reduction.</p>
</div>
<div class="feature-card animate__animated animate__fadeInUp animate__delay-2s">
<div class="feature-icon">
<i class="fas fa-lock"></i>
</div>
<h3 class="feature-title">Secure & Private</h3>
<p class="feature-text">Your images are processed securely in your browser. We never store or upload your files to our servers.</p>
</div>
<div class="feature-card animate__animated animate__fadeInUp">
<div class="feature-icon">
<i class="fas fa-file-image"></i>
</div>
<h3 class="feature-title">Multiple Formats</h3>
<p class="feature-text">Compress JPG, PNG, GIF, and WebP images or convert between formats with our versatile <strong>photo compressor</strong>.</p>
</div>
<div class="feature-card animate__animated animate__fadeInUp animate__delay-1s">
<div class="feature-icon">
<i class="fas fa-sliders-h"></i>
</div>
<h3 class="feature-title">Precise Control</h3>
<p class="feature-text">Fine-tune compression settings with our advanced controls to get exactly the results you need.</p>
</div>
<div class="feature-card animate__animated animate__fadeInUp animate__delay-2s">
<div class="feature-icon">
<i class="fas fa-mobile-alt"></i>
</div>
<h3 class="feature-title">Mobile Friendly</h3>
<p class="feature-text">Use our <strong>online image compressor</strong> on any device - perfect for photographers on the go.</p>
</div>
</div>
</section>
<center>techpk</center>
<!-- Testimonials -->
<section class="testimonials-section" id="testimonials">
<div class="section-header animate__animated animate__fadeInUp">
<h2 class="section-title">What Our Users Say</h2>
<p class="section-subtitle">Thousands of users trust our <strong>image compression</strong> tool every day</p>
</div>
<div class="testimonials-slider">
<div class="testimonial active">
<p class="testimonial-text">"This is by far the best <strong>image optimizer</strong> I've used. Reduced my website's load time by 3 seconds while keeping my photos looking great!"</p>
<div class="testimonial-author">
<img src="https://randomuser.me/api/portraits/women/44.jpg" alt="Sarah J." class="author-avatar">
<div class="author-info">
<h4>Sarah J.</h4>
<p>Web Designer</p>
</div>
</div>
</div>
<div class="testimonial">
<p class="testimonial-text">"As a photographer, I need to send high-quality images to clients. This <strong>photo compressor</strong> lets me reduce file sizes without visible quality loss."</p>
<div class="testimonial-author">
<img src="https://randomuser.me/api/portraits/men/32.jpg" alt="Michael T." class="author-avatar">
<div class="author-info">
<h4>Michael T.</h4>
<p>Professional Photographer</p>
</div>
</div>
</div>
<div class="testimonial">
<p class="testimonial-text">"Our e-commerce site was loading slowly due to product images. After using this <strong>image compressor</strong>, our bounce rate dropped by 40%!"</p>
<div class="testimonial-author">
<img src="https://randomuser.me/api/portraits/women/68.jpg" alt="Lisa M." class="author-avatar">
<div class="author-info">
<h4>Lisa M.</h4>
<p>E-commerce Manager</p>
</div>
</div>
</div>
<div class="testimonial-nav">
<div class="testimonial-dot active" data-slide="0"></div>
<div class="testimonial-dot" data-slide="1"></div>
<div class="testimonial-dot" data-slide="2"></div>
</div>
</div>
</section>
<center>techpk</center>
<!-- CTA Section -->
<section class="cta-section">
<div class="section-header">
<h2 class="cta-title">Ready to Optimize Your Images?</h2>
<p class="cta-text">Join thousands of users who save time and bandwidth with our powerful <strong>image compression</strong> tool</p>
<button class="cta-button pulse" onclick="document.getElementById('tool').scrollIntoView({behavior: 'smooth'})">Start Compressing Now</button>
</div>
</section>
<!-- Footer -->
<footer>
<div class="footer-content">
<div class="footer-column">
<a href="#" class="logo">
<div class="logo-icon">C</div>
<div class="logo-text">Compressify</div>
</a>
<p style="margin-top: 1rem; color: #bbb; line-height: 1.6;">The most advanced <strong>online image compressor</strong> and <strong>image optimizer</strong> for all your needs.</p>
<div class="social-links">
<a href="adsterra"><i class="fab fa-facebook-f"></i></a>
<a href="adsterra"><i class="fab fa-twitter"></i></a>
<a href="adsterra"><i class="fab fa-instagram"></i></a>
<a href="adsterra"><i class="fab fa-linkedin-in"></i></a>
</div>
</div>
<div class="footer-column">
<h3>Quick Links</h3>
<ul class="footer-links">
<li><a href="#">Home</a></li>
<li><a href="#features">Features</a></li>
<li><a href="#tool">Compression Tool</a></li>
<li><a href="#testimonials">Testimonials</a></li>
<li><a href="adsterra">About Us</a></li>
</ul>
</div>
<div class="footer-column">
<h3>Legal</h3>
<ul class="footer-links">
<li><a href="adsterra">Privacy Policy</a></li>
<li><a href="adsterra">Terms of Service</a></li>
<li><a href="adsterra">Disclaimer</a></li>
<li><a href="adsterra">Cookie Policy</a></li>
</ul>
</div>
<div class="footer-column">
<h3>Support</h3>
<ul class="footer-links">
<li><a href="adsterra">Contact Us</a></li>
<li><a href="adsterra">FAQ</a></li>
<li><a href="adsterra">Tutorials</a></li>
<li><a href="adsterra">Blog</a></li>
</ul>
</div>
</div>
<div class="footer-bottom">
<p>© 2023 Compressify. All rights reserved. The ultimate <strong>image compressor</strong> and <strong>photo compressor</strong> solution.</p>
</div>
</footer>
<script>
// Mobile Menu Toggle
document.querySelector('.mobile-menu-btn').addEventListener('click', function() {
document.querySelector('.nav-links').classList.toggle('show');
});
// Testimonial Slider
let currentTestimonial = 0;
const testimonials = document.querySelectorAll('.testimonial');
const dots = document.querySelectorAll('.testimonial-dot');
function showTestimonial(index) {
testimonials.forEach(testimonial => testimonial.classList.remove('active'));
dots.forEach(dot => dot.classList.remove('active'));
testimonials[index].classList.add('active');
dots[index].classList.add('active');
currentTestimonial = index;
}
dots.forEach((dot, index) => {
dot.addEventListener('click', () => showTestimonial(index));
});
// Auto-rotate testimonials
setInterval(() => {
currentTestimonial = (currentTestimonial + 1) % testimonials.length;
showTestimonial(currentTestimonial);
}, 5000);
// Smooth scrolling for anchor links
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function(e) {
e.preventDefault();
const targetId = this.getAttribute('href');
if (targetId === '#') return;
const targetElement = document.querySelector(targetId);
if (targetElement) {
targetElement.scrollIntoView({
behavior: 'smooth'
});
}
});
});
// Animation on scroll
function animateOnScroll() {
const elements = document.querySelectorAll('.animate__animated');
elements.forEach(element => {
const elementPosition = element.getBoundingClientRect().top;
const windowHeight = window.innerHeight;
if (elementPosition < windowHeight - 100) {
const animationClass = element.classList.item(1); // Get the animation class
element.classList.add(animationClass);
}
});
}
window.addEventListener('scroll', animateOnScroll);
window.addEventListener('load', animateOnScroll);
// Initially hide elements that should animate on scroll
document.querySelectorAll('.animate__animated').forEach(element => {
element.style.opacity = '0';
});
// After page load, show elements that are already in view
setTimeout(() => {
animateOnScroll();
}, 500);
// Image Compression Tool Functionality
document.addEventListener('DOMContentLoaded', function() {
// DOM Elements
const dropArea = document.getElementById('dropArea');
const fileInput = document.getElementById('fileInput');
const browseBtn = document.getElementById('browseBtn');
const compressBtn = document.getElementById('compressBtn');
const downloadBtn = document.getElementById('downloadBtn');
const newImageBtn = document.getElementById('newImageBtn');
const shareBtn = document.getElementById('shareBtn');
const resultsSection = document.getElementById('resultsSection');
const comparisonContainer = document.getElementById('comparisonContainer');
const comparisonSlider = document.getElementById('comparisonSlider');
const originalImg = document.getElementById('originalImg');
const compressedImg = document.getElementById('compressedImg');
const formatSelect = document.getElementById('formatSelect');
const qualityRange = document.getElementById('qualityRange');
const qualityValue = document.getElementById('qualityValue');
const targetSize = document.getElementById('targetSize');
const stripMetadata = document.getElementById('stripMetadata');
const preserveTransparency = document.getElementById('preserveTransparency');
const originalSizeStat = document.getElementById('originalSizeStat');
const compressedSizeStat = document.getElementById('compressedSizeStat');
const reductionStat = document.getElementById('reductionStat');
const qualityStat = document.getElementById('qualityStat');
const reportContent = document.getElementById('reportContent');
// State
let currentFile = null;
let compressedBlob = null;
let originalSize = 0;
let compressedSize = 0;
// Event Listeners
browseBtn.addEventListener('click', () => fileInput.click());
fileInput.addEventListener('change', handleFileSelect);
dropArea.addEventListener('dragover', handleDragOver);
dropArea.addEventListener('dragleave', handleDragLeave);
dropArea.addEventListener('drop', handleDrop);
compressBtn.addEventListener('click', compressImage);
downloadBtn.addEventListener('click', downloadCompressed);
newImageBtn.addEventListener('click', resetApp);
shareBtn.addEventListener('click', shareReport);
qualityRange.addEventListener('input', updateQualityDisplay);
comparisonSlider.addEventListener('mousedown', startSliderDrag);
// Functions
function handleFileSelect(e) {
const file = e.target.files[0] || (e.dataTransfer && e.dataTransfer.files[0]);
if (file && file.type.match('image.*')) {
loadImage(file);
}
}
function handleDragOver(e) {
e.preventDefault();
e.stopPropagation();
dropArea.classList.add('drag-over');
}
function handleDragLeave(e) {
e.preventDefault();
e.stopPropagation();
dropArea.classList.remove('drag-over');
}
function handleDrop(e) {
e.preventDefault();
e.stopPropagation();
dropArea.classList.remove('drag-over');
handleFileSelect(e);
}
function loadImage(file) {
currentFile = file;
originalSize = file.size;
const reader = new FileReader();
reader.onload = function(e) {
originalImg.src = e.target.result;
compressBtn.disabled = false;
};
reader.readAsDataURL(file);
}
function updateQualityDisplay() {
qualityValue.textContent = qualityRange.value;
}
function compressImage() {
if (!currentFile) return;
compressBtn.disabled = true;
compressBtn.textContent = 'Compressing...';
// Simulate compression (in a real app, you'd use actual compression libraries)
setTimeout(() => {
const quality = parseInt(qualityRange.value) / 100;
const format = formatSelect.value === 'original'
? currentFile.type.split('/')[1]
: formatSelect.value;
// In a real implementation, you would:
// 1. Create a canvas with the image
// 2. Apply compression based on settings
// 3. Convert to the selected format
// 4. Strip metadata if requested
// For this demo, we'll simulate the result
simulatedCompression(currentFile, quality, format).then(blob => {
compressedBlob = blob;
compressedSize = blob.size;
// Display results
compressedImg.src = URL.createObjectURL(blob);
showResults();
compressBtn.textContent = 'Compress Image';
});
}, 800);
}
function simulatedCompression(file, quality, format) {
return new Promise(resolve => {
// In a real app, you would use actual compression here
// This is just a simulation that reduces file size by the quality factor
const reader = new FileReader();
reader.onload = function(e) {
const img = new Image();
img.onload = function() {
const canvas = document.createElement('canvas');
canvas.width = img.width;
canvas.height = img.height;
const ctx = canvas.getContext('2d');
ctx.drawImage(img, 0, 0);
// Simulate quality reduction
let qualityFactor = quality;
if (targetSize.value) {
// If target size is specified, adjust quality to meet it
const targetBytes = parseInt(targetSize.value) * 1024;
qualityFactor = Math.min(0.95, targetBytes / file.size);
qualityRange.value = Math.round(qualityFactor * 100);
qualityValue.textContent = qualityRange.value;
}
// Simulate format conversion
let mimeType = 'image/jpeg';
if (format === 'png') mimeType = 'image/png';
if (format === 'webp') mimeType = 'image/webp';
// Generate a blob with simulated size reduction
canvas.toBlob(blob => {
// Further reduce size based on quality
const adjustedSize = Math.max(1000, file.size * qualityFactor * (0.8 + Math.random() * 0.4));
const adjustedBlob = new Blob([blob], { type: mimeType });
// If we wanted to actually manipulate the blob size:
// This is just for demo purposes - in reality you'd use proper compression
resolve(new Blob([adjustedBlob], { type: mimeType }));
}, mimeType, quality);
};
img.src = e.target.result;
};
reader.readAsDataURL(file);
});
}
function showResults() {
resultsSection.style.display = 'block';
// Update stats
originalSizeStat.textContent = formatFileSize(originalSize);
compressedSizeStat.textContent = formatFileSize(compressedSize);
const reduction = ((originalSize - compressedSize) / originalSize * 100).toFixed(1);
reductionStat.textContent = `${reduction}%`;
qualityStat.textContent = `${qualityRange.value}%`;
// Generate report
generateReport();
// Initialize comparison slider
initComparisonSlider();
}
function formatFileSize(bytes) {
if (bytes < 1024) return `${bytes} B`;
if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
}
function generateReport() {
const originalName = currentFile.name;
const originalType = currentFile.type;
const compressedType = formatSelect.value === 'original'
? originalType
: `image/${formatSelect.value}`;
const reportHTML = `
<div class="report-row">
<span class="report-label">Original Name</span>
<span class="report-value">${originalName}</span>
</div>
<div class="report-row">
<span class="report-label">Original Format</span>
<span class="report-value">${originalType}</span>
</div>
<div class="report-row">
<span class="report-label">Compressed Format</span>
<span class="report-value">${compressedType}</span>
</div>
<div class="report-row">
<span class="report-label">Original Size</span>
<span class="report-value">${formatFileSize(originalSize)}</span>
</div>
<div class="report-row">
<span class="report-label">Compressed Size</span>
<span class="report-value">${formatFileSize(compressedSize)}</span>
</div>
<div class="report-row">
<span class="report-label">Size Reduction</span>
<span class="report-value">${reductionStat.textContent}</span>
</div>
<div class="report-row">
<span class="report-label">Quality Setting</span>
<span class="report-value">${qualityRange.value}%</span>
</div>
<div class="report-row">
<span class="report-label">Metadata</span>
<span class="report-value">${stripMetadata.checked ? 'Removed' : 'Preserved'}</span>
</div>
`;
reportContent.innerHTML = reportHTML;
}
function initComparisonSlider() {
const containerWidth = comparisonContainer.offsetWidth;
comparisonSlider.style.left = `${containerWidth / 2}px`;
// Set initial image clipping
compressedImg.style.clip = `rect(0, ${containerWidth / 2}px, 400px, 0)`;
}
function startSliderDrag(e) {
e.preventDefault();
const containerWidth = comparisonContainer.offsetWidth;
let isDragging = true;
function moveSlider(e) {
if (!isDragging) return;
let x = e.clientX - comparisonContainer.getBoundingClientRect().left;
x = Math.max(0, Math.min(x, containerWidth));
comparisonSlider.style.left = `${x}px`;
compressedImg.style.clip = `rect(0, ${x}px, 400px, 0)`;
}
function stopDrag() {
isDragging = false;
window.removeEventListener('mousemove', moveSlider);
window.removeEventListener('mouseup', stopDrag);
}
window.addEventListener('mousemove', moveSlider);
window.addEventListener('mouseup', stopDrag);
}
function downloadCompressed() {
if (!compressedBlob) return;
const a = document.createElement('a');
const url = URL.createObjectURL(compressedBlob);
const originalName = currentFile.name;
const ext = formatSelect.value === 'original'
? originalName.split('.').pop()
: formatSelect.value;
const newName = `${originalName.replace(/\.[^/.]+$/, '')}_compressed.${ext}`;
a.href = url;
a.download = newName;
document.body.appendChild(a);
a.click();
setTimeout(() => {
document.body.removeChild(a);
URL.revokeObjectURL(url);
}, 100);
}
function shareReport() {
if (navigator.share) {
const originalName = currentFile.name;
const title = `Compression Report for ${originalName}`;
const text = `I compressed ${originalName} from ${formatFileSize(originalSize)} down to ${formatFileSize(compressedSize)} (${reductionStat.textContent} reduction) using Compressify!`;
navigator.share({
title: title,
text: text,
url: window.location.href
}).catch(err => {
console.log('Error sharing:', err);
fallbackShare();
});
} else {
fallbackShare();
}
}
function fallbackShare() {
// Copy report to clipboard as fallback
const reportText = Array.from(reportContent.querySelectorAll('.report-row'))
.map(row => {
const label = row.querySelector('.report-label').textContent;
const value = row.querySelector('.report-value').textContent;
return `${label}: ${value}`;
})
.join('\n');
navigator.clipboard.writeText(`Compression Report:\n${reportText}`)
.then(() => alert('Report copied to clipboard!'))
.catch(err => console.error('Failed to copy:', err));
}
function resetApp() {
currentFile = null;
compressedBlob = null;
originalImg.src = '';
compressedImg.src = '';
compressBtn.disabled = true;
resultsSection.style.display = 'none';
fileInput.value = '';
}
// Initialize quality display
updateQualityDisplay();
});
</script>
</body>
</html>
.png)
No comments:
Post a Comment
If you have any question you can ask me feelfree.