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
 Resizing images

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
JTT Posted - Mar 19 2021 : 15:56:20
I have an app that loads an RTF doc into a RichEdit and converts into a 96 DPI BMP for annotating with an ImageENVect using layers.

This worked fine on older lower res tablets. But on newer higher res tablets the BMP appears so small as to be almost unreadable in the ImageENVect.

What can be used to manipulate the image size prior to loading it into the ImagENVect? The current size of the BMP's is 816 W x 1344 H, The desired size is 1280 W x 1656 H.

Also, is there a way to check a tablet's resolution to determine how much the image needs to be resized in order to enforce consistency across different machines?

TIA.


John

JTT
5   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Mar 22 2021 : 00:23:36
Hi John

In my TIERichEdit example you can set the image size to whatever you like. Because the Rich Edit is wrapped the width does not matter much.

After setting the width, call the following to calculate the height:

  // Calc height of text at this width
  textH := Editor.MeasureText( 0, textW ).Y;


Nigel
Xequte Software
www.imageen.com
JTT Posted - Mar 21 2021 : 10:48:14
Nigel,

The current logic determines the number of pages, outputting each page to a separate BMP.
Maybe the simplest approach is to resize each BMP? How do I manipulate the BMP's height and width while maintaining the original aspect ratio?

Thanks again for the help.

John

JTT
xequte Posted - Mar 21 2021 : 00:46:08
Hi John

I don't think there is a way to paginate documents with RichEdit.

There are a number of methods to get the screen size, it depends on what you are looking for (e.g. when there are multiple monitors). You are better to google "Delphi screen size"

Nigel
Xequte Software
www.imageen.com
JTT Posted - Mar 21 2021 : 00:15:07
Nigel,

Wow! I wasn't even aware that IERichEdit existed.

The code sample is extremely helpful. One detail I left out though, the RTFs the app opens can contain multiple pages- a maximum of 5. Are there methods which allow me to determine how many pages the RTF contains and iterate through each page saving each to a separate BMP?

In regard to your question, ideally I'd like to make the app adjust the size of the BMPs according to host screen size.

Thanks once again.

John

JTT
xequte Posted - Mar 19 2021 : 17:45:36
Hi John

If you use a TIERichEdit, then you can easily load an RTF file and output it to an image of any size:

const
  Out_Width   = 500;
  Out_Height  = 800;
  Text_Margin = 20;
var
  re : TIERichEdit;
  bmp: TIEBitmap;
  textRect: TRect;
begin
  bmp := TIEBitmap.Create;
  re := TIERichEdit.CreateParented(HWND(HWND_MESSAGE));
  try
    re.Visible  := False;
    re.WordWrap := False;
    re.OpenFromFile( 'D:\RTF Document.rtf' );

    bmp.width  := Out_Width;
    bmp.height := Out_Height;

    textRect := Rect( Text_Margin,
                      Text_Margin,
                      Out_Width - Text_Margin,
                      Out_Height - Text_Margin );

    re.PaintTo( bmp, textRect, iehCenter, ievCenter, True );

    bmp.Write('D:\RtfImage.jpeg' );
  finally
    bmp.Free;
    re.Free;
  end;
end;


Info: https://www.imageen.com/help/TIERichEdit.PaintTo.html


With regard to tablets, are you looking to get the Screen.Width/Height?

Nigel
Xequte Software
www.imageen.com