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

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Why does this code fail to load .PSD file?

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
yogiyang Posted - Mar 20 2015 : 23:00:36
Hello,

I am using following code to load .PSD files in ImageEnView.

MainForm.ImageEnViewMain.LayersClear;
MainForm.ImageEnViewMain.Blank;
MainForm.ImageEnViewMain.MouseInteract := [];
MainForm.ImageEnViewMain.Update;
//============= Load user selected File
if FileExists(fName) then
begin
    MainForm.ImageEnViewMain.IO.Params.PSD_LoadLayers := True;
    MainForm.ImageEnViewMain.IO.LoadFromFilePSD(fName);
    MainForm.ImageEnViewMain.MouseInteract := [miMoveLayers, miResizeLayers];
    MainForm.ImageEnViewMain.Layers[0].Locked := True;
    MainForm.ImageEnViewMain.Update;
end
else
begin
    ShowMessage('Cannot Open "PSD" File');
    exit;
end;


But on executing this code the file is loaded but what we see is a blank ImageEnView. And I have observed that there is an extra layer (0th layer) in the file loaded. So for example if the original .PSD file has 20 layers when loaded in ImageEnView there will be one extra layer added to it. Why?

Currently as a work around what I am doing is loading .PSD file twice! First loading the PSD with the Param - PSD_LoadLayers set to False and then reloading the file again immediately by setting this parameter to True. But this workaround is taking very long time to load the files this is noticeable when a user loads very large (around 150 MB) .PSD files.

Here is the work around code:

MainForm.ImageEnViewMain.IO.Params.PSD_LoadLayers := False;
MainForm.ImageEnViewMain.IO.LoadFromFilePSD(fName);
MainForm.ImageEnViewMain.IO.Params.PSD_LoadLayers := True;
MainForm.ImageEnViewMain.IO.LoadFromFilePSD(fName);


TIA


Yogi Yang
11   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Nov 02 2015 : 18:56:00
Hi Yogi

Please show some example code to reproduce this.



Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
yogiyang Posted - Nov 02 2015 : 09:43:21
After updating to the new version of IE the error seems to have gone away except when we encrypt all the layers from bottom to top the error returns when decrypting them. :(




Yogi Yang
Sybren Posted - Oct 29 2015 : 02:26:56
Hi Nigel,

Thanks for the quick answer.
Yes it does work now.

Much appreciated!

Sybren
xequte Posted - Oct 28 2015 : 23:27:37
Hi Sybren

It works if you use

psd.LegacyBitmap := False;

And LegacyBitmap should always be disabled for new projects.

Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Sybren Posted - Oct 28 2015 : 17:22:56
Hi Nigel, Yogi,

I had the same issue with version 6.2.0. I tried Yogi's workaround but that didn't work for me. I use D7 and XE4, both give an EAccessViolation. Here is the code that creates the error. It first reads two files with Button1, then with Button2 it reads the newly created .psd file, replacing the original ImageEnView1 in the Form.

procedure TForm1.Button1Click(Sender: TObject);
begin
  { loads two layer pictures and saves as a 2-layer psd file }
  ImageEnView1.IO.LoadFromFileJpeg('back.jpg');
  ImageEnView1.LayersAdd;
  ImageEnView1.IO.LoadFromFilePNG('transp.png');
  ImageEnView1.Update;
  ImageEnView1.IO.SaveToFilePSD('saved.psd');
end;

procedure TForm1.Button2Click(Sender: TObject);
var
  psd: TImageEnView;
begin
  { creates a new variable to read and store the psd file }
  psd := TImageEnView.Create(nil);
  psd.IO.Params.PSD_LoadLayers := true;
  psd.IO.Params.PSD_ReplaceLayers := true;
  psd.IO.LoadFromFilePSD('saved.psd');  { <<<< this line gives an EAccessViolation error in imageenview line 13388 }
  { then assigns its content to the original picture }
  ImageEnView1.Assign(psd);
  ImageEnView1.Update;
  psd.Free;
end;

I'm kinda stuck here. I can't read multi-layered .psd files, nor individual layers from psd files using a third Button3:

procedure TForm1.Button3Click(Sender: TObject);
var
  psd: TImageEnView;
begin              
  { similar as above, but now only load layer 2 }
  psd := TImageEnView.Create(nil);
  psd.IO.Params.PSD_LoadLayers := true;
  psd.IO.Params.PSD_SelectLayer := 'Layer 2';
  psd.IO.LoadFromFilePSD('saved.psd');
  ImageEnView1.Assign(psd);
  ImageEnView1.Update;
  psd.Free;
end;

Help is much appreciated.

Sybren
yogiyang Posted - Mar 31 2015 : 23:21:36
Ok I will do this but please give me some time to messup one.




Yogi Yang
xequte Posted - Mar 31 2015 : 11:32:51
Hi

Can you create a small demo and email it to us.



Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
yogiyang Posted - Mar 30 2015 : 07:02:07
I am using version 6 of ImageEn in DX6


Yogi Yang
xequte Posted - Mar 30 2015 : 02:07:59
We cannot reproduce this. What version are you using?


Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
yogiyang Posted - Mar 24 2015 : 01:21:09
Two files are attached here.

These files were saved from ImageEn itself.

TIA


attach/yogiyang/201532411915_YogiTest001.zip
1975.71 KB

attach/yogiyang/201532412038_YogiTest002.zip
2442.77 KB


Yogi Yang
xequte Posted - Mar 23 2015 : 13:29:05
Hi Yogi

Where can we download your example PSD files?



Nigel
Xequte Software
www.xequte.com
nigel@xequte.com