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
 Adjusting fonts/line/border widths to image size?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

whisper1980

USA
30 Posts

Posted - Nov 25 2019 :  18:57:40  Show Profile  Reply
If I set a layer with text, line or shape etc, and set a font size or line/border width that looks good on a 640x480 image, it is then too small or thin on a 1920x1080 image using the same values because the final viewing size of the image, or zoom size, might be just 3 inches wide.

We have customers that annotate images of various sizes and they have to constantly adjust the font size and widths, so it would be nice to scale the sizes and widths to look relatively the same on any size image, based perhaps on the largest dimension. So drawing a rectangle with a border width of 20 on a 640x480 base image, might actually have a border width of 40 on a 1280x960 image to look the same because I and the customer know their viewing size will be the same when added to a report, one has just a higher resolution than another. Make sense?

Basically trying to make font sizes, line and border widths relative to the image resolution (dimensions) rather than an absolute value.

I could save various sizes/widths for each image size, but I'd prefer to auto set them.

Maybe ImageEn already has a scale feature I don't see offhand that does this. Otherwise I can probably come up with a simple formula, but if anyone else has already gone this route successfully, I would love to see how you have approached this.

Thanks!

Eric

yogiyang

India
559 Posts

Posted - Nov 26 2019 :  02:06:52  Show Profile  Reply
Hello,

Are you trying to say that the border width of 20 should look same in all different display resolutions?


Yogi Yang
Go to Top of Page

whisper1980

USA
30 Posts

Posted - Nov 26 2019 :  12:43:25  Show Profile  Reply
Not really, no. Consider this... two ImageEnViews, both set to zoom image to fit. One is showing an image at 640x360 and the other showing a duplicate but higher res image at 1920x1080. They will both look the same since they are both zoomed to fit their respective view. If I add a text layer at 18pt to both, it will look like I want it on the 640x360 image, but way too small on the 1920x1080. The opposite would be true if I choose a font that looks how I want on the 1920x1080 image but would be way too big on the 640x360 image. This will confuse the user since they are viewing both with zoom to fit.... they might not realize the resolution difference is the reason of the layer size difference.

So, I was looking for a way to auto-adjust the font size selection so that adding an 18pt font to either image will be the same size in the view even though the zoom is different. In other words, to the user the image dimensions are identical between the two due to the auto fit option, so I'd like any added text or other layer objects to appear identical as well.

Of course I would know if the user is zooming to fit or not, and I would not auto-adjust the font size or border widths in that case.

I don't know if this visualizes my desire better or not, and it is probably a problematic desire of mine, but thought I'd ask if anyone has tried this and could provide the pitfalls of such a desire and just not even go there, which I feel might be something to avoid as I type all this, lol.

Eric
Go to Top of Page

xequte

4888 Posts

Posted - Nov 26 2019 :  16:43:04  Show Profile  Reply
Hi Eric

All font and other sizes are set on the assumption that zoom is 100%, so if you want say the Border Width to show on screen at 10 pixels regardless of the zoom, you would need to do something like:

ImageEnView1.CurrentLayer.BorderWidth := Round( 10 / ImageEnView1.Zoom );

Of course, if you then zoom the image it will no longer show as 10 pixels, so you would need to scale the value again (e.g. in the View Change events). Though if you are doing that, you might just want to disable zooming completely.

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

whisper1980

USA
30 Posts

Posted - Nov 26 2019 :  18:10:05  Show Profile  Reply
Thanks Nigel... cool and simple enough. I'll give that a shot. I just want to set the width relative only at the time the new layer is added, so if they zoom after that, I would want it to also zoom, so perfect. I may opt to not do this once I see it in practice, but seems like something a user might expect in our image annotation app (I better make it optional, though)

Eric
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To: