Manipulating / Resizing / Scaling an image in vb.net

Posted by Christian Payne on Stack Overflow See other posts from Stack Overflow or by Christian Payne
Published on 2010-05-24T22:22:59Z Indexed on 2010/05/24 22:31 UTC
Read the original article Hit count: 314

Filed under:
|
|

Imagine I have a rectangle say 400px x 300px. Then let’s say I want to load an image in that. All of this is very easy using Sytem.Drawing.DrawImage.

Rectangle

But then I want to leave the left hand side as 300px but change the right hand side to 250 px. I can draw the box using 4 DrawLines but I don’t know how to squash the image into the new shape. I want the right hand side of the shape to be 250, the left size 300 and the top and bottom 400px.

Resized

I can’t use DrawImage as it expects the left and right sizes to be the same. Is there a way to manipulate the image into the new shape?

I've looked at other questions, but they only apply where the left and right hand side is equal.

Any thoughts on how to squash an image into a shape which did not have parallel sides?

(If it helps, I'm happy to sacrifice image quality to fit the right shape.)

© Stack Overflow or respective owner

Related posts about vb.net

Related posts about image