node-pureimage icon indicating copy to clipboard operation
node-pureimage copied to clipboard

Play nice with Jimp

Open Steve-Mcl opened this issue 4 years ago • 5 comments

Hi, this is less of an issue and more of a request.

Is there any thoughts to integrating/interoperable with JIMP?

Perhaps it is already possible however I see no references or remarks as to how I could use a JIMP image object with this library.

I feel closer integration with JIMP would be a WIN WIN for both this lib and for JIMP.

Please feel free to correct me / close this if this is something already implemented or simple to do.

Steve-Mcl avatar Oct 26 '20 13:10 Steve-Mcl

I've never heard of JIMP. Could you put in a link explaining what it is?

joshmarinacci avatar Oct 26 '20 14:10 joshmarinacci

Hi @joshmarinacci - sure, no problem.

Jimp is a pure JS image processing library. Been around for many years, has over 10000 github stars - quite a big deal.

An image processing library written entirely in JavaScript for Node, with zero external or native dependencies

I feel these two libs could really compliment each other. Jimp has loads of image loading & processing functionality however lacks many of the drawing bits that this lib provides.

Steve-Mcl avatar Oct 26 '20 14:10 Steve-Mcl

That sounds like a good idea. What would it take? Providing a raw buffer in a particular format that JIMP understands?

joshmarinacci avatar Nov 18 '20 21:11 joshmarinacci

this looks good: You can also initialize a new Jimp image with a raw image buffer:

new Jimp({ data: buffer, width: 1280, height: 768 }, (err, image) => { // this image is 1280 x 768, pixels are loaded from the given buffer. }); This can be useful for interoperating with other image processing libraries. buffer is expected to be four-channel (rgba) image data.

joshmarinacci avatar Nov 18 '20 21:11 joshmarinacci

I think we just need to add an example of how to make this work.

joshmarinacci avatar Jan 08 '22 22:01 joshmarinacci