{
  "schemaVersion": 1,
  "title": "Resize Image to KB: reproducible synthetic examples",
  "reviewedDate": "2026-09-05",
  "generatedAt": "2026-09-05T14:09:11.662Z",
  "browser": {
    "name": "Google Chrome, headless Chromium",
    "version": "152.0.7977.83",
    "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/152.0.0.0 Safari/537.36"
  },
  "engine": {
    "source": "webapp/src/shared/resize-image-to-kb.js",
    "sha256": "c6a048694958fe90a33730eddf0ae8be3b44bf5fe1c8b0b7e686bfde74f093bd"
  },
  "generator": {
    "source": "webapp/scripts/benchmark-resize-image-to-kb.mjs",
    "sha256": "ab77da89e3bcda3d6dd249db506fe6c06ac974c959a38f1499f1905e0db3edcc"
  },
  "license": {
    "name": "CC0 1.0 Universal",
    "url": "https://creativecommons.org/publicdomain/zero/1.0/",
    "scope": "Original synthetic fixtures, generated result images, and measurement data in this directory."
  },
  "method": "Generate two synthetic canvas fixtures, import the actual local JPEG engine, encode three fixed-dimension cases, independently decode each JPEG, verify bytes and pixels, and save the original PNGs and resulting JPEGs.",
  "sizeUnits": "1 KB = 1,000 bytes. Maximums are inclusive. Encoder quality is a browser setting, not a visual-quality score.",
  "limitations": [
    "These two synthetic fixtures are demonstrations, not a representative sample of photographs or real signatures.",
    "Encoding bytes and quality choices can vary with browser, browser version, operating system, and engine changes.",
    "Passing the byte and pixel checks does not establish legibility, photographic quality, or acceptance by any external form.",
    "The deliberate 100-byte failure preserves its required 300 by 300 pixels and is published as a failed attempt."
  ],
  "fixtures": [
    {
      "id": "synthetic-strokes",
      "file": "synthetic-strokes.png",
      "description": "Abstract dark pen-like curves on transparency; generated geometry, not a real signature.",
      "width": 900,
      "height": 240,
      "seed": null,
      "bytes": 17794,
      "sha256": "a1bca240be36fe2aee62b557376dcff8b42db61125f4b459714ecd9df225c41a"
    },
    {
      "id": "synthetic-color-chart",
      "file": "synthetic-color-chart.png",
      "description": "Six-by-six color tiles with seeded fine grain; generated raster, not a photograph.",
      "width": 600,
      "height": 600,
      "seed": 20260905,
      "bytes": 1202378,
      "sha256": "1b8dab1ab7b97d10ceb095b7a801bdb6b9f10a9b4ec3c454a69abc900da0cab6"
    }
  ],
  "cases": [
    {
      "id": "strokes-300x80-max20kb",
      "fixtureId": "synthetic-strokes",
      "outputFile": "strokes-300x80-max20kb.jpg",
      "input": {
        "width": 300,
        "height": 80,
        "maxKB": 20,
        "minKB": 0,
        "fit": "contain"
      },
      "expectedPass": true,
      "normalizedRequirements": {
        "maxBytes": 20000,
        "minBytes": 0,
        "width": 300,
        "height": 80,
        "fit": "contain"
      },
      "actualBytes": 14308,
      "width": 300,
      "height": 80,
      "encoderQuality": 1,
      "metRequirements": true,
      "reason": "",
      "engineChecks": {
        "size": {
          "passed": true,
          "actualBytes": 14308,
          "minBytes": 0,
          "maxBytes": 20000
        },
        "dimensions": {
          "passed": true,
          "actualWidth": 300,
          "actualHeight": 80,
          "requiredWidth": 300,
          "requiredHeight": 80
        }
      },
      "independent": {
        "mimeType": "image/jpeg",
        "jpegSignature": true,
        "actualBytes": 14308,
        "decodedWidth": 300,
        "decodedHeight": 80,
        "sizePassed": true,
        "dimensionsPassed": true,
        "topLeftPixel": [
          255,
          255,
          255,
          255
        ]
      },
      "sha256": "1ed21429ba68dca9a22d32cbb11388125a1b8b57979485ed4b4a3202dc937042"
    },
    {
      "id": "chart-300x300-max100kb",
      "fixtureId": "synthetic-color-chart",
      "outputFile": "chart-300x300-max100kb.jpg",
      "input": {
        "width": 300,
        "height": 300,
        "maxKB": 100,
        "minKB": 0,
        "fit": "contain"
      },
      "expectedPass": true,
      "normalizedRequirements": {
        "maxBytes": 100000,
        "minBytes": 0,
        "width": 300,
        "height": 300,
        "fit": "contain"
      },
      "actualBytes": 94178,
      "width": 300,
      "height": 300,
      "encoderQuality": 0.98,
      "metRequirements": true,
      "reason": "",
      "engineChecks": {
        "size": {
          "passed": true,
          "actualBytes": 94178,
          "minBytes": 0,
          "maxBytes": 100000
        },
        "dimensions": {
          "passed": true,
          "actualWidth": 300,
          "actualHeight": 300,
          "requiredWidth": 300,
          "requiredHeight": 300
        }
      },
      "independent": {
        "mimeType": "image/jpeg",
        "jpegSignature": true,
        "actualBytes": 94178,
        "decodedWidth": 300,
        "decodedHeight": 300,
        "sizePassed": true,
        "dimensionsPassed": true,
        "topLeftPixel": [
          75,
          89,
          76,
          255
        ]
      },
      "sha256": "a9a4b4305e892aa8dd7d639b6cacbd5f6bc35076b031342f4a8d632c4e5bd83c"
    },
    {
      "id": "chart-300x300-impossible100bytes",
      "fixtureId": "synthetic-color-chart",
      "outputFile": "chart-300x300-impossible100bytes.jpg",
      "input": {
        "width": 300,
        "height": 300,
        "maxKB": 0.1,
        "minKB": 0,
        "fit": "contain"
      },
      "expectedPass": false,
      "normalizedRequirements": {
        "maxBytes": 100,
        "minBytes": 0,
        "width": 300,
        "height": 300,
        "fit": "contain"
      },
      "actualBytes": 1426,
      "width": 300,
      "height": 300,
      "encoderQuality": 0,
      "metRequirements": false,
      "reason": "The JPEG is still larger than the maximum at these fixed dimensions. Try a larger size limit or smaller dimensions.",
      "engineChecks": {
        "size": {
          "passed": false,
          "actualBytes": 1426,
          "minBytes": 0,
          "maxBytes": 100
        },
        "dimensions": {
          "passed": true,
          "actualWidth": 300,
          "actualHeight": 300,
          "requiredWidth": 300,
          "requiredHeight": 300
        }
      },
      "independent": {
        "mimeType": "image/jpeg",
        "jpegSignature": true,
        "actualBytes": 1426,
        "decodedWidth": 300,
        "decodedHeight": 300,
        "sizePassed": false,
        "dimensionsPassed": true,
        "topLeftPixel": [
          64,
          64,
          64,
          255
        ]
      },
      "sha256": "73dd82a5ab268df8b9c59332881aafad52820fba80858407ad7a0c3670411667"
    }
  ]
}
