Hi,

This is a real great module,did you document your algorithm for the crop and resize with your focus?And are you willing to share it?This should be ported on some other CMS tools,is there a way you would share the algorithm so i could write it for Joomla?

Comments

shile23 created an issue.

bleen’s picture

I haven't documented the algorithm per se, but the relevant code can all be found here: http://cgit.drupalcode.org/focal_point/tree/focal_point.effects.inc

The basic Idea is this:

  • figure out the desired width & height of the cropped image
  • center the crop area (based on the desired width and height) on the user specified focal point
  • shift the crop area so it is not hanging off an edge of the original image
  • crop

Feel free to port this to Joomla (Yay Open Source!!)

shile23’s picture

Thanks for responding,the link is empty.I downloaded the drupal module and found the code anyways,but the problem is that at the end you are using drupal functions for image processing.In what GD or Imagick functions do these map to?

bleen’s picture

Drupal's core image module handles all the imagick functionality... I couldn't begin to tell you how that works. I assumed that Joomla has some sort of similar functionality but admittedly I've never used it.

All I can speak to is the specific algorithm I use to arrive at the crop data that is sent to imagick. From there, Drupal does its thing.

Side note: that link does seem to work for me... hmmmm