ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Generating circular image
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

HeartWare

Denmark
46 Posts

Posted - Apr 11 2024 :  23:46:24  Show Profile  Reply
If I have an image, say 256x256, and I want to "mask out" the surrounding area so that only a circle of radius 256 pixels is shown in a TImageEnView component (sort of like the common way to display avatars on various online sites), how would I do this?

xequte

38231 Posts

Posted - Apr 12 2024 :  02:13:05  Show Profile  Reply
Hi

You can make a perfectly circular crop using:

https://www.imageen.com/help/TImageEnProc.Crop.html


sz := imin( ImageEnView1.IEBitmap.Width, ImageEnView1.IEBitmap.Height );
x := ( ImageEnView1.Bitmap.Width - sz ) div 2;
y := ( ImageEnView1.Bitmap.Height - sz ) div 2;
ImageEnView1.Proc.Crop( x, y, x + sz, y + sz, iesEllipse );


Nigel
Xequte Software
www.imageen.com
Go to Top of Page

HeartWare

Denmark
46 Posts

Posted - Apr 12 2024 :  02:41:59  Show Profile  Reply
"There is no overloaded version of 'Crop' that can be called with these arguments"

on the line:

Avatar.Proc.Crop(0,0,Avatar.Bitmap.Width,Avatar.Bitmap.Height,TIEShape.iesEllipse);

where

Avatar : TImageEnView;

Using: ImageEn Build 13.0.0.27.7132 @ 15-Nov-23 10:54:47
Go to Top of Page

HeartWare

Denmark
46 Posts

Posted - Apr 12 2024 :  03:10:36  Show Profile  Reply
Okay - installed v13.1 that I had lying around, but hadn't installed yet, and it now compiles.
Go to Top of Page

xequte

38231 Posts

Posted - Apr 12 2024 :  15:58:26  Show Profile  Reply
Hi

Yes, it was introduced in 13.1.0. Also in the upcoming release you can force a perfect circle.

Nigel
Xequte Software
www.imageen.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: