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
 load picture to existing layer keep layer size
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

ZS Tekatec

Poland
18 Posts

Posted - Feb 18 2025 :  14:04:16  Show Profile  Reply
Hi,

I've an image layer with the caption "Load image".
Then I'd like to load an image into this area as you can see below.
If the loaded image is larger than the layer area, it should fit proportionally.
Do you have any tips?




ZS

xequte

38944 Posts

Posted - Feb 18 2025 :  14:22:20  Show Profile  Reply
Hi

It should always being make an image fit within the layer rectangle proportionally after loading. I just tested this with v13.7.0.

Are you able to reproduce in one of our demos? If so, please give me the steps.

Note: You can also modify the properties of the selected layer after an action by using:

http://www.imageen.com/help/TIEView.OnActionExecute.html



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

ZS Tekatec

Poland
18 Posts

Posted - Feb 20 2025 :  16:33:42  Show Profile  Reply
Yes, I'm able to reproduce it in your demo.
The problem occurs when ImageEnView1.LayersMerge([idx1, idx2]) is used and I try to load an image into the merged layer.

1) I create a text layer with the heading "Load image"

ImageEnView1.LayersAdd(ielkText); // add a new textlayer
  lyr := TIETextLayer(ImageEnView1.CurrentLayer);
  lyr.Text := 'Load image';
  lyr.Name := 'T1';
  lyr.Font.Size := 28;
  lyr.PosX := TIEImageLayer(ImageEnView1.Layers[1]).PosX;
  lyr.PosY := TIEImageLayer(ImageEnView1.Layers[1]).PosY;
  lyr.Height := TIEImageLayer(ImageEnView1.Layers[1]).Height + 1;
  lyr.Width := TIEImageLayer(ImageEnView1.Layers[1]).Width + 1;
  lyr.FillColor := clWhite;
  lyr.BorderWidth := 4;
  lyr.BorderColor := clBlack;
  lyr.Alignment := iejCenter;
  lyr.Layout := ielCenter;



2) I merge the image (index = 1) with the text layer
ImageEnView1.LayersMerge([1, lyr.LayerIndex]);

3) I try to load new image into the merged layer from point 2 - and then the loaded image doesn't fit into the merged layer, it has original size.

ZS
Go to Top of Page

xequte

38944 Posts

Posted - Feb 23 2025 :  15:57:20  Show Profile  Reply
I see. For image layers, it tries to create at its native size, so you need to lock the image layer dimensions

// Load image so it fits within the current layer dimensions 
lyr := TIEImageLayer(ImageEnView1.CurrentLayer);
// Lock image layer size
lyr.Width  := lyr.Width;  
lyr.Height := lyr.Height;
ImageEnView1.IO.LoadFromFile( 'D:\image.jpg' );
lyr.RestoreAspectRatio();


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

ZS Tekatec

Poland
18 Posts

Posted - Feb 28 2025 :  17:39:03  Show Profile  Reply
thank you, it works.


ZS
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: