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
 Usage of TImageEnMView.RemoveBlankPages with JPG
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

aleatprog

122 Posts

Posted - Oct 16 2020 :  12:19:42  Show Profile  Reply
Hi,

even if TImageEnMView.RemoveBlankPages works only with 1bit bitmaps, is there a workaround to let the function check 24bit bitmaps?

E.g. is it possible to create a 1bit copy of each bitmap, let the copy been checked by RemoveBlankPages and get the idx of all removed pages in order to delete the 24bit originals from TImageEnMView?

Al

xequte

38128 Posts

Posted - Oct 18 2020 :  17:41:12  Show Profile  Reply
Hi Al

RemoveBlankPages uses the GetDominantColor algorithm to find the percentage of the image of a certain color.

There is no requirement for it to be 1bit. It is actually designed for 24bit bitmaps:

https://www.imageen.com/help/TImageEnProc.GetDominantColor.html

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

aleatprog

122 Posts

Posted - Oct 24 2020 :  17:16:07  Show Profile  Reply
Thank you for the hint, Nigel. The following code works for me:

var
  i: Integer;
  IEBitmap: TIEBitmap;
  proc: TImageEnProc;
  Percentage: Double;
  cl: TRGB;
begin
  for i := ImageEnMView1.ImageCount -1 downto 0 do
    begin
      IEBitmap := TIEBitmap.Create;
      try
        ImageEnMView1.CopyToIEBitmap(i, IEBitmap, True);
        ImageEnMView1.ReleaseBitmap(i);
        proc := TImageEnProc.CreateFromBitmap(IEBitmap);
        proc.ConvertTo(ie1g, ieptFixedBW, iedtSolid);
        Percentage := proc.GetDominantColor(cl);
        proc.Free;
        if Percentage = 100 then
          ImageEnMView1.DeleteImage(i);
      finally
        IEBitmap.Free;
      end;
    end;
end;

Al
Go to Top of Page

xequte

38128 Posts

Posted - Oct 25 2020 :  01:09:58  Show Profile  Reply
Thanks Al,

Did it not work well enough with something like:

// Remove any pages that are 95% blank
ImageEnMView1.RemoveBlankPages( 0.05 );

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

aleatprog

122 Posts

Posted - Oct 25 2020 :  07:49:28  Show Profile  Reply
Nope. : )

I don't know why, even with a value of 0.99 or 1.0 RemoveBlankPages doesn't work with color bitmaps in my app, meanwhile RemoveBlankPages works perfectly with B/W bitmaps. That's why I searched for a workaround for color bitmaps.
Go to Top of Page

xequte

38128 Posts

Posted - Oct 25 2020 :  16:06:57  Show Profile  Reply
Hi

Can you please email me a selection of your images for testing.

Nigel
Xequte Software
www.imageen.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: