Spaces:
Running
Running
Download index.html from WDFluho/wdf-converter-pro: direct link, hf CLI and curl.
- Browser
- Download file 43.8 kB
-
https://huggingface.co/spaces/WDFluho/wdf-converter-pro/resolve/main/index.html
- Command line
-
hf download hf://spaces/WDFluho/wdf-converter-pro/index.html
-
curl -L -o index.html https://huggingface.co/spaces/WDFluho/wdf-converter-pro/resolve/main/index.html
43.8 kB
| <html lang="de"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>WDF-Converter Pro | Negativ zu Positiv Konvertierung</title> | |
| <script src="https://cdn.tailwindcss.com"></script> | |
| <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"> | |
| <style> | |
| @import url('https://fonts.googleapis.com/css2?family=Roboto+Mono:wght@400;500;700&display=swap'); | |
| body { | |
| font-family: 'Roboto Mono', monospace; | |
| background-color: #1a1a1a; | |
| color: #e0e0e0; | |
| overflow-x: hidden; | |
| } | |
| .film-grain { | |
| position: fixed; | |
| top: 0; | |
| left: 0; | |
| width: 100%; | |
| height: 100%; | |
| background-image: url('data:image/svg+xml;utf8,<svg viewBox="0 0 500 500" xmlns="http://www.w3.org/2000/svg"><filter id="noise"><feTurbulence type="fractalNoise" baseFrequency="1" numOctaves="1" stitchTiles="stitch"/><feColorMatrix type="saturate" values="0"/></filter><rect width="500" height="500" filter="url(%23noise)" opacity="0.05"/></svg>'); | |
| pointer-events: none; | |
| z-index: 50; | |
| } | |
| .camera-preview { | |
| background-color: #000; | |
| background-image: | |
| linear-gradient(45deg, #222 25%, transparent 25%), | |
| linear-gradient(-45deg, #222 25%, transparent 25%), | |
| linear-gradient(45deg, transparent 75%, #222 75%), | |
| linear-gradient(-45deg, transparent 75%, #222 75%); | |
| background-size: 20px 20px; | |
| background-position: 0 0, 0 10px, 10px -10px, -10px 0px; | |
| position: relative; | |
| min-height: 400px; | |
| } | |
| .film-selector { | |
| scrollbar-width: thin; | |
| scrollbar-color: #555 #222; | |
| display: flex; | |
| overflow-x: auto; | |
| padding-bottom: 1rem; | |
| } | |
| .film-selector::-webkit-scrollbar { | |
| height: 8px; | |
| } | |
| .film-selector::-webkit-scrollbar-track { | |
| background: #222; | |
| border-radius: 4px; | |
| } | |
| .film-selector::-webkit-scrollbar-thumb { | |
| background-color: #555; | |
| border-radius: 4px; | |
| } | |
| .range-slider::-webkit-slider-thumb { | |
| -webkit-appearance: none; | |
| width: 18px; | |
| height: 18px; | |
| background: #f59e0b; | |
| border-radius: 50%; | |
| cursor: pointer; | |
| transition: all 0.2s; | |
| } | |
| .range-slider::-moz-range-thumb { | |
| width: 18px; | |
| height: 18px; | |
| background: #f59e0b; | |
| border-radius: 50%; | |
| cursor: pointer; | |
| transition: all 0.2s; | |
| } | |
| @keyframes scanline { | |
| 0% { top: -100%; } | |
| 100% { top: 100%; } | |
| } | |
| .scanline { | |
| position: absolute; | |
| width: 100%; | |
| height: 2px; | |
| background: rgba(255, 255, 255, 0.2); | |
| animation: scanline 5s linear infinite; | |
| z-index: 10; | |
| } | |
| .vintage-border { | |
| position: absolute; | |
| top: 0; | |
| left: 0; | |
| width: 100%; | |
| height: 100%; | |
| border: 15px solid transparent; | |
| border-image: linear-gradient(135deg, rgba(210,180,140,0.5) 0%, rgba(210,180,140,0) 40%, rgba(210,180,140,0.5) 60%, rgba(210,180,140,0) 100%); | |
| border-image-slice: 1; | |
| pointer-events: none; | |
| z-index: 20; | |
| } | |
| .result-thumbnail { | |
| transition: all 0.3s ease; | |
| } | |
| .result-thumbnail:hover { | |
| transform: scale(1.05); | |
| box-shadow: 0 0 15px rgba(245, 158, 11, 0.5); | |
| } | |
| #photo-canvas { | |
| display: none; | |
| } | |
| .connected-camera { | |
| animation: pulse 2s infinite; | |
| } | |
| @keyframes pulse { | |
| 0% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.7); } | |
| 70% { box-shadow: 0 0 0 10px rgba(74, 222, 128, 0); } | |
| 100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); } | |
| } | |
| </style> | |
| </head> | |
| <body class="relative overflow-x-hidden"> | |
| <div class="film-grain"></div> | |
| <div class="vintage-border"></div> | |
| <div class="container mx-auto px-4 py-8"> | |
| <!-- Header --> | |
| <header class="flex flex-wrap justify-between items-center mb-8 gap-4"> | |
| <div class="flex items-center"> | |
| <i class="fas fa-camera-retro text-3xl text-amber-500 mr-3"></i> | |
| <h1 class="text-3xl font-bold">WDF-<span class="text-amber-500">Converter Pro</span></h1> | |
| </div> | |
| <div class="flex space-x-4"> | |
| <button id="help-btn" class="px-3 py-1 md:px-4 md:py-2 bg-gray-800 hover:bg-gray-700 rounded-lg flex items-center"> | |
| <i class="fas fa-question-circle mr-2"></i> <span class="hidden md:inline">Hilfe</span> | |
| </button> | |
| <button id="settings-btn" class="px-3 py-1 md:px-4 md:py-2 bg-gray-800 hover:bg-gray-700 rounded-lg flex items-center"> | |
| <i class="fas fa-cog mr-2"></i> <span class="hidden md:inline">Einstellungen</span> | |
| </button> | |
| </div> | |
| </header> | |
| <!-- Connection Status --> | |
| <div class="bg-gray-800 rounded-lg p-3 mb-6 flex items-center hidden" id="connection-status"> | |
| <div class="w-3 h-3 rounded-full bg-green-500 mr-2"></div> | |
| <span id="status-text" class="text-sm">Verbunden mit: Canon EOS 5D Mark IV</span> | |
| </div> | |
| <div class="flex flex-col lg:flex-row gap-8"> | |
| <!-- Left Panel - Camera Preview and Controls --> | |
| <div class="w-full lg:w-1/2 space-y-6"> | |
| <div class="camera-preview rounded-lg overflow-hidden relative"> | |
| <div class="scanline"></div> | |
| <video id="camera-feed" class="w-full h-full object-contain bg-black" autoplay playsinline></video> | |
| <canvas id="photo-canvas" class="w-full h-full hidden"></canvas> | |
| <div id="loading-indicator" class="absolute inset-0 bg-black bg-opacity-70 flex items-center justify-center hidden"> | |
| <div class="animate-spin rounded-full h-16 w-16 border-t-2 border-b-2 border-amber-500"></div> | |
| <span class="ml-4">Bild wird verarbeitet...</span> | |
| </div> | |
| <div id="no-camera" class="absolute inset-0 bg-black flex flex-col items-center justify-center p-4"> | |
| <i class="fas fa-camera-slash text-5xl text-gray-600 mb-4"></i> | |
| <h3 class="text-xl font-bold mb-2">Keine Kamera verbunden</h3> | |
| <p class="text-gray-400 text-center mb-4">Bitte verbinden Sie eine Kamera oder aktivieren Sie die Webcam</p> | |
| <div class="flex space-x-3"> | |
| <button id="connect-dslr-btn" class="bg-amber-600 hover:bg-amber-700 text-white py-2 px-4 rounded-lg flex items-center"> | |
| <i class="fas fa-plug mr-2"></i> DSLR verbinden | |
| </button> | |
| <button id="enable-webcam-btn" class="bg-gray-700 hover:bg-gray-600 text-white py-2 px-4 rounded-lg flex items-center"> | |
| <i class="fas fa-laptop mr-2"></i> Webcam aktivieren | |
| </button> | |
| </div> | |
| </div> | |
| </div> | |
| <div class="bg-gray-900 rounded-lg p-6"> | |
| <h2 class="text-xl font-bold mb-4 flex items-center"> | |
| <i class="fas fa-camera mr-2"></i> Kamerasteuerung | |
| </h2> | |
| <div class="grid grid-cols-2 gap-4 mb-4"> | |
| <button id="capture-btn" class="bg-amber-600 hover:bg-amber-700 text-white py-3 px-4 rounded-lg flex items-center justify-center"> | |
| <i class="fas fa-camera mr-2"></i> Aufnahme | |
| </button> | |
| <button id="toggle-camera-btn" class="bg-gray-700 hover:bg-gray-600 text-white py-3 px-4 rounded-lg flex items-center justify-center"> | |
| <i class="fas fa-sync-alt mr-2"></i> Kamera wechseln | |
| </button> | |
| </div> | |
| <!-- DSLR Controls --> | |
| <div id="dslr-controls" class="hidden space-y-4"> | |
| <h3 class="font-bold border-b border-gray-700 pb-2">DSLR-Einstellungen</h3> | |
| <div class="grid grid-cols-2 gap-4"> | |
| <div> | |
| <label class="block text-sm font-medium mb-1">Blende</label> | |
| <select class="w-full bg-gray-800 border border-gray-700 rounded-lg p-2"> | |
| <option>f/2.8</option> | |
| <option>f/4</option> | |
| <option>f/5.6</option> | |
| <option>f/8</option> | |
| <option>f/11</option> | |
| <option>f/16</option> | |
| </select> | |
| </div> | |
| <div> | |
| <label class="block text-sm font-medium mb-1">Verschlusszeit</label> | |
| <select class="w-full bg-gray-800 border border-gray-700 rounded-lg p-2"> | |
| <option>1/60</option> | |
| <option>1/125</option> | |
| <option>1/250</option> | |
| <option>1/500</option> | |
| <option>1/1000</option> | |
| </select> | |
| </div> | |
| </div> | |
| <div> | |
| <label class="block text-sm font-medium mb-1">ISO</label> | |
| <select class="w-full bg-gray-800 border border-gray-700 rounded-lg p-2"> | |
| <option>100</option> | |
| <option>200</option> | |
| <option>400</option> | |
| <option>800</option> | |
| <option>1600</option> | |
| </select> | |
| </div> | |
| <div> | |
| <label class="block text-sm font-medium mb-1">Weißabgleich</label> | |
| <select class="w-full bg-gray-800 border border-gray-700 rounded-lg p-2"> | |
| <option>Automatisch</option> | |
| <option>Tageslicht</option> | |
| <option>Schatten</option> | |
| <option>Kunstlicht</option> | |
| <option>Neonlicht</option> | |
| <option>Manuell</option> | |
| </select> | |
| </div> | |
| </div> | |
| <!-- Webcam Controls --> | |
| <div id="webcam-controls" class="space-y-4"> | |
| <div> | |
| <label class="block text-sm font-medium mb-1">Blitzmodus</label> | |
| <div class="flex space-x-2"> | |
| <button id="flash-off" class="flex-1 py-2 bg-gray-700 hover:bg-gray-600 rounded">Aus</button> | |
| <button id="flash-on" class="flex-1 py-2 bg-gray-700 hover:bg-gray-600 rounded">Ein</button> | |
| <button id="flash-auto" class="flex-1 py-2 bg-gray-700 hover:bg-gray-600 rounded">Auto</button> | |
| </div> | |
| </div> | |
| <div> | |
| <label class="block text-sm font-medium mb-1">Delay (s)</label> | |
| <div class="flex space-x-2"> | |
| <button class="timer-btn py-2 px-3 bg-gray-700 hover:bg-gray-600 rounded" data-time="0">0</button> | |
| <button class="timer-btn py-2 px-3 bg-gray-700 hover:bg-gray-600 rounded" data-time="3">3</button> | |
| <button class="timer-btn py-2 px-3 bg-gray-700 hover:bg-gray-600 rounded" data-time="5">5</button> | |
| <button class="timer-btn py-2 px-3 bg-gray-700 hover:bg-gray-600 rounded" data-time="10">10</button> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Right Panel - Image Processing --> | |
| <div class="w-full lg:w-1/2 space-y-6"> | |
| <div class="bg-gray-900 rounded-lg p-6"> | |
| <h2 class="text-xl font-bold mb-4 flex items-center"> | |
| <i class="fas fa-film mr-2"></i> Filmprofil | |
| </h2> | |
| <div class="film-selector"> | |
| <div class="film-card flex-shrink-0 w-32 h-32 bg-gray-800 rounded-lg flex flex-col items-center justify-center border-2 border-gray-700 hover:border-amber-500 cursor-pointer"> | |
| <div class="h-16 w-16 bg-gradient-to-br from-gray-300 to-gray-500 rounded-full mb-2"></div> | |
| <span class="text-xs font-bold">Ilford HP5+</span> | |
| <span class="text-xs text-gray-400">BW 400</span> | |
| </div> | |
| <div class="film-card flex-shrink-0 w-32 h-32 bg-gray-800 rounded-lg flex flex-col items-center justify-center border-2 border-gray-700 hover:border-amber-500 cursor-pointer"> | |
| <div class="h-16 w-16 bg-gradient-to-br from-blue-900 via-purple-700 to-red-600 rounded-full mb-2"></div> | |
| <span class="text-xs font-bold">Kodak Portra</span> | |
| <span class="text-xs text-gray-400">Color 400</span> | |
| </div> | |
| <div class="film-card flex-shrink-0 w-32 h-32 bg-gray-800 rounded-lg flex flex-col items-center justify-center border-2 border-gray-700 hover:border-amber-500 cursor-pointer"> | |
| <div class="h-16 w-16 bg-gradient-to-br from-green-800 to-green-500 rounded-full mb-2"></div> | |
| <span class="text-xs font-bold">Fuji Pro 400H</span> | |
| <span class="text-xs text-gray-400">Color 400</span> | |
| </div> | |
| <div class="film-card flex-shrink-0 w-32 h-32 bg-gray-800 rounded-lg flex flex-col items-center justify-center border-2 border-gray-700 hover:border-amber-500 cursor-pointer"> | |
| <div class="h-16 w-16 bg-gradient-to-br from-gray-200 to-gray-400 rounded-full mb-2"></div> | |
| <span class="text-xs font-bold">Kodak T-Max</span> | |
| <span class="text-xs text-gray-400">BW 100</span> | |
| </div> | |
| <div class="film-card flex-shrink-0 w-32 h-32 bg-gray-800 rounded-lg flex flex-col items-center justify-center border-2 border-gray-700 hover:border-amber-500 cursor-pointer"> | |
| <div class="h-16 w-16 bg-gradient-to-br from-red-900 to-yellow-600 rounded-full mb-2"></div> | |
| <span class="text-xs font-bold">Kodak Ektachrome</span> | |
| <span class="text-xs text-gray-400">Slide 100</span> | |
| </div> | |
| </div> | |
| <div class="mt-4"> | |
| <label class="block text-sm font-medium mb-1">Benutzerdefiniertes Profil</label> | |
| <button id="create-profile-btn" class="w-full bg-gray-800 hover:bg-gray-700 py-2 px-4 rounded-lg flex items-center justify-center"> | |
| <i class="fas fa-plus-circle mr-2"></i> Neues Profil erstellen | |
| </button> | |
| </div> | |
| </div> | |
| <div class="bg-gray-900 rounded-lg p-6"> | |
| <h2 class="text-xl font-bold mb-4 flex items-center"> | |
| <i class="fas fa-sliders-h mr-2"></i> Entwicklungseinstellungen | |
| </h2> | |
| <div class="space-y-4"> | |
| <div> | |
| <label class="block text-sm font-medium mb-1">Helligkeit <span id="brightness-value" class="text-amber-500">100</span></label> | |
| <input id="brightness-slider" type="range" min="0" max="200" value="100" class="w-full range-slider bg-gray-700 rounded-lg appearance-none h-2"> | |
| </div> | |
| <div> | |
| <label class="block text-sm font-medium mb-1">Kontrast <span id="contrast-value" class="text-amber-500">100</span></label> | |
| <input id="contrast-slider" type="range" min="0" max="200" value="100" class="w-full range-slider bg-gray-700 rounded-lg appearance-none h-2"> | |
| </div> | |
| <div class="grid grid-cols-2 gap-4"> | |
| <div> | |
| <label class="block text-sm font-medium mb-1">Schatten <span id="shadows-value" class="text-amber-500">50</span></label> | |
| <input id="shadows-slider" type="range" min="0" max="100" value="50" class="w-full range-slider bg-gray-700 rounded-lg appearance-none h-2"> | |
| </div> | |
| <div> | |
| <label class="block text-sm font-medium mb-1">Lichter <span id="highlights-value" class="text-amber-500">50</span></label> | |
| <input id="highlights-slider" type="range" min="0" max="100" value="50" class="w-full range-slider bg-gray-700 rounded-lg appearance-none h-2"> | |
| </div> | |
| </div> | |
| <div class="grid grid-cols-2 gap-4"> | |
| <div> | |
| <label class="block text-sm font-medium mb-1">Belichtung <span id="exposure-value" class="text-amber-500">0.0</span></label> | |
| <input id="exposure-slider" type="range" min="-2" max="2" step="0.1" value="0" class="w-full range-slider bg-gray-700 rounded-lg appearance-none h-2"> | |
| </div> | |
| <div> | |
| <label class="block text-sm font-medium mb-1">Gamma <span id="gamma-value" class="text-amber-500">1.0</span></label> | |
| <input id="gamma-slider" type="range" min="0.5" max="2.5" step="0.1" value="1" class="w-full range-slider bg-gray-700 rounded-lg appearance-none h-2"> | |
| </div> | |
| </div> | |
| <div> | |
| <label class="block text-sm font-medium mb-1">Farbumkehr</label> | |
| <div class="flex space-x-2"> | |
| <button id="auto-invert-btn" class="flex-1 py-2 bg-amber-600 hover:bg-amber-700 rounded">Automatisch</button> | |
| <button id="manual-invert-btn" class="flex-1 py-2 bg-gray-700 hover:bg-gray-600 rounded">Manuell</button> | |
| </div> | |
| </div> | |
| <div class="pt-2"> | |
| <button id="apply-settings-btn" class="w-full bg-amber-600 hover:bg-amber-700 py-2 px-4 rounded-lg flex items-center justify-center"> | |
| <i class="fas fa-magic mr-2"></i> Einstellungen anwenden | |
| </button> | |
| </div> | |
| </div> | |
| </div> | |
| <div class="bg-gray-900 rounded-lg p-6"> | |
| <h2 class="text-xl font-bold mb-4 flex items-center"> | |
| <i class="fas fa-archive mr-2"></i> Ergebnisse | |
| </h2> | |
| <div class="grid grid-cols-3 gap-2 mb-4" id="results-grid"> | |
| <!-- Results will be added here dynamically --> | |
| </div> | |
| <div class="flex flex-wrap gap-3"> | |
| <button id="open-folder-btn" class="flex-1 min-w-[120px] bg-gray-700 hover:bg-gray-600 py-2 px-4 rounded-lg flex items-center justify-center"> | |
| <i class="fas fa-folder mr-1"></i> Öffnen | |
| </button> | |
| <button id="save-btn" class="flex-1 min-w-[120px] bg-gray-700 hover:bg-gray-600 py-2 px-4 rounded-lg flex items-center justify-center"> | |
| <i class="fas fa-save mr-1"></i> Speichern | |
| </button> | |
| <button id="print-btn" class="flex-1 min-w-[120px] bg-amber-600 hover:bg-amber-700 py-2 px-4 rounded-lg flex items-center justify-center"> | |
| <i class="fas fa-print mr-1"></i> Drucken | |
| </button> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <script> | |
| document.addEventListener('DOMContentLoaded', function() { | |
| // DOM Elements | |
| const cameraFeed = document.getElementById('camera-feed'); | |
| const photoCanvas = document.getElementById('photo-canvas'); | |
| const captureBtn = document.getElementById('capture-btn'); | |
| const toggleCameraBtn = document.getElementById('toggle-camera-btn'); | |
| const loadingIndicator = document.getElementById('loading-indicator'); | |
| const noCameraDiv = document.getElementById('no-camera'); | |
| const resultsGrid = document.getElementById('results-grid'); | |
| const saveBtn = document.getElementById('save-btn'); | |
| const printBtn = document.getElementById('print-btn'); | |
| const openFolderBtn = document.getElementById('open-folder-btn'); | |
| const applySettingsBtn = document.getElementById('apply-settings-btn'); | |
| const connectDslrBtn = document.getElementById('connect-dslr-btn'); | |
| const enableWebcamBtn = document.getElementById('enable-webcam-btn'); | |
| const connectionStatus = document.getElementById('connection-status'); | |
| const statusText = document.getElementById('status-text'); | |
| const dslrControls = document.getElementById('dslr-controls'); | |
| const webcamControls = document.getElementById('webcam-controls'); | |
| // Sliders | |
| const brightnessSlider = document.getElementById('brightness-slider'); | |
| const contrastSlider = document.getElementById('contrast-slider'); | |
| const shadowsSlider = document.getElementById('shadows-slider'); | |
| const highlightsSlider = document.getElementById('highlights-slider'); | |
| const exposureSlider = document.getElementById('exposure-slider'); | |
| const gammaSlider = document.getElementById('gamma-slider'); | |
| // Display values for sliders | |
| const brightnessValue = document.getElementById('brightness-value'); | |
| const contrastValue = document.getElementById('contrast-value'); | |
| const shadowsValue = document.getElementById('shadows-value'); | |
| const highlightsValue = document.getElementById('highlights-value'); | |
| const exposureValue = document.getElementById('exposure-value'); | |
| const gammaValue = document.getElementById('gamma-value'); | |
| // Application state | |
| let currentStream = null; | |
| let currentCamera = 'environment'; | |
| let isProcessing = false; | |
| let currentImageData = null; | |
| let capturedImages = []; | |
| let cameraType = 'none'; // 'none', 'webcam', 'dslr' | |
| let selectedImageIndex = -1; | |
| let timerValue = 0; | |
| // Initialize slider values display | |
| updateSliderValues(); | |
| // Event listeners | |
| brightnessSlider.addEventListener('input', updateSliderValues); | |
| contrastSlider.addEventListener('input', updateSliderValues); | |
| shadowsSlider.addEventListener('input', updateSliderValues); | |
| highlightsSlider.addEventListener('input', updateSliderValues); | |
| exposureSlider.addEventListener('input', updateSliderValues); | |
| gammaSlider.addEventListener('input', updateSliderValues); | |
| document.querySelectorAll('.timer-btn').forEach(btn => { | |
| btn.addEventListener('click', function() { | |
| document.querySelectorAll('.timer-btn').forEach(b => b.classList.remove('bg-amber-600')); | |
| this.classList.add('bg-amber-600'); | |
| timerValue = parseInt(this.dataset.time); | |
| }); | |
| }); | |
| connectDslrBtn.addEventListener('click', connectDslr); | |
| enableWebcamBtn.addEventListener('click', enableWebcam); | |
| captureBtn.addEventListener('click', captureImage); | |
| toggleCameraBtn.addEventListener('click', toggleCamera); | |
| saveBtn.addEventListener('click', saveImage); | |
| printBtn.addEventListener('click', printImage); | |
| openFolderBtn.addEventListener('click', openFolder); | |
| applySettingsBtn.addEventListener('click', applyImageSettings); | |
| // Initialize | |
| checkCameraSupport(); | |
| function updateSliderValues() { | |
| brightnessValue.textContent = brightnessSlider.value; | |
| contrastValue.textContent = contrastSlider.value; | |
| shadowsValue.textContent = shadowsSlider.value; | |
| highlightsValue.textContent = highlightsSlider.value; | |
| exposureValue.textContent = parseFloat(exposureSlider.value).toFixed(1); | |
| gammaValue.textContent = parseFloat(gammaSlider.value).toFixed(1); | |
| } | |
| function checkCameraSupport() { | |
| if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) { | |
| // Webcam is supported | |
| noCameraDiv.classList.remove('hidden'); | |
| cameraFeed.classList.add('hidden'); | |
| } else { | |
| // No camera support | |
| noCameraDiv.classList.remove('hidden'); | |
| cameraFeed.classList.add('hidden'); | |
| noCameraDiv.innerHTML = ` | |
| <i class="fas fa-exclamation-triangle text-5xl text-red-500 mb-4"></i> | |
| <h3 class="text-xl font-bold mb-2">Keine Kameraunterstützung</h3> | |
| <p class="text-gray-400 text-center mb-4">Ihr Browser unterstützt keine Kamera-API</p> | |
| `; | |
| } | |
| } | |
| async function connectDslr() { | |
| try { | |
| // Request access to USB devices | |
| const device = await navigator.usb.requestDevice({ | |
| filters: [ | |
| { vendorId: 0x04a9 }, // Canon | |
| { vendorId: 0x04b0 } // Nikon | |
| ] | |
| }); | |
| // Open the device | |
| await device.open(); | |
| // Claim interface | |
| await device.selectConfiguration(1); | |
| await device.claimInterface(0); | |
| // Update UI | |
| cameraType = 'dslr'; | |
| noCameraDiv.classList.add('hidden'); | |
| cameraFeed.classList.remove('hidden'); | |
| connectionStatus.classList.remove('hidden'); | |
| let cameraName = ''; | |
| if (device.vendorId === 0x04a9) { | |
| cameraName = 'Canon EOS ' + (device.productId === 0x317a ? '5D Mark IV' : 'Kamera'); | |
| } else { | |
| cameraName = 'Nikon D' + (device.productId === 0x0428 ? '850' : 'Kamera'); | |
| } | |
| statusText.textContent = `Verbunden mit: ${cameraName}`; | |
| dslrControls.classList.remove('hidden'); | |
| webcamControls.classList.add('hidden'); | |
| // For demo purposes, we'll simulate live view with a black screen | |
| // In a real app, you would implement PTP/IP or similar protocol | |
| cameraFeed.srcObject = null; | |
| cameraFeed.src = ''; | |
| cameraFeed.style.backgroundColor = '#000'; | |
| // Add connected effect | |
| connectionStatus.classList.add('connected-camera'); | |
| } catch (error) { | |
| console.error('Error connecting to DSLR:', error); | |
| alert('Fehler bei der Verbindung zur DSLR: ' + error.message); | |
| } | |
| } | |
| async function enableWebcam() { | |
| try { | |
| await initCamera('environment'); | |
| cameraType = 'webcam'; | |
| noCameraDiv.classList.add('hidden'); | |
| cameraFeed.classList.remove('hidden'); | |
| dslrControls.classList.add('hidden'); | |
| webcamControls.classList.remove('hidden'); | |
| connectionStatus.classList.add('hidden'); | |
| } catch (error) { | |
| console.error('Error enabling webcam:', error); | |
| alert('Fehler beim Aktivieren der Webcam: ' + error.message); | |
| } | |
| } | |
| async function initCamera(cameraType) { | |
| if (currentStream) { | |
| currentStream.getTracks().forEach(track => track.stop()); | |
| } | |
| const constraints = { | |
| video: { | |
| facingMode: cameraType, | |
| width: { ideal: 1280 }, | |
| height: { ideal: 720 } | |
| }, | |
| audio: false | |
| }; | |
| const stream = await navigator.mediaDevices.getUserMedia(constraints); | |
| currentStream = stream; | |
| cameraFeed.srcObject = stream; | |
| // Set canvas dimensions | |
| cameraFeed.onloadedmetadata = function() { | |
| const videoWidth = cameraFeed.videoWidth; | |
| const videoHeight = cameraFeed.videoHeight; | |
| if (videoWidth && videoHeight) { | |
| // Set canvas size to match video aspect ratio | |
| const targetHeight = 720; | |
| const targetWidth = (videoWidth / videoHeight) * targetHeight; | |
| photoCanvas.width = targetWidth; | |
| photoCanvas.height = targetHeight; | |
| // Adjust for display | |
| const canvasDisplayWidth = cameraFeed.clientWidth; | |
| const canvasDisplayHeight = (targetHeight / targetWidth) * canvasDisplayWidth; | |
| photoCanvas.style.width = `${canvasDisplayWidth}px`; | |
| photoCanvas.style.height = `${canvasDisplayHeight}px`; | |
| } | |
| }; | |
| } | |
| function toggleCamera() { | |
| if (cameraType !== 'webcam') return; | |
| currentCamera = currentCamera === 'user' ? 'environment' : 'user'; | |
| initCamera(currentCamera); | |
| } | |
| async function captureImage() { | |
| if (isProcessing) return; | |
| isProcessing = true; | |
| if (timerValue > 0) { | |
| // Show countdown | |
| const originalText = captureBtn.innerHTML; | |
| for (let i = timerValue; i > 0; i--) { | |
| captureBtn.innerHTML = `<i class="fas fa-camera mr-2"></i> ${i}...`; | |
| await new Promise(resolve => setTimeout(resolve, 1000)); | |
| } | |
| captureBtn.innerHTML = originalText; | |
| } | |
| loadingIndicator.classList.remove('hidden'); | |
| // Flash effect for webcam | |
| if (cameraType === 'webcam') { | |
| cameraFeed.style.transition = 'filter 0.3s'; | |
| cameraFeed.style.filter = 'brightness(2)'; | |
| setTimeout(() => { | |
| cameraFeed.style.filter = 'brightness(1)'; | |
| }, 300); | |
| } | |
| // For DSLR, simulate capture | |
| if (cameraType === 'dslr') { | |
| cameraFeed.style.filter = 'brightness(0)'; | |
| photoCanvas.style.filter = 'brightness(0)'; | |
| setTimeout(() => { | |
| cameraFeed.style.filter = 'brightness(1)'; | |
| photoCanvas.style.filter = 'brightness(1)'; | |
| }, 300); | |
| } | |
| // Capture the frame | |
| const ctx = photoCanvas.getContext('2d'); | |
| if (cameraType === 'webcam') { | |
| ctx.drawImage(cameraFeed, 0, 0, photoCanvas.width, photoCanvas.height); | |
| } else { | |
| // For DSLR demo, use a black frame with text | |
| ctx.fillStyle = '#000'; | |
| ctx.fillRect(0, 0, photoCanvas.width, photoCanvas.height); | |
| ctx.fillStyle = '#fff'; | |
| ctx.font = '30px Roboto Mono'; | |
| ctx.textAlign = 'center'; | |
| ctx.fillText('DSLR Capture Simulation', photoCanvas.width / 2, photoCanvas.height / 2); | |
| } | |
| currentImageData = ctx.getImageData(0, 0, photoCanvas.width, photoCanvas.height); | |
| // Process the image | |
| await processNegativeToPositive(); | |
| // Add to results | |
| addToResults(photoCanvas.toDataURL('image/png')); | |
| loadingIndicator.classList.add('hidden'); | |
| isProcessing = false; | |
| } | |
| async function processNegativeToPositive() { | |
| if (!currentImageData) return; | |
| const data = currentImageData.data; | |
| // Simple inversion for demo (real conversion would be more complex) | |
| for (let i = 0; i < data.length; i += 4) { | |
| // Invert RGB channels | |
| data[i] = 255 - data[i]; // R | |
| data[i + 1] = 255 - data[i + 1]; // G | |
| data[i + 2] = 255 - data[i + 2]; // B | |
| // Alpha channel remains unchanged | |
| } | |
| // Apply current slider settings | |
| applyImageSettings(false); | |
| } | |
| function addToResults(imageUrl) { | |
| const timestamp = new Date().toLocaleTimeString(); | |
| const id = Date.now(); | |
| capturedImages.push({ | |
| id: id, | |
| url: imageUrl, | |
| timestamp: timestamp, | |
| imageData: currentImageData | |
| }); | |
| const resultElement = document.createElement('div'); | |
| resultElement.className = 'result-thumbnail aspect-square bg-gray-800 rounded-lg overflow-hidden relative cursor-pointer'; | |
| resultElement.innerHTML = ` | |
| <img src="${imageUrl}" alt="Captured Image" class="w-full h-full object-cover"> | |
| <div class="absolute bottom-0 left-0 right-0 bg-black bg-opacity-70 p-1 text-xs text-center opacity-0 hover:opacity-100 transition-opacity">${timestamp}</div> | |
| `; | |
| resultElement.addEventListener('click', () => selectImage(id)); | |
| resultsGrid.insertBefore(resultElement, resultsGrid.firstChild); | |
| } | |
| function selectImage(id) { | |
| selectedImageIndex = capturedImages.findIndex(img => img.id === id); | |
| if (selectedImageIndex >= 0) { | |
| // Highlight selected image | |
| document.querySelectorAll('.result-thumbnail').forEach(el => { | |
| el.classList.remove('ring-2', 'ring-amber-500'); | |
| }); | |
| event.currentTarget.classList.add('ring-2', 'ring-amber-500'); | |
| // Load image for editing | |
| const imgData = capturedImages[selectedImageIndex]; | |
| const ctx = photoCanvas.getContext('2d'); | |
| ctx.putImageData(imgData.imageData, 0, 0); | |
| // Show canvas and hide video | |
| cameraFeed.classList.add('hidden'); | |
| photoCanvas.classList.remove('hidden'); | |
| } | |
| } | |
| function applyImageSettings(showPreview = true) { | |
| if (!currentImageData || selectedImageIndex < 0) return; | |
| const data = currentImageData.data; | |
| // Get slider values | |
| const brightness = parseInt(brightnessSlider.value) / 100; | |
| const contrast = parseInt(contrastSlider.value) / 100; | |
| const shadows = parseInt(shadowsSlider.value) / 100; | |
| const highlights = parseInt(highlightsSlider.value) / 100; | |
| const exposure = parseFloat(exposureSlider.value); | |
| const gamma = parseFloat(gammaSlider.value); | |
| // Apply adjustments (simplified for demo) | |
| for (let i = 0; i < data.length; i += 4) { | |
| // Apply brightness | |
| data[i] = Math.min(255, data[i] * brightness); | |
| data[i + 1] = Math.min(255, data[i + 1] * brightness); | |
| data[i + 2] = Math.min(255, data[i + 2] * brightness); | |
| // Apply contrast | |
| const factor = (259 * (contrast + 255)) / (255 * (259 - contrast)); | |
| data[i] = factor * (data[i] - 128) + 128; | |
| data[i + 1] = factor * (data[i + 1] - 128) + 128; | |
| data[i + 2] = factor * (data[i + 2] - 128) + 128; | |
| // Apply gamma correction | |
| data[i] = 255 * Math.pow(data[i] / 255, gamma); | |
| data[i + 1] = 255 * Math.pow(data[i + 1] / 255, gamma); | |
| data[i + 2] = 255 * Math.pow(data[i + 2] / 255, gamma); | |
| } | |
| // Update the image | |
| const ctx = photoCanvas.getContext('2d'); | |
| ctx.putImageData(currentImageData, 0, 0); | |
| // Update the stored image | |
| if (selectedImageIndex >= 0) { | |
| capturedImages[selectedImageIndex].imageData = currentImageData; | |
| // Update the thumbnail preview | |
| const thumbnail = document.querySelector(`[data-id="${capturedImages[selectedImageIndex].id}"]`); | |
| if (thumbnail) { | |
| thumbnail.src = photoCanvas.toDataURL('image/png'); | |
| } | |
| } | |
| // Show flash effect if this is a new capture | |
| if (showPreview) { | |
| photoCanvas.style.transition = 'filter 0.3s'; | |
| photoCanvas.style.filter = 'brightness(1.5)'; | |
| setTimeout(() => { | |
| photoCanvas.style.filter = 'brightness(1)'; | |
| }, 300); | |
| } | |
| } | |
| function saveImage() { | |
| if (selectedImageIndex < 0) { | |
| alert('Bitte wählen Sie zuerst ein Bild aus'); | |
| return; | |
| } | |
| const imageUrl = photoCanvas.toDataURL('image/png'); | |
| const link = document.createElement('a'); | |
| link.download = `negativ_konvertiert_${Date.now()}.png`; | |
| link.href = imageUrl; | |
| link.click(); | |
| } | |
| function printImage() { | |
| if (selectedImageIndex < 0) { | |
| alert('Bitte wählen Sie zuerst ein Bild aus'); | |
| return; | |
| } | |
| const imageUrl = photoCanvas.toDataURL('image/png'); | |
| const printWindow = window.open('', '_blank'); | |
| printWindow.document.write(` | |
| <html> | |
| <head> | |
| <title>Drucken</title> | |
| <style> | |
| body { margin: 0; padding: 0; display: flex; justify-content: center; align-items: center; height: 100vh; } | |
| img { max-width: 100%; max-height: 100vh; } | |
| </style> | |
| </head> | |
| <body> | |
| <img src="${imageUrl}" alt="Zu druckendes Bild"> | |
| <script> | |
| setTimeout(function() { window.print(); window.close(); }, 200); | |
| </script> | |
| <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=WDFluho/wdf-converter-pro" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body> | |
| </html> |