12/10/2023 0 Comments Resize image keep aspect ratio![]() #resizedImg= img.getScaledInstance(900,700, 1)Į('ContainerMap').getComponent("Image").setIcon(newIcon)Į('ContainerMap').getComponent("Image"). # If an image is stored in the database (blob > 0) then display the image. # Get the binary image from the database.īlob = system.db.runScalarQuery("SELECT StoredImage FROM Images WHERE ImageID = '%s'"%(imageID)) The box has set width and height and I want the image to fill as much of the box as possible but maintain the aspect ratio it originally had. ![]() # Hide the Image control in case there is no image in the database for drop-down selection.Į('ContainerMap').getComponent("Image").visible = 0 I need to know of a way to resize an image to fit in a box without the image stretching too much. If you want to resize the image without keeping the same. ![]() That’s why you can see the image is been stretch either along the x - axis or along the y axis. And on the right, we have both of the resized images without considering the aspect ratio of the image. # Get the selected String Value of the Dropdown. The height is automatically updated to keep the same aspect ratio. Figure 1: Neglecting the aspect ratio of an image while resizing. I had also thought of trying to get the height and width of the Container on propert圜hange and then manually resize the image icon, but I could not see how to get the size (height, width) of the Container. You can see in the script that I was using getScaledInstance at one point. Some more information is that the image is stored in the SQL Server database and loaded into the Image at runtime via the script in a dropdown selection shown below. Is there a way to accomplish this?īoth the Layout for the Container and Image are Relative/Maintain Aspect Ratio/Center. However, the actual jpg in the Image Path does not rescale/resize with the Image container. The Image component itself actually seems to be resizing fine based on seeing that the Border of the Image component is resizing with the Border of the Container. I have an image in a Container that I would like to resize along with the container.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |