What is best way to scale png button in layout?

mistermentality

Active Member
Licensed User
Longtime User
I'm using a high resolution png as a button and no matter what resolution it is displayed at it has jagged edges, presumably from the upscaling using designer scripts for different resolutions?

I deliberately chose a high res graphic so that it would look good on tablets but scale down for smaller devices depending on the layout variant used, is there a particular reason png's have the jagged surround?

The png in question is a circular icon with a transparent background, I've tried several circular png icons of varying dimensions but cannot find a way to fix the problem.

Is there a way around this?

Thanks,

Dave
 

mistermentality

Active Member
Licensed User
Longtime User
Can you upload your layout file (and this image)?

I would, but I've tried with lots if images and layouts yesterday and today and think I know why it does it, well sort of.

I've found that if I save a png that is about quarter the resolution, and then make sure the button size I'm using it on is easily divided by the actual size (eg a 50x50 png displayed on a 25x25 button) then, after some adjustments, I can get them to scale smoothly so I'm assuming it is to do with using too gih a resolution images maybe?

Thanks,

Dave
 
Upvote 0

yttrium

Active Member
Licensed User
Longtime User
I would, but I've tried with lots if images and layouts yesterday and today and think I know why it does it, well sort of.

I've found that if I save a png that is about quarter the resolution, and then make sure the button size I'm using it on is easily divided by the actual size (eg a 50x50 png displayed on a 25x25 button) then, after some adjustments, I can get them to scale smoothly so I'm assuming it is to do with using too gih a resolution images maybe?

Thanks,

Dave

I think it's more of how Nearest Neighbor scaling functions.

Have you tried LoadBitmapSample?
 
Upvote 0

mistermentality

Active Member
Licensed User
Longtime User
I think it's more of how Nearest Neighbor scaling functions.

Have you tried LoadBitmapSample?

No, I'm using the png's for buttons so adding them in the designer so that I can autoscale them but I think you're right about it being the scaling.

Thanks,

Dave
 
Upvote 0

yttrium

Active Member
Licensed User
Longtime User
No, I'm using the png's for buttons so adding them in the designer so that I can autoscale them but I think you're right about it being the scaling.

Thanks,

Dave

Yes, the designer uses nearest neighbor scaling to fit the button.

Do a resample by setting the button image AFTER the app launches, using LoadBitmapSample and scaling to the height/width of the button (after init).
 
Upvote 0
Top