DanielKruzo's picture
Unable to download the converted file. Fix the errors, improve the application code so that the downloaded file can be downloaded.
3d220ce verified
Raw History Blame Contribute Delete
12.6 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>PixelToVector Pro | AI-Powered Raster to Vector Conversion</title>
<link rel="stylesheet" href="style.css">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://unpkg.com/feather-icons"></script>
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/fabric.js/5.3.1/fabric.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js"></script>
<script>
// Make jsPDF available globally
window.jsPDF = window.jspdf.jsPDF;
</script>
</head>
<body class="min-h-screen bg-gray-50">
<custom-navbar></custom-navbar>
<main class="container mx-auto px-4 py-12">
<div class="max-w-4xl mx-auto">
<!-- Hero Section -->
<section class="text-center mb-16">
<h1 class="text-5xl font-bold text-gray-900 mb-4 bg-gradient-to-r from-teal-500 to-blue-600 bg-clip-text text-transparent">PixelToVector Pro</h1>
<p class="text-xl text-gray-600 mb-8">AI-powered raster to vector conversion with precision control</p>
<!-- Upload Area -->
<div id="drop-area" class="border-2 border-dashed border-blue-300 rounded-2xl p-12 mb-8 bg-white transition-all hover:border-blue-500 hover:bg-blue-50">
<div class="flex flex-col items-center justify-center">
<i data-feather="upload" class="w-16 h-16 text-blue-500 mb-4"></i>
<p class="text-lg text-gray-600 mb-4">Drag & drop your JPG/PNG here (max 10MB)</p>
<p class="text-gray-500 mb-6">or</p>
<label for="file-input" class="cursor-pointer px-6 py-3 bg-gradient-to-r from-teal-500 to-blue-600 text-white rounded-lg hover:from-teal-600 hover:to-blue-700 transition-all shadow-lg hover:shadow-xl">
<i data-feather="image" class="inline mr-2"></i> Select Image
</label>
<input id="file-input" type="file" accept="image/jpeg,image/png" class="hidden">
<p class="text-sm text-gray-500 mt-4">Supported formats: JPG, PNG</p>
</div>
</div>
<!-- Advanced Settings Panel -->
<div class="bg-white rounded-xl shadow-lg p-6 mb-8">
<h2 class="text-2xl font-semibold text-gray-800 mb-6 flex items-center gap-2">
<i data-feather="sliders" class="w-5 h-5"></i> Conversion Settings
</h2>
<div class="grid grid-cols-1 md:grid-cols-2 gap-6 mb-6">
<div>
<label for="color-mode" class="flex items-center justify-between text-gray-700 mb-2">
<span>Color Mode</span>
<label class="relative inline-flex items-center cursor-pointer">
<input type="checkbox" id="color-mode" class="sr-only peer" checked>
<div class="w-11 h-6 bg-gray-200 peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-blue-600"></div>
<span class="ml-3 text-sm font-medium text-gray-700" id="color-mode-label">Color</span>
</label>
</label>
</div>
<div>
<label for="output-format" class="block text-gray-700 mb-2">Output Format</label>
<select id="output-format" class="w-full rounded-lg border-gray-300 text-gray-700 focus:border-blue-500 focus:ring-blue-500">
<option value="svg">SVG</option>
<option value="pdf">PDF</option>
<option value="eps">EPS</option>
</select>
</div>
</div>
<div class="grid grid-cols-1 md:grid-cols-3 gap-6">
<div id="color-settings">
<label for="color-count" class="block text-gray-700 mb-2">Color Count (2-256)</label>
<input type="range" id="color-count" min="2" max="256" value="64" class="w-full h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer">
<div class="flex justify-between text-sm text-gray-500 mt-1">
<span>Min</span>
<span id="color-count-value">64</span>
<span>Max</span>
</div>
</div>
<div>
<label for="detail-level" class="block text-gray-700 mb-2">Detail Level</label>
<select id="detail-level" class="w-full rounded-lg border-gray-300 text-gray-700 focus:border-blue-500 focus:ring-blue-500">
<option value="low">Low (Fast)</option>
<option value="medium" selected>Medium</option>
<option value="high">High (Precise)</option>
</select>
</div>
<div>
<label for="smoothness" class="block text-gray-700 mb-2">Path Smoothness</label>
<input type="range" id="smoothness" min="0" max="10" value="5" class="w-full h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer">
<div class="flex justify-between text-sm text-gray-500 mt-1">
<span>Sharp</span>
<span id="smoothness-value">5</span>
<span>Smooth</span>
</div>
</div>
</div>
</div>
<!-- Convert Button -->
<button id="convert-btn" class="px-8 py-4 bg-gradient-to-r from-teal-500 to-blue-600 text-white text-lg font-semibold rounded-xl shadow-lg hover:shadow-xl transition-all transform hover:scale-105 flex items-center justify-center gap-2">
<i data-feather="refresh-cw" class="hidden" id="convert-spinner"></i>
<span id="convert-text">Convert to Vector</span>
</button>
</section>
<!-- Results Section -->
<section id="results" class="hidden bg-white rounded-xl shadow-lg p-8">
<div class="flex flex-col md:flex-row md:justify-between md:items-center mb-6 gap-4">
<h2 class="text-2xl font-semibold text-gray-800 flex items-center gap-2">
<i data-feather="check-circle" class="text-green-500"></i> Conversion Results
</h2>
<div class="flex gap-3">
<button id="download-btn" class="flex items-center gap-2 px-4 py-2 bg-gradient-to-r from-teal-500 to-blue-600 text-white rounded-lg hover:from-teal-600 hover:to-blue-700 transition-colors shadow">
<i data-feather="download"></i>
Download
</button>
<button id="copy-btn" class="flex items-center gap-2 px-4 py-2 bg-gray-100 text-gray-700 rounded-lg hover:bg-gray-200 transition-colors">
<i data-feather="copy"></i>
Copy Code
</button>
</div>
</div>
<div class="grid grid-cols-1 lg:grid-cols-2 gap-8 mb-8">
<div class="border rounded-lg p-4">
<h3 class="text-lg font-medium text-gray-700 mb-3 flex items-center gap-2">
<i data-feather="image"></i> Original Image
</h3>
<div id="original-container" class="flex items-center justify-center bg-gray-50 rounded-lg overflow-hidden h-64 lg:h-96">
<p class="text-gray-400 py-12">Your original image will appear here</p>
</div>
</div>
<div class="border rounded-lg p-4">
<h3 class="text-lg font-medium text-gray-700 mb-3 flex items-center gap-2">
<i data-feather="vector"></i> Vector Result
</h3>
<div id="result-container" class="relative flex items-center justify-center bg-gray-50 rounded-lg overflow-hidden h-64 lg:h-96">
<p class="text-gray-400 py-12">Your vector result will appear here</p>
<div class="absolute bottom-2 right-2 bg-white/80 rounded-full p-2 shadow-md hidden" id="zoom-controls">
<button id="zoom-in" class="p-1 rounded-full hover:bg-gray-100">
<i data-feather="plus" class="w-4 h-4"></i>
</button>
<button id="zoom-out" class="p-1 rounded-full hover:bg-gray-100">
<i data-feather="minus" class="w-4 h-4"></i>
</button>
<button id="zoom-reset" class="p-1 rounded-full hover:bg-gray-100">
<i data-feather="refresh-ccw" class="w-4 h-4"></i>
</button>
</div>
</div>
</div>
</div>
<div class="mt-6">
<div class="flex justify-between items-center mb-3">
<h3 class="text-lg font-medium text-gray-700 flex items-center gap-2">
<i data-feather="code"></i> Vector Code
</h3>
<div class="text-sm text-gray-500" id="file-info"></div>
</div>
<pre id="svg-code" class="bg-gray-50 p-4 rounded-lg overflow-auto text-sm text-gray-800 max-h-64"></pre>
</div>
<div class="mt-8 bg-blue-50 rounded-lg p-4">
<h4 class="text-md font-medium text-blue-800 mb-2 flex items-center gap-2">
<i data-feather="info"></i> Tips for Best Results
</h4>
<ul class="text-blue-700 text-sm list-disc pl-5 space-y-1">
<li>Use high-resolution source images for better quality</li>
<li>Adjust color count and smoothness for optimal balance</li>
<li>Try different detail levels depending on image complexity</li>
<li>For logos, use the highest detail setting</li>
</ul>
</div>
</section>
</div>
</main>
<custom-footer></custom-footer>
<script src="components/navbar.js"></script>
<script src="components/footer.js"></script>
<script src="script.js"></script>
<script>
feather.replace();
// VANTA.WAVES({
// el: "body",
// mouseControls: true,
// touchControls: true,
// gyroControls: false,
// minHeight: 200.00,
// minWidth: 200.00,
// scale: 1.00,
// scaleMobile: 1.00,
// color: 0xdddddd,
// shininess: 100.00,
// waveHeight: 15.00,
// waveSpeed: 0.25,
// zoom: 1.00
// });
</script>
<script src="https://huggingface.co/deepsite/deepsite-badge.js"></script>
</body>
</html>