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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
<!DOCTYPE html>
<html lang="de">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>WDF-Converter | 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;
        }
        
        .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;
        }
        
        .film-selector {
            scrollbar-width: thin;
            scrollbar-color: #555 #222;
        }
        
        .film-selector::-webkit-scrollbar {
            height: 8px;
        }
        
        .film-selector::-webkit-scrollbar-track {
            background: #222;
        }
        
        .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;
        }
        
        .range-slider::-moz-range-thumb {
            width: 18px;
            height: 18px;
            background: #f59e0b;
            border-radius: 50%;
            cursor: pointer;
        }
        
        @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;
        }
    </style>
</head>
<body class="relative overflow-hidden">
    <div class="film-grain"></div>
    <div class="vintage-border"></div>
    
    <div class="container mx-auto px-4 py-8">
        <!-- Header -->
        <header class="flex justify-between items-center mb-8">
            <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</span></h1>
            </div>
            <div class="hidden md:flex space-x-4">
                <button class="px-4 py-2 bg-gray-800 hover:bg-gray-700 rounded-lg flex items-center">
                    <i class="fas fa-book mr-2"></i> Dokumentation
                </button>
                <button class="px-4 py-2 bg-gray-800 hover:bg-gray-700 rounded-lg flex items-center">
                    <i class="fas fa-cog mr-2"></i> Einstellungen
                </button>
            </div>
        </header>
        
        <div class="flex flex-col lg:flex-row gap-8">
            <!-- Left Panel - Camera Preview and Controls -->
            <div class="w-full lg:w-1/2">
                <div class="camera-preview rounded-lg overflow-hidden relative aspect-[4/3] mb-4">
                    <div class="scanline"></div>
                    <video id="camera-feed" class="w-full h-full object-cover" autoplay></video>
                    <canvas id="photo-canvas" class="absolute top-0 left-0 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>
                    </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>
                    
                    <div class="mb-4">
                        <label class="block text-sm font-medium mb-1">Blitzmodus</label>
                        <div class="flex space-x-2">
                            <button class="flex-1 py-2 bg-gray-700 hover:bg-gray-600 rounded">Aus</button>
                            <button class="flex-1 py-2 bg-gray-700 hover:bg-gray-600 rounded">Ein</button>
                            <button class="flex-1 py-2 bg-gray-700 hover:bg-gray-600 rounded">Auto</button>
                        </div>
                    </div>
                    
                    <div class="mb-4">
                        <label class="block text-sm font-medium mb-1">Delay (s)</label>
                        <div class="flex space-x-2">
                            <button class="py-2 px-3 bg-gray-700 hover:bg-gray-600 rounded">0</button>
                            <button class="py-2 px-3 bg-gray-700 hover:bg-gray-600 rounded">3</button>
                            <button class="py-2 px-3 bg-gray-700 hover:bg-gray-600 rounded">5</button>
                            <button class="py-2 px-3 bg-gray-700 hover:bg-gray-600 rounded">10</button>
                        </div>
                    </div>
                </div>
            </div>
            
            <!-- Right Panel - Image Processing -->
            <div class="w-full lg:w-1/2">
                <div class="bg-gray-900 rounded-lg p-6 mb-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 flex overflow-x-auto pb-4 mb-4 space-x-3">
                        <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="mb-4">
                        <label class="block text-sm font-medium mb-1">Benutzerdefiniertes Profil</label>
                        <button 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 mb-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</label>
                            <input 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</label>
                            <input 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</label>
                                <input 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</label>
                                <input 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</label>
                                <input 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</label>
                                <input 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 class="flex-1 py-2 bg-amber-600 hover:bg-amber-700 rounded">Automatisch</button>
                                <button class="flex-1 py-2 bg-gray-700 hover:bg-gray-600 rounded">Manuell</button>
                            </div>
                        </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">
                        <div class="aspect-square bg-gray-800 rounded-lg"></div>
                        <div class="aspect-square bg-gray-800 rounded-lg"></div>
                        <div class="aspect-square bg-gray-800 rounded-lg"></div>
                        <div class="aspect-square bg-gray-800 rounded-lg"></div>
                        <div class="aspect-square bg-gray-800 rounded-lg"></div>
                        <div class="aspect-square bg-gray-800 rounded-lg"></div>
                    </div>
                    
                    <div class="flex space-x-3">
                        <button class="flex-1 bg-gray-700 hover:bg-gray-600 py-2 px-4 rounded-lg">
                            <i class="fas fa-folder mr-1"></i> Öffnen
                        </button>
                        <button class="flex-1 bg-gray-700 hover:bg-gray-600 py-2 px-4 rounded-lg">
                            <i class="fas fa-save mr-1"></i> Speichern
                        </button>
                        <button class="flex-1 bg-amber-600 hover:bg-amber-700 py-2 px-4 rounded-lg">
                            <i class="fas fa-print mr-1"></i> Drucken
                        </button>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <script>
        document.addEventListener('DOMContentLoaded', function() {
            // Camera 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');
            
            // Image processing elements
            const filmCards = document.querySelectorAll('.film-card');
            
            // Camera state
            let currentStream = null;
            let currentCamera = 'environment'; // or 'user' for front camera
            let isProcessing = false;
            
            // Initialize the camera
            function initCamera(cameraType) {
                if (currentStream) {
                    currentStream.getTracks().forEach(track => track.stop());
                }
                
                const constraints = {
                    video: {
                        facingMode: cameraType,
                        width: { ideal: 1280 },
                        height: { ideal: 720 }
                    },
                    audio: false
                };
                
                navigator.mediaDevices.getUserMedia(constraints)
                    .then(function(stream) {
                        currentStream = stream;
                        cameraFeed.srcObject = stream;
                        
                        // Set canvas dimensions to match video feed
                        cameraFeed.onloadedmetadata = function() {
                            const videoWidth = cameraFeed.videoWidth;
                            const videoHeight = cameraFeed.videoHeight;
                            
                            // Maintain aspect ratio but limit to container
                            const containerRatio = 4/3;
                            const videoRatio = videoWidth / videoHeight;
                            
                            if (containerRatio > videoRatio) {
                                photoCanvas.width = videoHeight * containerRatio;
                                photoCanvas.height = videoHeight;
                            } else {
                                photoCanvas.width = videoWidth;
                                photoCanvas.height = videoWidth / containerRatio;
                            }
                        };
                    })
                    .catch(function(err) {
                        console.error("Error accessing camera:", err);
                        // Fallback to placeholder image
                        cameraFeed.src = 'placeholder.jpg';
                    });
            }
            
            // Capture photo
            captureBtn.addEventListener('click', function() {
                if (isProcessing) return;
                
                isProcessing = true;
                loadingIndicator.classList.remove('hidden');
                
                // Hide video and show canvas
                cameraFeed.classList.add('hidden');
                photoCanvas.classList.remove('hidden');
                
                // Draw the current frame to canvas
                const ctx = photoCanvas.getContext('2d');
                ctx.drawImage(cameraFeed, 0, 0, photoCanvas.width, photoCanvas.height);
                
                // Simulate processing delay
                setTimeout(function() {
                    // Here we would normally process the image
                    // For now, we'll just simulate the conversion
                    
                    // Show a flash effect
                    photoCanvas.style.transition = 'filter 0.2s';
                    photoCanvas.style.filter = 'brightness(2)';
                    
                    setTimeout(function() {
                        photoCanvas.style.filter = 'none';
                        
                        // Process the image (this is where actual conversion would happen)
                        processNegativeToPositive();
                        
                        // Show the processed result
                        loadingIndicator.classList.add('hidden');
                        isProcessing = false;
                        
                        // Optionally: add the photo to the results grid
                    }, 200);
                }, 1000); // Simulate 1 second processing time
            });
            
            // Toggle camera direction
            toggleCameraBtn.addEventListener('click', function() {
                currentCamera = currentCamera === 'user' ? 'environment' : 'user';
                initCamera(currentCamera);
            });
            
            // Film profile selection
            filmCards.forEach(card => {
                card.addEventListener('click', function() {
                    // Remove active class from all cards
                    filmCards.forEach(c => {
                        c.classList.remove('border-amber-500');
                        c.classList.add('border-gray-700');
                    });
                    
                    // Add active class to clicked card
                    this.classList.add('border-amber-500');
                    this.classList.remove('border-gray-700');
                    
                    // Here you would apply the selected film profile
                });
            });
            
            // Initial setup
            initCamera(currentCamera);
            
            // Simulate negative to positive conversion
            function processNegativeToPositive() {
                const ctx = photoCanvas.getContext('2d');
                const imageData = ctx.getImageData(0, 0, photoCanvas.width, photoCanvas.height);
                const data = imageData.data;
                
                // Simple inversion for demonstration
                for (let i = 0; i < data.length; i += 4) {
                    // Invert RGB channels for negative effect
                    // Note: Real conversion would be more complex and film-specific
                    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
                }
                
                ctx.putImageData(imageData, 0, 0);
            }
        });
    </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" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>