Skip to content
This repository has been archived by the owner on Sep 29, 2020. It is now read-only.

Apply watermark as a tile: multiple consequtive watermarks #52

Open
shershen08 opened this issue Oct 10, 2018 · 1 comment
Open

Apply watermark as a tile: multiple consequtive watermarks #52

shershen08 opened this issue Oct 10, 2018 · 1 comment

Comments

@shershen08
Copy link

shershen08 commented Oct 10, 2018

Consider the use case if I need to cover all the space of the source image with watermark. So use watermark as a tile: an example of what I want to achieve - tiled watermark image

For now I see the solution only in combing multiple atPos from the docs calls, depending on the size

Something like this:

// getX, getY - functions
let intermediate;
let counter = 0
const nextStep = () => {
  counter++;
  if counter < NEEDED_AMOUNT {
    applySingleWatermark(intermediate || '/img/my_source_image.png')
  }
}
const applySingleWatermark = (source) => {
 watermark([source, '/img/my_watermark.png'])
    .image(watermark.image.atPos(getX, getY, 0.6)).
    .then(data => {
      intermediate= data
      nextStep()
   )
}

Is there a better way?

If not, do you see a value in creating such functionality and submitting an MR ?

@shershen08
Copy link
Author

Here's a demo implementation of tiling with current API
if someone will need it - https://codepen.io/shershen08/pen/KGmwmg

What you'll get is smth like:
d24b5fe4-408d-4c6c-abc6-1e43a16d45e3

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

No branches or pull requests

1 participant