Files
squoosh/src/codecs/browser-png/decoder.ts
2018-07-20 10:56:36 +01:00

16 lines
589 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { canDecode, fileToBitmap } from '../../lib/util';
export const name = 'Browser PNG Decoder';
export const supportedExtensions = ['png'];
export const supportedMimeTypes = ['image/png'];
export async function decode(file: File): Promise<ImageBitmap> {
return fileToBitmap(file);
}
// tslint:disable-next-line:max-line-length Its a data URL. Whatcha gonna do?
const pngFile = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=';
export function isSupported(): Promise<boolean> {
return canDecode(pngFile);
}