MCPcopy Index your code
hub / github.com/ColmapView/Colmapview.github.io / toBlob

Function toBlob

src/utils/imageFileCompression.ts:95–107  ·  view source on GitHub ↗
(type: string, quality: number)

Source from the content-addressed store, hash-verified

93 ctx.drawImage(bitmap, 0, 0, targetWidth, targetHeight);
94 },
95 toBlob(type: string, quality: number): Promise<Blob> {
96 if (isOffscreenCanvas(canvas)) {
97 return canvas.convertToBlob({ type, quality });
98 }
99
100 return new Promise<Blob>((resolve, reject) => {
101 canvas.toBlob(
102 (blob: Blob | null) => blob ? resolve(blob) : reject(new Error('Failed to create blob')),
103 type,
104 quality
105 );
106 });
107 },
108 };
109}

Callers

nothing calls this directly

Calls 4

isOffscreenCanvasFunction · 0.90
convertToBlobMethod · 0.80
resolveFunction · 0.70
toBlobMethod · 0.65

Tested by

no test coverage detected