UnSinnlos commited on
Commit
033b9db
·
verified ·
1 Parent(s): 61bb8b6

das ergebnis ist ein negativ dreh schwarz und weiß um

Browse files
Files changed (1) hide show
  1. index.html +13 -20
index.html CHANGED
@@ -382,35 +382,28 @@
382
  data[i + 1] = avg;
383
  data[i + 2] = avg;
384
  }
385
-
386
- // Apply edge detection (simple inversion for demo)
387
  for (let i = 0; i < data.length; i += 4) {
388
- data[i] = 255 - data[i];
389
- data[i + 1] = 255 - data[i + 1];
390
- data[i + 2] = 255 - data[i + 2];
 
391
  }
392
-
393
- // Apply blur effect based on slider
394
  const blurAmount = document.getElementById('blur-slider').value;
395
  if (blurAmount > 0) {
396
  ctx.filter = `blur(${blurAmount}px)`;
397
  ctx.drawImage(canvas, 0, 0);
398
  ctx.filter = 'none';
399
  }
400
-
401
- // Apply line thickness (simple threshold adjustment)
402
- const thickness = document.getElementById('thickness-slider').value;
403
- const threshold = 128 + (thickness * 10);
404
-
405
- for (let i = 0; i < data.length; i += 4) {
406
- const avg = (data[i] + data[i + 1] + data[i + 2]) / 3;
407
- const val = avg > threshold ? 255 : 0;
408
- data[i] = val;
409
- data[i + 1] = val;
410
- data[i + 2] = val;
411
  }
412
-
413
- ctx.putImageData(imageData, 0, 0);
414
 
415
  // Show results
416
  originalDisplay.src = imagePreview.src;
 
382
  data[i + 1] = avg;
383
  data[i + 2] = avg;
384
  }
385
+ // Convert to grayscale and invert
 
386
  for (let i = 0; i < data.length; i += 4) {
387
+ const avg = (data[i] + data[i + 1] + data[i + 2]) / 3;
388
+ data[i] = 255 - avg;
389
+ data[i + 1] = 255 - avg;
390
+ data[i + 2] = 255 - avg;
391
  }
392
+ // Apply blur effect based on slider
 
393
  const blurAmount = document.getElementById('blur-slider').value;
394
  if (blurAmount > 0) {
395
  ctx.filter = `blur(${blurAmount}px)`;
396
  ctx.drawImage(canvas, 0, 0);
397
  ctx.filter = 'none';
398
  }
399
+ // Apply blur effect based on slider
400
+ const blurAmount = document.getElementById('blur-slider').value;
401
+ if (blurAmount > 0) {
402
+ ctx.filter = `blur(${blurAmount}px)`;
403
+ ctx.drawImage(canvas, 0, 0);
404
+ ctx.filter = 'none';
 
 
 
 
 
405
  }
406
+ ctx.putImageData(imageData, 0, 0);
 
407
 
408
  // Show results
409
  originalDisplay.src = imagePreview.src;