Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting import error for ImageKind in Angular 12 #584

Open
mshariq-nerd opened this issue Mar 7, 2022 · 2 comments
Open

Getting import error for ImageKind in Angular 12 #584

mshariq-nerd opened this issue Mar 7, 2022 · 2 comments

Comments

@mshariq-nerd
Copy link

Import statement is like
import { Image, ImageKind } from "image-js";

Error in code block

    new Image(options.width, options.height, data.buffer, { bitDepth: options.depth, kind: ImageKind.RGBA })
      .toBlob().then(image => {
        let objectURL = URL.createObjectURL(image);
        this.image = this.sanitizer.bypassSecurityTrustUrl(objectURL);
      });

Throwing error in console
export 'ImageKind' (imported as 'ImageKind') was not found in 'image-js' (possible exports: Image, Kernel, Shape, Stack, Static, Worker, default)

@gianluca-moro
Copy link
Contributor

Having the same issue. Did you find a solution?

@kackyt
Copy link

kackyt commented Jan 5, 2023

@mshariq-nerd @gianluca-m
Workaround code is here.

    new Image(options.width, options.height, data.buffer, { bitDepth: options.depth, kind: 'RGBA' as ImageKind })
      .toBlob().then(image => {
        let objectURL = URL.createObjectURL(image);
        this.image = this.sanitizer.bypassSecurityTrustUrl(objectURL);
      });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants