Kanav
Kanav

Reputation: 2819

Add pattern to a png image (in canvas) with FabricJS

I'm trying to add pattern background to a png image that i have added into canvas. I used setPatternFill method provided by fabric js. But it's not working.

How ever, when i tried to add pattern to a rectange, it worked.

So what am i doing wrong?

Here's the demo

Upvotes: 0

Views: 994

Answers (1)

Nauman
Nauman

Reputation: 118

Referring to the issue on github (https://github.com/kangax/fabric.js/issues/2112), I think it is not possible yet because the author marked it as a possible feature. I needed the same functionality. So I thought to share with you what I found.

By the way I used the lirary canvas-masking to mask images. Here is the link https://github.com/codepo8/canvas-masking , in case anyone needs it.

Upvotes: 3

Related Questions