3

I need a simple component to do image crop, to use inside an option where user must select an image, photo, or logo to represent them.

I already done some search with Google but found nothing good.

I would something with source code.

Jlouro
  • 4,515
  • 9
  • 60
  • 91
  • 2
    http://exampledelphi.com/delphi.php/tips-and-tricks/crop-image-with-drag-the-mouse/ – onder Nov 05 '10 at 16:14
  • 1
    Open source isnt compatible with copy protection from [this][1] question, by the way. [1]: http://stackoverflow.com/questions/467391/what-is-the-best-way-to-stop-an-application-being-copied-and-used-without-the-own – Free Consulting Nov 06 '10 at 05:30

2 Answers2

3

A TRect, DrawFocusRect and some handling of OnMouseDown, OnMouseMove, OnMouseUp for allowing user interaction to draw the cropping frame

and

BitBlt to do the actual cropping after the user is happy with the selection he made.

And look, there is an example which uses those same ideas: http://exampledelphi.com/delphi.php/tips-and-tricks/crop-image-with-drag-the-mouse/.

God bless!

Trinidad
  • 2,756
  • 2
  • 25
  • 43
  • raised exception class EInvalidOperation with message `'Can only modify an image if it contains a bitmap'`. – Kermia Apr 26 '11 at 05:17
  • @Kermia Use a .bmp instead of jpeg/png/etc. If you really need support for those other formats convert them to a TBitmap which is outside of the scope here. See http://www.scalabium.com/faq/dct0042.htm – Trinidad Apr 26 '11 at 14:43
  • Example does not exist anymore – davepaul12 Apr 18 '20 at 12:40
3

Try ImageEn from http://www.hicomponents.com/main/. It does what you want and a lot more. It is free, but not sure if you can get source with it.

Dave Novo
  • 693
  • 3
  • 9