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
 Extracting Image, editing it and setting is back in PDF is not working for me...

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 - Oct 28 2026 : 07:58:49
Hello,

I am using the following code to find the image object, extract it, apply contrast and then set it back. But I am not getting any result.


procedure TfrmMain.ApplyContrastToTopmostImage;
const
  // Contrast boost applied to the topmost image of the extracted card
  // (range: -100..+100, 0 = no change)
  CONTRAST_AMOUNT = 90.0;
var
  I, TopIdx, TopMost: Integer;
  Obj: TPdfObject;
  bmp: TIEBitmap;
  Applied: Boolean;
begin
  if (ImageEnView1.PdfViewer.Objects = nil) or
     (ImageEnView1.PdfViewer.Objects.Count = 0) then
    Exit;

  Application.ProcessMessages;

  // Find the image object that is visually topmost (smallest Bounds.Top)
  TopMost := MaxInt;
  TopIdx := -1;
  for I := 0 to ImageEnView1.PdfViewer.Objects.Count - 1 do
  begin
    Obj := ImageEnView1.PdfViewer.Objects[I];
    if (Obj.ObjectType = ptImage) and (Obj.Bounds.Top < TopMost) then
    begin
      TopMost := Obj.Bounds.Top;
      TopIdx := I;
    end;
  end;

  if TopIdx < 0 then
    Exit;

  Application.ProcessMessages;

  // Extract the image, boost contrast and write it back
  bmp := TIEBitmap.Create();
  Applied := False;
  try
    if ImageEnView1.PdfViewer.Objects[TopIdx].GetImage( bmp ) then
    begin
      bmp.Proc.Contrast( CONTRAST_AMOUNT );

      // Store the photo as JPEG to keep the PDF compact
      ImageEnView1.IO.Params.PDF_Compression := ioPDF_JPEG;
      ImageEnView1.IO.Params.JPEG_Quality := 90;

      Applied := ImageEnView1.PdfViewer.Objects[TopIdx].SetImage( bmp );
    end;
  finally
    bmp.Free();
  end;

  if Applied then
    ImageEnView1.PdfViewer.ReloadPage();  // required after changing page images

  UpdateControls( True );
end;


TIA

Yogi Yang
6   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Nov 02 2026 : 17:03:52
Hi Yogi

Your code works for me.

To make it easy to confirm, change the Contrast code to:
bmp.Proc.Negative();

Does the change occur?

Try inspecting (or saving) the bmp during the process to confirm.

Also, are you using the new iepdf32/64.dll in v15.4.0?


Nigel
Xequte Software
www.imageen.com
yogiyang Posted - Nov 02 2026 : 01:27:56
Hello Nigel,

This issue still persist in the new Preview release.

I just tried it out.

I am able to replace the image with another image but color correcting the then apply the image back is not working.

Yogi Yang
yogiyang Posted - Nov 02 2026 : 00:57:27
Hello Nigel,

I just wanted to confirm if this issue is also resolved in the Preview or not.

https://www.imageen.com/ieforum/topic.asp?TOPIC_ID=6670

TIA

Yogi Yang
xequte Posted - Oct 30 2026 : 02:46:32
OK, email me for v15.4.0 to confirm the issue.

Nigel
Xequte Software
www.imageen.com
yogiyang Posted - Oct 29 2026 : 23:32:44
Yes, it is v15.2.0

Yogi Yang
xequte Posted - Oct 28 2026 : 18:23:55
Hi Yogi

What version of ImageEn is this? If it is not v15.4.0, please email me.

Nigel
Xequte Software
www.imageen.com