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
 Calculating the size of the *image* in a TImageEnMView thumbnail
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

HeartWare

Denmark
29 Posts

Posted - Nov 17 2021 :  02:37:00  Show Profile  Reply

If I have a TImageEnMView with 100x100 thumbnail and a BottomText, how do I calculate the *actual* size of the *image* within the thumbnail (in my measurements, it's 66x66 pixels, but how is this *calculated*?).

I'm resizing my images to the thumbnail size, but ImageEn then resizes (shrinks) it even further. How can I ensure that my image (TiEBitmap) is resized - by me - to the proper size, and not resized further by ImageEn?

If I resize it to 66x66 will ImageEn then first enlarge it to 100x100 and then reduce it to 66x66 afterwards, or will it use the image at 66x66 directly?

Keld R. Hansen

xequte

6513 Posts

Posted - Nov 23 2021 :  00:19:45  Show Profile  Reply
Hi Keld

There are a number of factors that affect the true display size of the thumbnail, but you can get the size using:

https://www.imageen.com/help/TImageEnMView.ThumbSizeInfo.html

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

HeartWare

Denmark
29 Posts

Posted - Nov 23 2021 :  01:40:38  Show Profile  Reply
There's something I don't understand about this...

On a TImageEnMView with ThumbWidth=100 and ThumbHeight=100, I get these results:

itsCell returns 100x100
itsImage returns 100x113

How can the Image Size be larger than the Cell Size, when Cell Size *includes* Image Size and something more...

Value Description
itsImage Returns the size of the thumbnail image as displayed
itsCell Returns the size of the thumbnail cell (image, text and cell border)
Go to Top of Page

HeartWare

Denmark
29 Posts

Posted - Nov 23 2021 :  02:07:07  Show Profile  Reply
Also, if I on a 100x100 Thumbnail size TImageEnMView generate a full red box of 100x100 and add it to the viewer with a text below, I get this:



The red square is exactly 66x66 pixels in size.

When I interrogate the ThumbSizeInfo, I get this:

100x78

So where does the other 12 pixels come from?

If I then use this information and generate a perfect checkered .BMP file of black and white pixels and add it, I get this image:



which clearly isn't a perfect checkered B&W image.

However, if I generate a 66x66 one, I get this:



which is clearly a perfect checkered B&W image.

So the ThumbSizeInfo is returning incorrect (or at least - in my case - unusable) information.

How do I get the *exact* size of the image portion of the cell, so I can render a file that isn't being resized by ImageEn before being displayed?
Go to Top of Page

xequte

6513 Posts

Posted - Nov 23 2021 :  20:44:16  Show Profile  Reply
Hi

Regarding the invalid result for itsImage, you might have some legacy values for your TImageEnMView properties. Are you able to generate a small demo that shows it?

You look to be using a soft shadow, which ThumbSizeInfo() does not consider. I will add that as an option in the current beta. You can get the same result by deducting the following from the Result.X and .Y:

SoftShadowSize := IESoftShadowSize( ImageEnMView1.SoftShadow.Radius, ImageEnMView1.SoftShadow.OffsetX, ImageEnMView1.SoftShadow.OffsetY);

Also consider that ThumbSizeInfo() returns the maximum image width and height. One of the values will actually be lower because the image aspect ratio is maintained.

Also see:

https://www.imageen.com/help/TImageEnMView.SetThumbnailSize.html


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

HeartWare

Denmark
29 Posts

Posted - Nov 24 2021 :  02:34:16  Show Profile  Reply
While creating the demo program, I found out that it was the Soft Shadow that interfered. When I take that into account, it returns the correct value. All of that because I did as recommended and called "SetModernStyling" and that screwed it up :-).

In case anyone is interested, the Demo program (incl. a toggle to enable/disable Modern Styling) can be downloaded here:
https://www.dropbox.com/s/h1mmjdqa7gu2qyc/Demo.zip?dl=1

In all cases, it's the 3rd image generated that works, regardless of other settings.
Go to Top of Page

HeartWare

Denmark
29 Posts

Posted - Nov 24 2021 :  04:35:18  Show Profile  Reply
When you update ThumbSizeInfo make sure to include the fix in a new method (ie. a new enumeration value), instead of fixing the itsImage calculation (otherwise my updated code will suddenly adjust for the soft shadow twice and yield incorrect results).
Go to Top of Page

xequte

6513 Posts

Posted - Nov 24 2021 :  14:51:26  Show Profile  Reply
Hi

It is a parameter "CheckSoftShadow" that is off by default so as not to break any existing user functionality.

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