moshensky / pdf-visual-diff

Visual Regression Testing for PDFs in JavaScript
MIT License
42 stars 18 forks source link

Minor enhancement suggestion: Allow users to write text on masks #56

Closed Songyu-Wang closed 2 months ago

Songyu-Wang commented 1 year ago

I think it would be fairly easy to update the code at

https://github.com/moshensky/pdf-visual-diff/blob/master/src/compare-pdf-to-snapshot.ts#L37C8-L39C10

to something like this

 if (type === 'rectangle-mask') {
         let  mask = new Jimp(width, height, colorToNum[color])
          mask.print(...)  // process mask with https://github.com/jimp-dev/jimp/tree/main/packages/plugin-print
          img.composite(mask, x, y)
        }

With this update, a user can easily communicate what each mask region is for. the screenshots could be easier to understand in the follow use cases:

  1. if the creator and the maintainer are not the same person
  2. The code was written a long time ago
  3. code review
moshensky commented 1 year ago

You are right, it indeed looks somewhat easy to be added. Would you like to contribute?

Songyu-Wang commented 1 year ago

Unfortunately, not at the moment because I found this repo via work related reasons and we have a open source contribution approval process with legal that I'm not really excited to go through (yes, even for MIT).

I'm happy to contribute if my employer decides to adopt this tool so I have a business case to make. Or a few years later when the policy changes

moshensky commented 2 months ago

I don’t have immediate plans to implement this functionality at the moment, so I’ll be closing the issue for now. If anyone would like to see this feature added in the future, feel free to comment or reopen the issue.