Skip to content

Random compare output image #219

@mspace

Description

@mspace

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions