Author |
Topic |
|
lorife
Italy
44 Posts |
Posted - Mar 13 2023 : 03:10:25
|
Hello, I have been using IEJoinBitmaps like this:
destBmp := TIEBitmap.Create();
IEJoinBitmaps(destBmp, iev_IN.IEBitmap, iev_IN2.IEBitmap, false, clWhite);
idx := iemv_OUT.AppendImage;
iemv_OUT.SetImage(idx, destBmp);
iemv_OUT.MIO.Params[0].PDF_Compression := TIOPDFCompression.ioPDF_JPEG;
iemv_OUT.MIO.Params[0].PDF_PaperSize := TIOPDFPaperSize.iepA4;
iemv_OUT.MIO.Params[0].PDF_PaperLayout := TIEPageLayout.ielLandscape;
iemv_OUT.MIO.Params[0].PDF_ImageOptions := [iepioShrinkOnly, iepioCentered];
iemv_OUT.MIO.SaveToFile('c:\temp\test.pdf', 0, false)
destBmp.Free;
now with the last version this changed to TIEBitmap.JoinBitmaps but I'm not sure how to change it. Before I had the new image into destBmp. How can I do it now? where does the merged image go?
Thank you |
|
xequte
38608 Posts |
Posted - Mar 14 2023 : 23:14:29
|
Hi
IEJoinBitmaps() is still available, but you need to add imageenproc to your uses clauses.
Alternatively, this code:
IEJoinBitmaps(destBmp, iev_IN.IEBitmap, iev_IN2.IEBitmap, false, clWhite);
Should be changed to:
destBmp.JoinBitmaps(iev_IN.IEBitmap, iev_IN2.IEBitmap, false);
Nigel Xequte Software www.imageen.com
|
|
|
lorife
Italy
44 Posts |
Posted - Mar 24 2023 : 05:30:05
|
Hello, I changed my code as you suggested. It works great. Only problem I see is the PDF size. it's much bigger than I expected. Is it normal? If you check the code I pasted I compress it. I am sending you by mail the 2 files I use. Thank you |
|
|
xequte
38608 Posts |
Posted - Mar 24 2023 : 19:58:44
|
Hi
What method are you using to support PDF loading? Is it the PDFium DLLs from our download page?
Nigel Xequte Software www.imageen.com
|
|
|
lorife
Italy
44 Posts |
Posted - Mar 27 2023 : 01:59:50
|
Hello, I load PDF using PDFium like this:
myImageEN.IO.LoadFromFilePDF(FConversioni.FFullPathIN);
I am using the last version just downloaded from your website.
|
|
|
lorife
Italy
44 Posts |
Posted - Mar 27 2023 : 02:45:56
|
I sent you a demo project to your email. |
|
|
xequte
38608 Posts |
Posted - Mar 27 2023 : 17:55:53
|
Thanks,
I checked your demo but did not see any issues there.
Bear in mind that when you create a PDF in this way, PDFium is not used. Your PDF pages are output as a (joined) image in the created PDF.
Please see:
https://www.imageen.com/help/File_Formats.html#PDF
Nigel Xequte Software www.imageen.com
|
|
|
lorife
Italy
44 Posts |
Posted - Mar 28 2023 : 02:04:33
|
Hello, thank you for the answer.
But it seems like there's no compression applied. First PDF is 66Kb, second PDF is 707Kb. Resulting PDF is 5.03Mb (if I'm lucky. Some PDF got to 10Mb for one page).
There has to be a way of compressing it. Can you help me? |
|
|
xequte
38608 Posts |
Posted - Mar 28 2023 : 15:46:12
|
Oh, sorry, I thought you meant size in terms of pixel area. For file size, ensure your image does not contain an alpha channel:
destBmp.RemoveAlphaChannel(True);
In my testing of your project, it reduced its file size to 440KB.
There is an issue in the current JoinBitmaps() method that can cause it to allocate an alpha channel. This is fixed in the current beta, but you can just use RemoveAlphaChannel(True);
Nigel Xequte Software www.imageen.com
|
|
|
lorife
Italy
44 Posts |
Posted - Mar 29 2023 : 02:00:48
|
It works!! great!! thank you!
Should I call RemoveAlphaChannel(True) everytime I use a TIEBitmap?
For example, I load an image like this:
myImageEN.IO.LoadFromFilePDF(FConversioni.FFullPathIN);
then I do this:
bmp := iev_IN.IEBitmap;
idx := iemv_OUT.AppendImage;
iemv_OUT.SetImage(idx, bmp);
do I need to use RemoveAlphaChannel here too? |
|
|
xequte
38608 Posts |
Posted - Mar 29 2023 : 17:28:47
|
An alpha channel is only added when loading an image with an alpha channel (PNG, GIF, etc) or doing an operation that requires one. It is an issue in 12.0.0 that adds one in JoinBitmaps() but it is fixed in the current beta. An alpha channel will never be added when loading PDF.
If you are saving to PDF and want to ensure a smaller file size regardless of the input format, then removing the alpha channel is probably good practice.
Nigel Xequte Software www.imageen.com
|
|
|
lorife
Italy
44 Posts |
Posted - Mar 30 2023 : 07:39:50
|
Ok, thank you. I have one last quesiton. As I load the data into an ImageENView, then I copy what I need into an ImageENMView, then I save the content of ImageENMView can i remove the alpa channel from the ImageENMview (in all the frames) before saving? If it's possible, how can I do that? Otherwise I have to remove it from ImageENView before bringing it to ImageENMview |
|
|
xequte
38608 Posts |
Posted - Mar 30 2023 : 15:28:47
|
Hi
You can use:
// Remove alpha from all images
for i := 0 to ImageEnMView1.ImageCount - 1 do
begin
bmp := ImageEnMView1.GetTIEBitmap( i );
bmp.RemoveAlphaChannel(True);
ImageEnMView1.ReleaseBitmap( i, True );
end;
ImageEnMView1.Update();
Nigel Xequte Software www.imageen.com
|
|
|
lorife
Italy
44 Posts |
Posted - Apr 05 2023 : 08:55:37
|
thank you! |
|
|
|
Topic |
|