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

Enhancements to overlayWith method #239

Closed
lovell opened this issue Jul 11, 2015 · 6 comments
Closed

Enhancements to overlayWith method #239

lovell opened this issue Jul 11, 2015 · 6 comments
Milestone

Comments

@lovell
Copy link
Owner

lovell commented Jul 11, 2015

The main aim here is to add support for Buffer input and allow for differing dimensions with an optional gravity. The API should look something like:

withOverlay(image, options)

where:

  • image is a String filepath or Buffer image data
  • optional options is an Object containing gravity e.g. sharp.gravity.southeast, defaults to sharp.gravity.centre
sharp('under.jpg')
  .overlayWith('over.png', {
    gravity: sharp.gravity.northwest
  })
  .toBuffer()
  .then( function(data) {
      ...
  });

Resizing of the image to overlay can be carried out beforehand using the existing resize method.

Applying a padding to the image to overlay will be possible with #128. This too can be carried out beforehand.

(See #97 for the original work on the overlayWith feature.)

@fentas
Copy link

fentas commented Nov 7, 2015

I am wondering if there is any progress on this?
Especially of using an Buffer (text as watermark).

@lovell
Copy link
Owner Author

lovell commented Nov 9, 2015

@fentas I expect these enhancements to be much easier/faster to implement after #299.

@lovell
Copy link
Owner Author

lovell commented Feb 29, 2016

Commit d92ea31 on the needle/v0.14.0 branch enhances the existing overlayWith method by adding support for Buffer-based input, allowing differing formats (8-bit, 16-bit), allowing differing image sizes and therefore accepting a gravity option.

This can be tested via:

npm install lovell/sharp#needle

Many thanks to @chrisriley for his original PR #335 on which I based this work.

@lovell
Copy link
Owner Author

lovell commented Apr 2, 2016

v0.14.0 now available via npm, thanks again for all the help with this.

@lovell lovell closed this as completed Apr 2, 2016
@lemnisk8
Copy link
Contributor

@lovell Please expose the replicate feature from Vips
replicate( int across , int down )
It would be really useful to tile watermark images for overlay

@lovell
Copy link
Owner Author

lovell commented May 24, 2016

@lemnisk8 Please can you create a new issue for this suggestion along with some examples of how you think the API might look, so we can invite others to discuss and/or submit a PR.

Repository owner locked and limited conversation to collaborators May 24, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants