zhangyuanwei / node-images

Cross-platform image decoder(png/jpeg/gif) and encoder(png/jpeg) for Nodejs
https://npmjs.org/package/images
MIT License
1.55k stars 204 forks source link

How to crop image? #241

Open maxsnz opened 2 years ago

maxsnz commented 2 years ago

Hello and thanks for your job.

It seems, there is no "crop" feature. I've also tried to create transparent image and draw target picture with negative "x" or "y" position, but no effect:

images(1200, 630)
  .draw(images("input.jpg"), -100, 0)
  .save("output.jpg")

There is no target picture in the output, just plain black

rafinskipg commented 2 years ago

i think is because negative coordinates do not work