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

Random compare output image #219

Open
mspace opened this issue Nov 24, 2022 · 0 comments
Open

Random compare output image #219

mspace opened this issue Nov 24, 2022 · 0 comments

Comments

@mspace
Copy link

mspace commented Nov 24, 2022

I'm using angular 15 and resemblejs v4.1.0. When compare dialog is opened for multiple times, randomly the compare output swaps left file with right and compare right file with left and not vice-versa.

So the sometimes we get this:

image

and other times (happens randomly) this:

image

Code:

 // left and right images loaded
    if (this.leftFile?.image && this.rightFile?.image && this.leftFile?.includeInCompare && this.rightFile?.includeInCompare) {
      resemble.outputSettings({ useCrossOrigin: false, errorType: 'movement' });

      const leftImageType: string = imageTypeFromExtension(this.leftFile.extension);
      const rightImageType: string = imageTypeFromExtension(this.rightFile.extension);

      const diff: resemble.Comparison = resemble(`data:image/${leftImageType};base64,${this.leftFile.image}`)
        .compareTo(`data:image/${rightImageType};base64,${this.rightFile.image}`)
        .onComplete((data: resemble.ComparisonResult): void => {
          this.compareImage = data.getImageDataUrl();
        });

      return;
    }

I noticed that if we comment next line, compare works fine all the time

resemble.outputSettings({ useCrossOrigin: false, errorType: 'movement' });

Any ideas?

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

1 participant