Greetings,
I need to know how to scale images in Xojo web. I frequently create my own icons (.jpg & .png) to be used as graphical buttons, but I have not found any events, methods, or properties that allow them to be scaled in the WebImagewell, WebCanvas, or any other Xojo Web controls.
I’ve been searching for a solution for several weeks and people have speculated that it would be available in a future version of Xojo Web. If a native solution exists, please point me to it or please let me know how to get my images to render correctly for any screen size. I’m hoping that it’s just something simple that I’ve overlooked.
Hi Greg,
Thanks for your response, but I don’t understand what you are suggesting. (BTW, I accidentally clicked the box for “This answers my question.”).
Are you saying that I should have two WebImageWell controls, for example, and copy one picture into another? Could you demonstrate with some code and specify which controls you’re using? Whenever I’ve added an image to my project and selected it in the “Picture” drop-down box in the Inspector, it always renders at some unexpected size.
If you put “scale image” into the forum search box, you will find many threads with example code for scaling images. For example this one .
It will end up extending the Picture class with a new method, where you pass the max width and height you want to allow and it will scale it to fit while keeping the aspect ratio:
Dim newPic as Picture = originalPic.ResizeToFit( maxWidth, maxHeight )
You can then assign newPic to your WebImageView. Or skip the newPic object and just assign originalPic.ResizeToFit() directly to the WebImageview picture property itself: