[development] DHTML Image Cropper

Bèr Kessels ber at webschuur.com
Wed May 3 10:35:43 UTC 2006


Op woensdag 3 mei 2006 03:41, schreef Adrian Rossouw:
> http://www.speedingrhino.com/cropper.htm

I have recently developed a small, but EXTREMELY usefull autocropper for a 
Rails project. Good news: only four lines of code. Bad news: you need Ruby 
apis for it. But I bet there is sime PHP equivalent around. And because it 
uses imagemagick, its not hard to write these apis yourself.

But, if you use imagemagick, it is not hard to make this a lot more user 
friendly. Because, however cool a DHTML cropper might be: much cooler is to 
have the system crop it for you. Nice cropping off course. 

Here is what I did (sortof):
1 stretch the contrast a lot. make sure the outer borders are white after this 
(i played with teh values a bit)
2 smart crop that image. 
(http://studio.imagemagick.org/pipermail/magick-users/2004-December/014309.html)
3 trow that image away, but remember the offset and crop values.
4 use these values to crop, using crop! 
(http://studio.imagemagick.org/RMagick/doc/image1.html#crop_bang)

This concept needs finetuning, but vecause I use crop! the first 3 steps 
hardly add any value anyway :) I found that at least 90% of the images are 
already cropped very well by crop!

Conclusion: It is perfeclty possible to do this without user interaction. And 
taking difficult tasks away from users is always the better option that 
adding these tasks.

Obviously it could be good to make that DHTML cropper optional. s in: Drupal 
will crop the stuff for you correct 90% of the tilmes. And if the last10% 
bother you, you can change these by hand.

Bèr
-- 
 PGP ber at webschuur.com
  http://www.webschuur.com/sites/webschuur.com/files/ber_webschuur.asc
 PGP berkessels at gmx.net
  http://www.webschuur.com/sites/webschuur.com/files/ber_gmx.asc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.drupal.org/pipermail/development/attachments/20060503/85f86c8f/attachment.pgp


More information about the development mailing list