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
 Crop and Image into two steps
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

yogiyang

India
725 Posts

Posted - Sep 17 2017 :  02:48:46  Show Profile  Reply
Hello,

I am using following code for crop an image into two equal halfs but am not getting expected results. Please tell what mistake am I making here:

ieTemp.IO.LoadFromFileAuto(PhotoFileName);
ieTemp.LayersCurrent := 0;

CropLeft := ieTemp.CurrentLayer.PosX;
CropTop := ieTemp.CurrentLayer.PosY;
CropWidth := ieTemp.CurrentLayer.Width div 2;
CropHeight := ieTemp.CurrentLayer.Height;

ieTemp.Proc.Crop(Rect(CropLeft, CropTop, CropWidth, CropHeight));

// Assign the Layer to Main ImageEn
ieMain.LayersCurrent := 1;
ieMain.CurrentLayer.Bitmap.Assign(ieTemp.CurrentLayer.Bitmap);

/////////=============================
ieTemp.IO.LoadFromFileAuto(PhotoFileName);
ieTemp.LayersCurrent := 0;

CropLeft := CropWidth;
CropWidth := ieTemp.CurrentLayer.Width - CropLeft;

ieTemp.Proc.Crop(Rect(CropLeft, CropTop, CropWidth, CropHeight));

// Assign the Layer to Main ImageEn
ieMain.LayersCurrent := 2;
ieMain.CurrentLayer.Bitmap.Assign(ieTemp.CurrentLayer.Bitmap);


TIA


Yogi Yang

xequte

38180 Posts

Posted - Sep 17 2017 :  19:19:28  Show Profile  Reply
Hi Yogi

What result is this code giving you?

Did you call ImageEnView1.update() afterwards?



Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page

yogiyang

India
725 Posts

Posted - Sep 18 2017 :  01:46:14  Show Profile  Reply
Hello,

The second crop yields only a narrow vertical strip.

And yes I have called update. I have posted only the code that I felt was necessary.

TIA


Yogi Yang
Go to Top of Page

xequte

38180 Posts

Posted - Sep 19 2017 :  19:50:02  Show Profile  Reply
Hi Yogi

Crop is expecting a Rect, but you are passing it width and height values:

ieTemp.Proc.Crop(Rect(CropLeft, CropTop, CropWidth, CropHeight));

Please change to:

ieTemp.Proc.Crop(Rect(CropLeft, CropTop, CropLeft + CropWidth, CropTop + CropHeight));

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