Как изменить размер изображения без растягивания в C

0 голосов
спросил в категории C
Вы должны сохранять соотношение сторон одинаковым при настройке размера, вы не можете просто использовать произвольные значения для ширины и высоты.

Я нашел это на
`The key to keeping the correct aspect ratio while resizing an image is the algorithm used to calculate the ratio, viz. NewHeight = GivenWidth * (OriginalHeight / OriginalWidth) or NewWidth = GivenHeight * (OriginalWidth / OriginalHeight) This calculation assumes that the "Given..." is the dimension the image should be resized to. Once we know this, we can multiply it by the original image?s aspect, and that will give us the other side's value we need. So, assuming the original image has a width of 1000 and a height of 1600 and we want it to be resized to a width of 500: First find the aspect: (1600 / 1000) = aspect of 1.6 Now multiply the aspect by the desired new width: 1.6 * 500 The result of that multiplication is 800, which is what our height should be In other words: 800 = 500 * (1600 / 1000) So the resulting image would have a height of 800 and a width of 500.`
# [#^ #]
`The key to keeping the correct aspect ratio while resizing an image is the algorithm used to calculate the ratio, viz. NewHeight = GivenWidth * (OriginalHeight / OriginalWidth) or NewWidth = GivenHeight * (OriginalWidth / OriginalHeight) This calculation assumes that the "Given..." is the dimension the image should be resized to. Once we know this, we can multiply it by the original image?s aspect, and that will give us the other side's value we need. So, assuming the original image has a width of 1000 and a height of 1600 and we want it to be resized to a width of 500: First find the aspect: (1600 / 1000) = aspect of 1.6 Now multiply the aspect by the desired new width: 1.6 * 500 The result of that multiplication is 800, which is what our height should be In other words: 800 = 500 * (1600 / 1000) So the resulting image would have a height of 800 and a width of 500.`

Ваш ответ

 Отображаемое имя (по желанию): Отправить мне письмо на этот адрес если мой ответ выбран или прокомментирован: Конфиденциальность: Ваш электронный адрес будет использоваться только для отправки уведомлений.
0 голосов
ответил от
I want to point out my appreciation for your kind-heartedness giving support to folks that have the need for assistance with the concept. Your special commitment to getting the message up and down was pretty insightful and have frequently made regular people much like me to get to their aims. Your personal important publication implies a lot to me and especially to my office workers. With thanks; from all of us.
moncler http://www.monclersoutlet.us.com