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
 "Not enough storage..." - LayersMerge (URGENT)
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

AndyColmes

USA
351 Posts

Posted - Mar 05 2016 :  20:01:25  Show Profile  Reply
I am having issues with LayersMerge when dealing with some images. The images are about 5000x4000 pixels. I get the error message "Not enough storage to process this command". It works with smaller images but not with images of this size. This is absolutely necessary for us to have this function. If you can provide an alternative method on how to do this, it would be greatly appreciated.

Here is a snippet of my code:


               VTempImageENVect.LayersAdd;
               VTempImageENVect.LayersCurrent := 0;
               VTempImageEnVect.IO.LoadFromStream( A3Stream );
               VTempImageEnVect.LayersCurrent := 1;
               VTempImageENVect.Layers[ 1 ].Bitmap.Assign( VTempMaster.Bitmap );
               VTempImageEnVect.Layers[ 1 ].Transparency := 150;
               VTempImageEnVect.Update;
               VTempImageEnVect.LayersMerge;      <--- "Not enough storage to process this command


Thanks

Andy

w2m

USA
1990 Posts

Posted - Mar 06 2016 :  07:53:41  Show Profile  Reply
This may be the problem:
A3Stream.Position := 0;
VTempImageENVect.LayersCurrent := 0;
VTempImageEnVect.IO.LoadFromStream(A3Stream);

You should always set the memory stream position to 0 before loading the stream.

or maybe this:
var
  iLayer: integer;
begin 
  VTempImageENVect.LayersCurrent := 0;
  A3Stream.Position := 0;
  VTempImageEnVect.IO.LoadFromStream(A3Stream);
  iLayer := VTempImageENVect.LayersAdd;
  VTempImageEnVect.LayersCurrent := iLayer;
  VTempImageENVect.Layers[iLayer].Bitmap.Assign(VTempMaster.Bitmap);
  VTempImageEnVect.Layers[iLayer].Transparency := 150;
  VTempImageEnVect.Update;
  VTempImageEnVect.LayersMerge;
end; 

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

AndyColmes

USA
351 Posts

Posted - Mar 07 2016 :  11:51:36  Show Profile  Reply
Hi Bill, thank you for the response. The funny thing is that it works for all images that are smaller and just not with larger images like 5000 pixels wide. It looks more like a memory issue somewhere.

Andy
Go to Top of Page

xequte

38694 Posts

Posted - Mar 07 2016 :  19:22:22  Show Profile  Reply
Hi Andy

I couldn't reproduce that using a 100 megapixel image, and also the roast beef TIFF you sent using this code:

  aBitmap := TIEBitmap.Create( 'D:\250_MB_TIFF.tif'); // 'd:\Testing_Multimedia\Big_Big_Pix\10000x10000.jpg'

  ImageEnVect1.LayersAdd;
  ImageEnVect1.LayersCurrent := 0;
  ImageEnVect1.IO.LoadFromFile( 'd:\250_MB_TIFF.tif' );
  ImageEnVect1.LayersCurrent := 1;
  ImageEnVect1.Layers[ 1 ].Bitmap.Assign( aBitmap.vclBitmap );
  ImageEnVect1.Layers[ 1 ].Transparency := 150;
  ImageEnVect1.Update;
  ImageEnVect1.LayersMerge;

  aBitmap.free;


But there may be a lot of memory in use here, so a low memory system might struggle.

Also, have you disabled LegacyBitmap?

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

AndyColmes

USA
351 Posts

Posted - Mar 09 2016 :  04:19:39  Show Profile  Reply
Hi Nigel, thank you for the tip. I will make the changes and report back.

Just to confirm, Layers are still using TBitmap instead of TIEBitmap?

Also, I would like to assign another TIEBitmap that has alpha transparent background to this layer but somehow it does not take the alpha background. I had to save this TIEBitmap to file (png) first, load it and then assign it to the layer.

Thanks again.

Andy
Go to Top of Page

xequte

38694 Posts

Posted - Mar 09 2016 :  17:08:54  Show Profile  Reply
Hi Andy

Layers use a TIEBitmap, so you don't need to reference vclBitmap:

ImageEnVect1.Layers[ 1 ].Bitmap.Assign( aBitmap.vclBitmap );
->
ImageEnVect1.Layers[ 1 ].Bitmap.Assign( aBitmap );

The alpha channel should be assigned when using:

DestIEBmp.Assign( SrcIEBmp );

What code are you using?


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

AndyColmes

USA
351 Posts

Posted - Mar 13 2016 :  00:08:31  Show Profile  Reply
I am actually using 2 TimageEnVects for this, VCastVect and VTempImageENVect. The VCastVect does all the image effects where the background is changed to transparent. I had to save VCastVect to a png file first and load it to the layer of VTempImageENVect to preserve the transparency:


                  VCastVect.IO.SaveToFile( 'c:\new-cast.png' );

                  VTempImageENVect.LayersAdd;
                  VTempImageEnVect.LayersCurrent := 1;
                  VTempImageENVect.IO.LoadFromFilePNG( 'c:\new-cast.png' );
                  VTempImageENVect.Layers[ 1 ].PosX := 0;
                  VTempImageENVect.Layers[ 1 ].PosY := 0;
                  VTempImageENVect.Layers[ 1 ].Width := VCastVect.IEBitmap.Width;
                  VTempImageENVect.Layers[ 1 ].Height := VCastVect.IEBitmap.Height;
                  VTempImageEnVect.LayersMergeAll(True);
                  VTempImageEnVect.Update;



I tried doing the following, but the transparency in VCastVect did not transfer to the layer of VTempImageENVect:


                  VTempImageENVect.LayersAdd;
                  VTempImageEnVect.LayersCurrent := 1;
                  VTempImageENVect.IEBitmap.Assign( VCastVect.IEBitmap );
                  VTempImageENVect.Layers[ 1 ].PosX := 0;
                  VTempImageENVect.Layers[ 1 ].PosY := 0;
                  VTempImageENVect.Layers[ 1 ].Width := VCastVect.IEBitmap.Width;
                  VTempImageENVect.Layers[ 1 ].Height := VCastVect.IEBitmap.Height;
                  VTempImageEnVect.LayersMergeAll(True);
                  VTempImageEnVect.Update;



Also, I noticed that TImageEnVect.IEBitmap.CopyToBitmap ony takes a TBitmap. How do I copy a TIEBitmap to another TIEBitmap?

Thanks very much Nigel.

Andy

Go to Top of Page

xequte

38694 Posts

Posted - Mar 13 2016 :  22:53:09  Show Profile  Reply
Hi Andy

I cannot reproduce that. Does the transparency show in VCastVect? Is EnableAlphaChannel true for both TImageEnViews? (Note: if you are not using any vectorial features then you would be better to use TImageEnViews rather than TImageEnVects).



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

nwscomps

185 Posts

Posted - Mar 14 2016 :  12:13:09  Show Profile  Reply
Hello,
maybe it can help to make sure that legacybitmap is set to false.
Also if layermerge uses any tbitmap internally, that can cause the problem.



Francesco Savastano
Nwscomps.com
Add-ons for the ImageEn Library
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: