Crop filter #365

merged 1 commit into from Apr 4, 2013

2 participants



I used KineticJS for a project and I really appreciated your work.

I developped a filter to crop unicolor-background images for my purpose and I suggest you to make it part of Kinetic.Filters.



This looks really cool! Can you explain a bit more on what exactly it does and how it works?


The filter works as follow :
1/ Measure the 4 corner pixels RGB coordinates
2/ If the 4 corners have similar color, all other similar pixels are detected providing a mask. Else image stays unchanged.
2.1/ An erode/dilate processing is applyed on mask to enhance the segmentation
2.2/ A smooth edge filter is applied to enhance the visual result

Enhancements :

  • Translate in a more human sensitive color space (HSL) for color distance
  • Use more than one pixel in corners to evaluate the unicolor background image

Ex: You can test on dragging product pictures into the draw area.


Awesome! Do you think it would make sense to change the filter name to Mask?

@ericdrowell ericdrowell merged commit 7888ebe into ericdrowell:master Apr 4, 2013

No matter the name. I choose Crop to allow new cropping feature (based on edge detection, etc...) but Mask sounds great as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment