简体   繁体   English

将文件中的图像调整为合适的宽高比vb6

[英]Resize image from file to the right aspect ratio vb6

I searched about re-sizing images all over the place and they all use picturebox and Image control trying to fit an image inside it without distortion of the image. 我搜索了整个位置的图像调整大小,它们都使用Picturebox和Image控件,试图将图像放置在其中而不变形。

In my case I have an image of 2048X900 of size but the image is stretched in width I need to read it from a file, repair it by changing the aspect ratio of the image, and store it back. 在我的情况下,我的图像尺寸为2048X900,但是图像的宽度被拉伸了,我需要从文件中读取图像,然后通过更改图像的纵横比对其进行修复,然后将其存储回来。 I leaned I can't do directly on the image and some use control to do all this steps. 我靠后无法直接对图像进行操作,有些人使用控件来完成所有这些步骤。

Any suggestion of I have to use a control to change the ratio of an image 我的任何建议都必须使用控件来更改图像的比例

thanks 谢谢

When you choose to resize an image into a different aspect ratio than the original's, you'll need to decide how you'd like that to happen. 当您选择将图像的尺寸调整为与原始图像不同的长宽比时,您需要决定如何进行。 There are various ways, like stretching (as you already mentioned), padding (resizing the image and filling the padding with whitespaces or anything else), or cropping the image (which means that you'll need to choose which parts of the images remain visible and which ones don't). 有多种方法,例如拉伸(如前所述),填充(调整图像大小并用空白或其他填充填充)或裁剪图像(这意味着您需要选择保留图像的哪些部分)可见,哪些不可见)。

There are quite a few of ways to perform such image resizing, either locally with a software or using cloud services. 可以使用软件在本地或使用云服务执行多种方法来调整图像大小。 For example, with Cloudinary you can upload an image and resize it to any dimensions you'd like, including altering the aspect ratio. 例如,使用Cloudinary,您可以上传图像并将其调整为所需的任何尺寸,包括更改宽高比。 Everything is done seamlessly on the fly and in the cloud. 一切都在云端和云端无缝完成。 For more information: http://cloudinary.com/documentation/image_transformations#aspect_ratio_based_cropping 有关更多信息: http : //cloudinary.com/documentation/image_transformations#aspect_ratio_based_cropping

Disclosure - I work at Cloudinary. 披露-我在Cloudinary工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM