mpdillon
asked on
Visual Basic 2008 Resize jpg
I would like to open a .jpg image file and resize it. I have seen some code but that seems to be for bitmap images, .bmp. Before i resize the .jpg, I need to know the original Height and Width.
I want the final image to be no more than 200 pixels on its longest side. Once i know the original dimension, I can factor both the height and width before making the resize request.
I have not written any code like this before so please be specific in your reply.
thanks,
pat
I want the final image to be no more than 200 pixels on its longest side. Once i know the original dimension, I can factor both the height and width before making the resize request.
I have not written any code like this before so please be specific in your reply.
thanks,
pat
ASKER
This looks like it will work. There are a few things I do not understand.
Why is the image Rotated twice? The first two lines of code.
You use the GetThumbnail method to resize the image. But if a thumbnail exists it scales the thumbnail and not the original image. I am concerned about the quality of a scaled thumbnail. Your comments suggest that by rotating the image, the thumbnail will not be used. But I do not understand.
Lastly, I am used to Photoshop where I always specify a Interpolation method when resizing either up or down. I found the same property in MSDN but I do not see how to apply it in your code. Could you please help?
http://msdn.microsoft.com/en-us/library/system.drawing.drawing2d.interpolationmode.aspx
thanks,
pat
Why is the image Rotated twice? The first two lines of code.
You use the GetThumbnail method to resize the image. But if a thumbnail exists it scales the thumbnail and not the original image. I am concerned about the quality of a scaled thumbnail. Your comments suggest that by rotating the image, the thumbnail will not be used. But I do not understand.
Lastly, I am used to Photoshop where I always specify a Interpolation method when resizing either up or down. I found the same property in MSDN but I do not see how to apply it in your code. Could you please help?
http://msdn.microsoft.com/en-us/library/system.drawing.drawing2d.interpolationmode.aspx
thanks,
pat
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you
C#: Resize An Image While Maintaining Aspect Ratio and Maximum Height
http://snippets.dzone.com/posts/show/4336
C#:
Open in new window
VB.NET:
Open in new window