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
 Layer Merge is not working as documented
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

yogiyang

India
725 Posts

Posted - Feb 26 2020 :  01:16:26  Show Profile  Reply
Hello,

I am using following code:

var
  SelLayers: array of Integer;
  I: Integer;


for I := ieViewMain.LayersCount - 1 downto 1 do
  begin
    if (ieViewMain.Layers[I].Selected) then
    begin
      SetLength(SelLayers, Length(SelLayers) + 1);
      SelLayers[Length(SelLayers) - 1] := I;
    end;
  end;

  ieViewMain.LayersMerge(SelLayers);


The output is not consistent. It tends to vary from file to file.

At times Merged Layers just vanishes.

I have attached a sample file for testing.

As I am not able to upload this file as attachment (getting Internal Server Error 500) I am uploaded it to Mediafile.

The download link: https://www.mediafire.com/file/9ahqspavskbdjds/SampleIn100dpi.psd/file

TIA




Yogi Yang

yogiyang

India
725 Posts

Posted - Feb 26 2020 :  02:03:23  Show Profile  Reply
Hello,

For testing select all the Layers (Including Masks) except Background (Layer 0) and the try to merge them.

Then reload the file and select a few layers randomly. Here when you select a layer take care to also select any layers which are directly under the selected layer and then try to merge them.

TIA


Yogi Yang
Go to Top of Page

xequte

38185 Posts

Posted - Feb 26 2020 :  18:16:52  Show Profile  Reply
Hi Yogi

Do not use a reverse for loop. It should work correctly if you count up. I will improve the documentation.

Also, you can just use:

// Merge all selected layers
ImageEnView1.LayersMerge();


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

yogiyang

India
725 Posts

Posted - Feb 27 2020 :  07:05:13  Show Profile  Reply
Hello,
 
Also, you can just use:

// Merge all selected layers
ImageEnView1.LayersMerge();


Using this also gives undesirable results. All the layers just vanish except the lowest Layer. For example if we have selected 2, 4, 16, 17, 22 then if we use just LayersMerge() all the layers vanish and the lowest on that is 2 remains.

How to solve this?

TIA


Yogi Yang
Go to Top of Page

xequte

38185 Posts

Posted - Mar 01 2020 :  23:10:17  Show Profile  Reply
Hi Yogi

Actually it looks to be working as expected. If I call:

  ImageEnView1.IO.LoadfromFilePSD( 'D:\SampleIn100dpi.psd');
  ImageEnView1.LayersDeselectAll;
  ImageEnView1.Layers[2].Selected := True;
  ImageEnView1.Layers[4].Selected := True;
  ImageEnView1.Layers[6].Selected := True;
  ImageEnView1.Layers[17].Selected := True;
  ImageEnView1.Layers[22].Selected := True;
  ImageEnView1.LayersMerge()


It merges all the layers correctly. Because you have selected non-contiguous layers, the merged layers move behind the black boxes in the image. You need to move the black box layers behind the layer (or include them in the selection).

In other words, if you select layer 2 and 4 select and merge them, they will become layer 2. Therefore the layer 4 content is now behind the layer 3 content.

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

yogiyang

India
725 Posts

Posted - Mar 02 2020 :  00:10:23  Show Profile  Reply
Hello,

Merging Layers with code would work but not when the use has selected a few layers interactively and we call: LayersMerge().

In my case some the user may have also linked/grouped some of the layers.

TIA


Yogi Yang
Go to Top of Page

xequte

38185 Posts

Posted - Mar 02 2020 :  14:12:56  Show Profile  Reply
Hi Yogi

The test above works the same whether I do it with code, or selecting by hand.


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

yogiyang

India
725 Posts

Posted - Mar 06 2020 :  06:49:13  Show Profile  Reply
Hello,

I am still facing problems while merging Layers.

Here are a few screen shots:



The number of Selected Layers are 12.

The code is:

if ieViewMain.LayersSelCount(False) > 0 then
  ieViewMain.LayersMerge();



Why must this be happening?

TIA


Yogi Yang
Go to Top of Page

xequte

38185 Posts

Posted - Mar 08 2020 :  16:45:23  Show Profile  Reply
Hi Yogi

I cannot reproduce that using the image you sent me. Can you give it to me as code (i.e. code that selects the layers and merges them, reproducing the error).

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