PageSourceSearch

https://metadatacleaner.app/js/image-cleaner.js

js metadatacleaner.app collected 2026-10-02 01:14:14 UTC 948 bytes, 32 lines download raw bytes

1export async function cleanImage(file) {
2  const mimeMap = {
3    'image/jpeg': 'image/jpeg',
4    'image/png': 'image/png',
5    'image/webp': 'image/webp',
6  };
7
8  const outputType = mimeMap[file.type] || 'image/png';
9  const quality = outputType === 'image/png' ? undefined : 0.95;
10
11  const bitmap = await createImageBitmap(file);
12
13  let blob;
14  if (typeof OffscreenCanvas !== 'undefined') {
15    const canvas = new OffscreenCanvas(bitmap.width, bitmap.height);
16    const ctx = canvas.getContext('2d');
17    ctx.drawImage(bitmap, 0, 0);
18    blob = await canvas.convertToBlob({ type: outputType, quality });
19  } else {
20    const canvas = document.createElement('canvas');
21    canvas.width = bitmap.width;
22    canvas.height = bitmap.height;
23    const ctx = canvas.getContext('2d');
24    ctx.drawImage(bitmap, 0, 0);
25    blob = await new Promise(resolve =>
26      canvas.toBlob(resolve, outputType, quality)
27    );
28  }
29
30  bitmap.close();
31  return blob;
32}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.