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
 Out of Memory/Invalid Pointer Operation Error/etc

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 - Jun 26 2014 : 11:09:38
I have tried to do all the things that I can understand and configure or recode to get rid of errors mentioned in the subject line of this post.

I have modified the sample PhotoEn2.

I have set the ImageEn's:
LegacyBitmap := False;
SelectionBase := iesbBitmap;
DoubleBuffer := True;

When I load a multi layer PSD file and try to save it in back in PSD format from ImageEn I get the error message Invalid Pointer Operation Error.

Here is the code snippet I am using
if SaveDialogPSD.Execute then
      begin
        FlName := SaveDialogPSD.FileName;
        
        Child.ImageEnView1.LockUpdate;

        Application.ProcessMessages;

        Child.ImageEnView1.EnableAlphaChannel := True;
        Child.ImageEnView1.DpiX := 200;
        Child.ImageEnView1.DpiY := 200;
        Child.ImageEnView1.IO.Params.JPEG_Quality := 100;
        Child.ImageEnView1.IO.Params.JPEG_Smooth := 3;
        Child.ImageEnView1.IO.Params.JPEG_Progressive := False;
        Child.ImageEnView1.IO.Params.JPEG_ColorSpace :=ioJPEG_RGB;        
        
        try
          Child.ImageEnView1.IO.SaveToFilePSD(FlName);
        except on E: Exception do
          ShowMessage('Error while Saving Image.' + #13 + E.Message);
        end;

        Application.ProcessMessages;

        ProgressBar1.Position := 0;            

        Child.Changed := False;
        Child.Close;
        Child.Free;


When I try to save this same file to the native multi layer file format I keep getting Out of Memory error.

Here is the code that I am using to save
if SaveDialog1.Execute then
begin
  Child.ImageEnView1.LayersSaveToFile(SaveDialog1.FileName);
end;


I have also observed when I use above code it takes more time then it takes to save file to PSD format with all layers intact.

I don't know as to what to do about this problems.

Anyone has ever faced this or similar to these problems?

Please guide me to solve this problem as it is a show stopper for us and we are not able to release our software in the market.

With my limited knowledge I feel these are errors are related to memory management.

Thanks in advance.





Yogi Yang
10   L A T E S T    R E P L I E S    (Newest First)
w2m Posted - Jul 02 2014 : 09:42:48
I do not think there is anything you can do to speed up loading thumbnails when ImageEnMView1.StoreType is ietNormal, but you can set ImageEnMView1.StoreType to ietThumb so that thumbnails are loaded as fast as possible. Then when you want to access the full image rather than the thumbnail, load the full image by using the filename stored in ImageEnMView1.MIO.Params[iIndex].FileName. This way you get both... fast thumbnail creation as well as the ability to view the selected image form its original file.

So set ImageEnMView1.StoreType := ietThumb and load the full image from a file with ImageEnMView1.MIO.Params[iIndex].FileName);

var
  iIndex: Integer;
begin
  iIndex := ImageEnMView1.SelectedImage;
  if iIndex <> -1 then
    if FileExists(ImageEnMView1.MIO.Params[iIndex].FileName then)
      ImageEnView1.IO.LoadFromFileJpeg(ImageEnMView1.MIO.Params[iIndex].FileName);
end;


If you want to colorize a thumbnail you can just create a TIEBitmap, create a thumbnail from the original image and store it in the TIEBitmap, colorize the TIEBitmap, then replace the thumbnail with the TIEBitmap. The best way to create a thumbnail is to use TIEBitamp.LoadAsThumbnail or TIEBitmap.ConvertToThumbnail which is found in iexHelperFunctions.pas found in recent versions of imageen.



Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development
yogiyang Posted - Jul 02 2014 : 08:15:24
quote:
What was your StoreMode? It needs to be ietNormal if you are changing the content of the images in a TImageEnMView.

The number of photos are generally in very large quantity. They can be anything between 3oo to 800 pics. If I set StoreMode to ietNormal then it is taking a lot of time to load them.

Any suggestions to speed this up?

TIA



Yogi Yang
xequte Posted - Jul 01 2014 : 19:11:44
quote:
lock update of ImageEnMultiView and then update a few thumbnails (which in our case it colorizing selected thumbnails) and then unlocking update the previously colorized thumbnails are getting undone


What was your StoreMode? It needs to be ietNormal if you are changing the content of the images in a TImageEnMView.



Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
yogiyang Posted - Jul 01 2014 : 08:20:03
Hi Nigel,
I am stuck at 5.0.5 as after upgrading to this version we found that if we lock update of ImageEnMultiView and then update a few thumbnails (which in our case it colorizing selected thumbnails) and then unlocking update the previously colorized thumbnails are getting undone. After this problem started happening the client does not want to risk upgrading and breaking any existing features which is working fine.

Because if an already working feature starts malfunctioning then we will have to code a work around that particular bug. And currently we are hard pressed to release the product and get it out of the door!

Once we release the primary version I will upgrade to the latest version of ImageEn and check whether everything is working as expected or not.



Yogi Yang
xequte Posted - Jun 29 2014 : 19:29:34
HI Yogi,

Nice wedding pics :-)

I cannot reproduce any issues loading or saving these PSD files using PhotoEn and the code that you supplied. Email us if you are not using v5.1.1.


Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
w2m Posted - Jun 28 2014 : 15:38:06
Yogi,

I can open, save and view the layers in your sample images with no exceptions here when using 64-bit with your images and surprisingly I could also load the layers when compiled as 32-bit.

I did notice that some of the layers extended well beyond the right edge of my monitor, however.

I did not think I could load or save the layers in Win32 and would get memory errors, but they loaded with no exceptions.

I do suspect that low-end pc's with only 4 gb. ram will have problems. The only thing I can suggest is trying your application on a high-end pc... Intel I7 with lots of ram. I have 24 gb. ram here.

Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development
yogiyang Posted - Jun 28 2014 : 01:15:58
The download link for sample PSD files is: https://www.dropbox.com/s/v3den7tq1r3gevv/Sample%20Psd.zip


Yogi Yang
w2m Posted - Jun 27 2014 : 06:05:51
Biased on your comments my thoughts are you are indeed getting memory errors because of the limited memory in the pc's and from the 32-bit memory limit for windows. That is a lot of memory in use because of so many layers with images.

I'll test your images here once I get them, but I suspect you will need to upgrade Delphi to a version that supports 64-bit and compile the app as Win64. This makes much more memory available to the application. If that fails your application may require pc's with more memory so you may have to require users to have a minimum amount of memory for the application to run successfully. You may have to add a minimum memory requirement XX GB ram to the specification for your application once you figure out how much memory is required.

I do not see any other way around the problem. I have 24 GB ram here and can compile in 64-bit to test for you.

Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development
yogiyang Posted - Jun 27 2014 : 03:54:11
Hi Bill,
quote:
1. What operating system are you using?

I am using Windows 7 and so are most of our customers.

quote:
2. What version of Delphi are you using?

I am developing in Delphi 2007

quote:
3. How much ram is installed?

My PC has 4 GB RAM

quote:
4. Is your app compiled as Win32 or Win64?

As I am developing using Delphi 2007 my app is Win32

quote:
5. What are the dimensions of the psd file?

The largest PSD is of 12inches X 36inches at 200 DPI. While the smallest PSD is of 12inches X 24inches at 200 DPI

quote:
6. How many layers are in the psd file?

This varies according to composition/design. The number of layers can be any thing between 14 to 50.

quote:
7. Are you running the app from the IDE?

I generally test the app from IDE as well as stand alone outside IDE

quote:
8. Do you get the same errors when you run the exe outside of the IDE?

Yes

quote:
9. Have you tried compiling as Win64 with the IELIB64.DLL in the applications folder? If not, try compiling as Win64 and see if you get the same errors. If you provide a link to get the file you are testing I can try testing it here for you.

As I develop in D2007 I cannot use or compile 64Bit so this is out of bounce for me.

As the files in question are very large I will upload them somewhere and give their links here.

TIA



Yogi Yang
w2m Posted - Jun 26 2014 : 11:46:15
First a few questions...
1. What operating system are you using?
2. What version of Delphi are you using?
3. How much ram is installed?
4. Is your app compiled as Win32 or Win64?
5. What are the dimensions of the psd file?
6. How many layers are in the psd file?
7. Are you running the app from the IDE?
8. Do you get the same errors when you run the exe outside of the IDE?
9. Have you tried compiling as Win64 with the IELIB64.DLL in the applications folder? If not, try compiling as Win64 and see if you get the same errors. If you provide a link to get the file you are testing I can try testing it here for you.

Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development