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
 Copy from Tbitmap does not work

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
dcoun Posted - Feb 13 2017 : 03:52:32
I using the following code to get a Tbitmap image from an other component and save it as PNGimage:

var ima:TImageEnIO; b:tbitmap;
begin
b:=TBitmap.Create; ima:=TImageEnIO.CreateFromBitmap(b); try
ima.IEBitmap.Clear; ima.AsyncMode:=false; ima.IEBitmap.ParamsEnabled:=true;
ima.IEBitmap.Location:=ieTBitmap;
b.Assign('Tbitmap from other image component');
b.SaveToFile('c:\temp\test.bmp');
//ima.Params.PNG_Compression:=8; ima.Params.PNG_Filter:=ioPNG_FILTER_ALL;
ima.IEBitmap.UpdateFromTBitmap; ima.SaveToFilePNG('c:\temp\test0.png');
ima.LoadFromFileBMP('c:\temp\test.bmp'); ima.SaveToFilePNG('c:\temp\test1.png');
finally ima.Free; b.free; end;
end;

Results:
test.bmp is OK
test0.png is cropped, black and white, "dizzy"
test1.png is OK

What is missing from my code, that requires saving and reloading the image as a file?


The following is the test0.png
12   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Mar 08 2017 : 19:13:48
Sorry, I need some source code that reproduces the issue without requiring any third party libraries.



Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
dcoun Posted - Mar 08 2017 : 03:04:02
concerning Enter, just different way our mind works. all our fingers have not the same length.
Concerning our subject, will an executable with the above code could help you?
(select pdf file, save to png file)
xequte Posted - Mar 07 2017 : 22:44:56
Wow, your code is very hard to read. Is your "Enter" key broken?

We don't have TgtPDFDocument so cannot test this.





Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
dcoun Posted - Mar 06 2017 : 02:03:59
I apologize for the delay. The following code works:

procedure TForm1.Button1Click(Sender: TObject);
var t:TgtPDFDocument; b:tbitmap; ima:TImageEnIO;
begin t:=TgtPDFDocument.Create(nil);
ima:=TImageEnIO.Create(nil); try
if not t.LoadFromFile('c:\temp\6thNL Final.pdf') then exit;
b:=t.GetBitmap(1,200,200);
b.PixelFormat:=pf24bit;
ima.IEBitmap.Assign(b); ima.Params.PNG_Filter:=ioPNG_FILTER_ALL;
ima.SaveToFilePNG('c:\temp\test.png'); finally ima.free; b.Free; t.Free; end;
end;

BUT the following DOES NOT work and gives similar image like the attached in the first post:

procedure TForm1.Button1Click(Sender: TObject);
var t:TgtPDFDocument; b:tbitmap; ima:TImageEnIO;
begin t:=TgtPDFDocument.Create(nil);
ima:=TImageEnIO.Create(nil); try
if not t.LoadFromFile('c:\temp\6thNL Final.pdf') then exit;
b:=t.GetBitmap(1,200,200);
b.PixelFormat:=pf24bit;
b.PixelFormat:=pf32bit;
ima.IEBitmap.Assign(b); ima.Params.PNG_Filter:=ioPNG_FILTER_ALL;
ima.SaveToFilePNG('c:\temp\test.png'); finally ima.free; b.Free; t.Free; end;
end;


I am using Delphi 10.1 Berlin
xequte Posted - Feb 23 2017 : 19:49:00
Hi

I'm afraid I cannot reproduce that, nor can I see any reason 32bit BMP's should not process.

Try making a simple demo that does not require any third party libraries or code.

Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
dcoun Posted - Feb 23 2017 : 01:09:49
Yes, v6.3.2
xequte Posted - Feb 22 2017 : 14:53:34
Hi

What version of ImageEn are you using? V6.3.2?



Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
dcoun Posted - Feb 16 2017 : 18:07:39
Component = Gnostice's PDFtoolkit

PixelFormat = pf32bit;
AlphaFormat = afIgnored;
HandleType = bmDIB;
xequte Posted - Feb 16 2017 : 15:31:12
There is something unexpected about your source image, can you advise the properties of the "Tbitmap from other image component"? Particularly, PixelFormat, AlphaFormat and HandleType?

Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
dcoun Posted - Feb 16 2017 : 06:16:53
Thank you for your response.
The first solution resulted in a "wave" like coloured image in the same unreadable way. The second gives the same black&width image.
I trying to lock canvas also, but it did not work.
The following memory consuming code works OK: (I do not know why)

var 
  ima:TImageEnIO; 
  b:tbitmap;
  im:Tmemorystream;
begin
  im:=TMemoryStream.Create;
  ima:=TImageEnIO.Create(nil); 
  try
    ima.Params.PNG_Filter:=ioPNG_FILTER_ALL;
    b:=('Tbitmap from other image component'); 
    b.SaveTostream(im);
    b.free;
    im.position:=0;
    ima.LoadFromstreamBMP(im); 
    ima.SaveToFilePNG('c:\temp\test1.png');
  finally 
    ima.Free; 
    im.free; 
  end;
end;
xequte Posted - Feb 13 2017 : 15:55:56
Hi

How about if you use:

var 
  ima: TImageEnIO; 
begin
  ima:=TImageEnIO.Create(nil); 
  try
    ima.IEBitmap.Assign('Tbitmap from other image component'); 
    ima.Params.PNG_Filter:=ioPNG_FILTER_ALL;
    ima.SaveToFilePNG('c:\temp\test0.png');
  finally 
    ima.Free; 
  end;
end;

Note: Don't set ima.IEBitmap.ParamsEnabled:=true; unless you want to use the params of IEBitmap (instead of params of ima)

Or:

var 
  b: TIEBitmap;
begin
  b := TIEBitmap.Create(); 
  try
    b.Params.Enabled
    b.Assign('Tbitmap from other image component'); 
    b.Params.PNG_Filter:=ioPNG_FILTER_ALL;
    b.Write('c:\temp\test0.png');
  finally 
    b.Free; 
  end;
end;


Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
xequte Posted - Feb 13 2017 : 15:49:03

var 
  ima:TImageEnIO; 
  b:tbitmap;
begin
  b:=TBitmap.Create; 
  ima:=TImageEnIO.CreateFromBitmap(b); 
  try
    ima.IEBitmap.Clear; 
    ima.AsyncMode:=false; 
    ima.IEBitmap.ParamsEnabled:=true;
    ima.IEBitmap.Location:=ieTBitmap;
    b.Assign('Tbitmap from other image component'); 
    b.SaveToFile('c:\temp\test.bmp');
    //ima.Params.PNG_Compression:=8; 
    ima.Params.PNG_Filter:=ioPNG_FILTER_ALL;
    ima.IEBitmap.UpdateFromTBitmap; 
    ima.SaveToFilePNG('c:\temp\test0.png');
    ima.LoadFromFileBMP('c:\temp\test.bmp'); 
    ima.SaveToFilePNG('c:\temp\test1.png');
  finally 
    ima.Free; 
    b.free; 
  end;
end;


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