MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / buildMinimalPng

Function buildMinimalPng

packages/engine/src/utils/ffprobe.test.ts:34–54  ·  view source on GitHub ↗
(options?: {
  cIcpAfterIdat?: boolean;
  invalidCrc?: boolean;
  longCicp?: boolean;
})

Source from the content-addressed store, hash-verified

32}
33
34function buildMinimalPng(options?: {
35 cIcpAfterIdat?: boolean;
36 invalidCrc?: boolean;
37 longCicp?: boolean;
38}) {
39 const ihdr = pngChunk("IHDR", [0, 0, 0, 1, 0, 0, 0, 1, 16, 2, 0, 0, 0]);
40 const cicpData = options?.longCicp ? [9, 16, 0, 1, 255] : [9, 16, 0, 1];
41 let cicp = pngChunk("cICP", cicpData);
42 if (options?.invalidCrc) {
43 cicp = Buffer.from(cicp);
44 cicp[cicp.length - 1] ^= 0xff;
45 }
46 const idat = pngChunk(
47 "IDAT",
48 [0x78, 0x9c, 0x63, 0x60, 0x60, 0x60, 0x00, 0x00, 0x00, 0x04, 0x00, 0x01],
49 );
50 const iend = pngChunk("IEND", []);
51 return options?.cIcpAfterIdat
52 ? buildPngWithChunks([ihdr, idat, cicp, iend])
53 : buildPngWithChunks([ihdr, cicp, idat, iend]);
54}
55
56describe("extractMediaMetadata", () => {
57 it("reads HDR PNG cICP metadata when ffprobe color fields are absent", async () => {

Callers 1

ffprobe.test.tsFile · 0.85

Calls 3

pngChunkFunction · 0.85
buildPngWithChunksFunction · 0.85
fromMethod · 0.80

Tested by

no test coverage detected