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
 Watermarking does not work on all PCs. Why?

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 - Jan 19 2022 : 00:25:39
Hello,

We are facing a very wired experience in our software. We have create a demo version of our software in which we are watermarking each output (image).

Here is the code we are using for watermarking.

procedure WaterMarkImage(ieTemp: TImageEnView);
var
  i: integer;
  j: integer;
  iLayer: integer;
  iSpacing: integer;
  iText: string;
  iRows: integer;
begin
  //Exit;
  Screen.Cursor := crHourGlass;
  ieTemp.LockUpdate;
  try
    ieTemp.DeSelect;
    iLayer := ieTemp.LayersAdd;
    ieTemp.Proc.Fill(CreateRGB(255, 255, 255));
    ieTemp.IEBitmap.Canvas.Font.Name := 'Arial';
    ieTemp.IEBitmap.Canvas.Font.Height := 45;
    ieTemp.IEBitmap.Canvas.Font.Color := clGray;
    iText:='';
    for i := 0 to 60 do
      iText := iText + '  You are using Demo Version...' ;
    iRows := 100;
    for j := 0 to iRows do
    begin
      iSpacing := 150;
      iSpacing := iSpacing * j;
      IETextOut(ieTemp.IEBitmap.Canvas, -60, iSpacing, 45, iText); // draw text on second layer
    end;
    // remove the white, making it as transparent
    ieTemp.Proc.SetTransparentColors(CreateRGB(255, 255, 255), CreateRGB(255, 255, 255), 0);
    ieTemp.LayersMergeAll;
    ieTemp.Update;
  finally
    ieTemp.UnLockUpdate;
    Screen.Cursor := crDefault;
  end;
end;


We are calling this procedure to apply watermark to image when the user save the image as well as when the user exports the image.

But this code does not run on every PC. On some PCs the code just gets skipped and there are no watermarks in the image saved or exported.

Any ideas as to what must be the problem here and how to solve it?

Another thing is that this routine is taking a hell of a long time. Can we speed this up?

TIA

Yogi Yang
10   L A T E S T    R E P L I E S    (Newest First)
yogiyang Posted - Feb 05 2022 : 06:21:46
Hello Nigel,

Thank you very much for the code sample.

Your code is working in WIn7.

TIA

Yogi Yang
xequte Posted - Feb 02 2022 : 16:01:59
Hi Yogi

Your code doesn't really use ImageEn other than for setting the transparency, which is not needed because you can just set Canvas.Brush.Style to bsClear.

Here is your code with ImageEn not used:


procedure TForm1.WaterMarkImage(ieTemp: TImageEnView);
var
  i: integer;
  j: integer;
  iSpacing: integer;
  iText: string;
  iRows: integer;
begin
  Screen.Cursor := crHourGlass;
  ieTemp.LockUpdate;
  try
    ieTemp.Deselect;
    ieTemp.IEBitmap.Canvas.Font.Name := 'Arial';
    ieTemp.IEBitmap.Canvas.Font.Height := 45;
    ieTemp.IEBitmap.Canvas.Font.Color := clGray;
    ieTemp.IEBitmap.Canvas.Brush.Style := bsClear;
    iText:='';
    for i := 0 to 60 do
      iText := iText + 'Demo Version...' ;
    iRows := 100;
    for j := 0 to iRows do
    begin
      iSpacing := 150;
      iSpacing := iSpacing * j;
      IETextOut(ieTemp.IEBitmap.Canvas, -60, iSpacing, 45, iText); // draw text on second layer
    end;
    ieTemp.Update;
  finally
    ieTemp.UnLockUpdate;
    Screen.Cursor := crDefault;
  end;
end;


Nigel
Xequte Software
www.imageen.com
yogiyang Posted - Feb 02 2022 : 00:08:19
Hello Nigel,

The biggest problem is that it is not crashing!

The WaterMarkImage procedure just does not run on Windows7!

Can you please install Win7 in a VM like VBox and check it?

You can get one from MS official web site here: https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/

TIA

Yogi Yang
xequte Posted - Feb 01 2022 : 20:30:37
Hi Yogi

It works when I test it here, though I don't have Windows 7. What line is it crashing on?

Nigel
Xequte Software
www.imageen.com
yogiyang Posted - Feb 01 2022 : 00:49:27
Hello Nigel,

The WaterMarkImage() fails in a blank project also.

This problem is reproducible. Please check attached project.

TIA

attach/yogiyang/20222104916_WaterMarkSample.zip
55.22 KB

Yogi Yang
xequte Posted - Jan 30 2022 : 18:22:09
Hi Yogi

I'm afraid I don't have a Win7 machine for testing. Are you saying that the method above WaterMarkImage() fails in a blank project on Win7?

Nigel
Xequte Software
www.imageen.com
yogiyang Posted - Jan 29 2022 : 00:39:19
Hello,

Probably I have managed to isolate the problem.

And the problem is that this code does not work under Win7 32 as well as 64 Bit. Again this works in Win10!

If I install older version of IE 9.x and compile the software it works in Win7 but after upgrading to 10.x it does not work!!

Nigel can you please look into this and help me out.

TIA

Yogi Yang
xequte Posted - Jan 20 2022 : 02:11:00
Hi Yogi

Why not just (on layer 0):

ieTemp.IEBitmap.Canvas.BackgroundStyle := bsClear;
ieTemp.IEBitmap.Canvas.TextOut( ... );

Nigel
Xequte Software
www.imageen.com
yogiyang Posted - Jan 19 2022 : 23:52:13
Hello Nigel,

Actually this very old code that I have been using for quite some time.

It was working faultlessly for many years now. But recently this has started giving problems.

What alternative should I use instead of current code?

TIA

Yogi Yang
xequte Posted - Jan 19 2022 : 21:11:57
Hi Yogi

I can't see anything in the code that should cause it to fail. Though, why are you texting out to an image layer, rather than just drawing directly to the ieTemp.IEBitmap.Canvas (without an extra layer)? (or using a TIETextLayer).



Nigel
Xequte Software
www.imageen.com