Use createImageBitmap as hailmary

This commit is contained in:
Surma
2018-07-19 14:37:36 +01:00
parent b7c223bc0d
commit 13ac3ed5b2
3 changed files with 27 additions and 36 deletions

View File

@@ -26,7 +26,7 @@ import {
encoderMap,
} from '../../codecs/encoders';
import { decodeFile } from '../../codecs/decoders';
import { decodeImage } from '../../codecs/decoders';
interface SourceImage {
file: File;
@@ -180,7 +180,7 @@ export default class App extends Component<Props, State> {
async updateFile(file: File) {
this.setState({ loading: true });
try {
const bmp = await decodeFile(file);
const bmp = await decodeImage(file);
// compute the corresponding ImageData once since it only changes when the file changes:
const data = await bitmapToImageData(bmp);