MCPcopy Create free account
hub / github.com/ColmapView/Colmapview.github.io / isJpegFile

Function isJpegFile

src/parsers/imageZipExport.ts:13–18  ·  view source on GitHub ↗
(file: File)

Source from the content-addressed store, hash-verified

11export type ImageFetchFunction = (imageName: string) => Promise<File | null>;
12
13export function isJpegFile(file: File): boolean {
14 const type = file.type.toLowerCase();
15 if (type === 'image/jpeg' || type === 'image/jpg') return true;
16 const name = file.name.toLowerCase();
17 return name.endsWith('.jpg') || name.endsWith('.jpeg');
18}
19
20export async function convertToJpeg(file: File, quality: number): Promise<Blob> {
21 const effectiveQuality = isJpegFile(file) ? Math.min(quality, 0.85) : quality;

Callers 2

convertToJpegFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected