jwagner / smartcrop.js

Content aware image cropping
http://29a.ch/2014/04/03/smartcrop-content-aware-image-cropping
MIT License
12.83k stars 580 forks source link

is it possible to input raw data & get raw data as output? #118

Open chr4ss12 opened 2 years ago

chr4ss12 commented 2 years ago

I was wondering if this library supports a case of:

I want to input containerWidth, containerHeight, as well imageWidth, imageHeight, and imageFacesOnScreen, and I would like to get back:

imageScale, imageX, imageY (basically these 3 parameters help me to scale/reposition the image in the container) thus giving me the best "crop", in essence I am not sure how to create this algorithm, but I dont need any face detection algorithms as I already have them, and I dont need any bitmap manipulation as its all handled. I would essentially need "description" of how to position the face in a container the best way.

jwagner commented 2 years ago

Smartcrop always works with image data as input. You could feed it a 'blank' image and supply the faces in the boost parameter (as it's done in smartcrop-cli). But at that point smartcrop is just a fairly inefficient way of fitting a rectangle to a bunch of rectangles. As for the output, the format is different but you do get back rectangles, smartcrop doesn't perform image manipulation.