serverless-image-handler icon indicating copy to clipboard operation
serverless-image-handler copied to clipboard

Watermark in sharp

Open uoxiu opened this issue 7 years ago • 25 comments

The current version of image handler with sharp don't support the watermark?

uoxiu avatar Jul 25 '19 08:07 uoxiu

I'm confused as well. The docs seem to be out of date as they still reference Thumbor, yet do mention watermarking. Sharp has a composite function that seems to handle watermarking (basically an overlay), but I don't see how to expose it via SIH.

joebernard avatar Jul 26 '19 01:07 joebernard

Hey all - Apologies for the documentation issues, we've taken a look and realized that some parts weren't updated to align with v4's capabilities. We're in the process of publishing the updated docs and they should be online early this upcoming week.

For the watermarking feature, we've added a feature request to our board and expect to have that rolled out in the next minor release. It will probably look something like this: overlayWith: { . bucket: <watermarkImageBucket>, . key: <watermarkImageKey> . options: [Object object] } Such that you can source a watermark/overlay image from any bucket in your account and add positioning attributes, etc. as key-value pairs in the options property. Happy to hear any thoughts feedback on this from your perspective(s)!

hayesry avatar Aug 03 '19 19:08 hayesry

Hi @hayesry, thanks for your answer.

When you planned the next minor release please?

TuNi54 avatar Aug 09 '19 17:08 TuNi54

Any news on an update on the watermark feature?

Ehaic avatar Aug 27 '19 17:08 Ehaic

Any news on an update on the watermark feature? thanks

wingoo avatar Sep 06 '19 12:09 wingoo

Hi all, I created successfully an image with watermark with this parrameters.

{"bucket":"htvarts","key":"image.jpg","edits":{"overlayWith":{"bucket":"htvarts","key":"logo.png","options":{"top":90,"left":205}}}}

Create base64encode and try it.

tientq88 avatar Sep 09 '19 13:09 tientq88

Hi all, I created successfully an image with watermark with this parrameters.

{"bucket":"htvarts","key":"image.jpg","edits":{"overlayWith":{"bucket":"htvarts","key":"logo.png","options":{"top":90,"left":205}}}}

Create base64encode and try it.

https://sharp.pixelplumbing.com/en/stable/changelog/#v0220-18th-march-2019 They have removed overlayWith previously deprecated in v0.22.0.!

xiaoxie110 avatar Nov 29 '19 01:11 xiaoxie110

It would be nice if this package supported the intended use of the Sharp JS composite function. Unlike the deprecated overlayWith function in Sharp JS, the composite function supports multiple images, which can be used to generate much more complex (and useful) image composites.

In our case, we need to use the composite function to generate dynamic product previews, similar to the image attached below.

Can we composite multiple images as this package is currently written? It doesn't appear so.

products

thadallender avatar Feb 06 '20 19:02 thadallender

We have updated our solution, and I believe your issue has been fixed. If you still see the issue with the latest version (v4.2), please feel free to reopen the issue.

For the way how you can create a watermark, you can refer to the implementation guide Appendix D: List of Supported Thumbor Filters.

You can also refer to the recent changes here.

beomseoklee avatar Feb 06 '20 21:02 beomseoklee

@georgebearden this still doesn't entirely work, and it's still set up to use the overlayWith parameter instead of composite (as per the code here: https://github.com/awslabs/serverless-image-handler/blob/master/source/image-handler/image-handler.js )

There is no documentation about this, and I personally can get a basic overlay to work but as soon as i try to add {"options": { "top": 50 }} it fails completely (I don't even get an image at all, just a blank page with {} on it.)

adrienne avatar Apr 01 '20 10:04 adrienne

@adrienne Can you share the edits you used?

beomseoklee avatar Apr 01 '20 15:04 beomseoklee

@georgebearden this still doesn't entirely work, and it's still set up to use the overlayWith parameter instead of composite (as per the code here: https://github.com/awslabs/serverless-image-handler/blob/master/source/image-handler/image-handler.js )

There is no documentation about this, and I personally can get a basic overlay to work but as soon as i try to add {"options": { "top": 50 }} it fails completely (I don't even get an image at all, just a blank page with {} on it.)

same here.. this is what i used { "bucket": "bucket_name", "key": "img_key", "edits": { "overlayWith": { "bucket": "bucket_name", "key": "img_key", "options": { "top": 30, "left": 30 } } } }

eltonjothi avatar Apr 22 '20 05:04 eltonjothi

i can confirm options.top and options.left is returning blank page with {}

currently i am using the gravity option { "bucket": "bucket", "key": "key", "edits": { "overlayWith": { "bucket": "bucket", "key": "key", "options": { "gravity": "east" } } } }

eltonjothi avatar Apr 22 '20 05:04 eltonjothi

@adrienne and @eltonjothi Thanks for waiting, and I found what causes an issue. I will add the fix to the next release. Once again, thanks for your inputs, and I'm sorry for your inconvenience.

beomseoklee avatar Apr 22 '20 16:04 beomseoklee

@adrienne and @eltonjothi Thanks for waiting, and I found what causes an issue. I will add the fix to the next release. Once again, thanks for your inputs, and I'm sorry for your inconvenience.

Is this working now and how should we use it ?

emeagenciadigital avatar Jun 24 '20 19:06 emeagenciadigital

i can confirm options.top and options.left is returning blank page with {}

currently i am using the gravity option { "bucket": "bucket", "key": "key", "edits": { "overlayWith": { "bucket": "bucket", "key": "key", "options": { "gravity": "east" } } } }

Did you manage to make it work and how ? Thanks !

emeagenciadigital avatar Jun 24 '20 19:06 emeagenciadigital

@emeagenciadigital Thanks for reaching out to us. Unfortunately, we haven't released the update. Once it's done, this issue would be fixed.

beomseoklee avatar Jun 24 '20 22:06 beomseoklee

@beomseoklee any news on this topic? The Appendix D still only refers to Thumbor filters. How to use watermark/composite feature?

chryssalid avatar Jul 22 '20 18:07 chryssalid

Hope to fix the watermark function, thank you very much!

psdty avatar Jul 30 '20 10:07 psdty

Hope to fix the watermark function, thank you very much!

@beomseoklee any news on this topic? The Appendix D still only refers to Thumbor filters. How to use watermark/composite feature?

I have made a detailed guide, how i have tried to add watermarks. https://medium.com/@elton.jj/watermarks-with-aws-serverless-image-handler-6c24f4700e2d

eltonjothi avatar Jul 31 '20 04:07 eltonjothi