private void GetResizedImage(string imagePath, int width, int height, string destinationDirectory, string destinationFileName)
{
System.Drawing.Image image = System.Drawing.Image.FromFile( imagePath, true );
Bitmap thumbnail = new Bitmap( width, height, image.PixelFormat );
Graphics graphics = Graphics.FromImage( thumbnail );
graphics.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQu ality;
graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality ;
graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQua lityBicubic;
Rectangle rectangle = new Rectangle(0, 0, width, height);
graphics.DrawImage( image, rectangle );
image.Dispose();
thumbnail.Save( destinationDirectory + "\\" + destinationFileName + "." + System.Drawing.Imaging.ImageFormat.Jpeg);
thumbnail.Dispose();
} 2 2453
Try
thumbnail.Save( destinationDirectory + "\\" + destinationFileName + ".jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
"Al" <none@gmail_NOSPAM_.com> wrote in message news:%2****************@TK2MSFTNGP11.phx.gbl...
private void GetResizedImage(string imagePath, int width, int height, string destinationDirectory, string destinationFileName)
{
System.Drawing.Image image = System.Drawing.Image.FromFile( imagePath, true );
Bitmap thumbnail = new Bitmap( width, height, image.PixelFormat );
Graphics graphics = Graphics.FromImage( thumbnail );
graphics.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQu ality;
graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality ;
graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQua lityBicubic;
Rectangle rectangle = new Rectangle(0, 0, width, height);
graphics.DrawImage( image, rectangle );
image.Dispose();
thumbnail.Save( destinationDirectory + "\\" + destinationFileName + "." + System.Drawing.Imaging.ImageFormat.Jpeg);
thumbnail.Dispose();
}
That worked beautifully! Thank you.
"Chris Lovett" <so*****@nospam.please> wrote in message news:gL*****************************************@c omcast.com...
Try
thumbnail.Save( destinationDirectory + "\\" + destinationFileName + ".jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
"Al" <none@gmail_NOSPAM_.com> wrote in message news:%2****************@TK2MSFTNGP11.phx.gbl...
private void GetResizedImage(string imagePath, int width, int height, string destinationDirectory, string destinationFileName)
{
System.Drawing.Image image = System.Drawing.Image.FromFile( imagePath, true );
Bitmap thumbnail = new Bitmap( width, height, image.PixelFormat );
Graphics graphics = Graphics.FromImage( thumbnail );
graphics.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQu ality;
graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality ;
graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQua lityBicubic;
Rectangle rectangle = new Rectangle(0, 0, width, height);
graphics.DrawImage( image, rectangle );
image.Dispose();
thumbnail.Save( destinationDirectory + "\\" + destinationFileName + "." + System.Drawing.Imaging.ImageFormat.Jpeg);
thumbnail.Dispose();
} This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Marek Mänd |
last post by:
Can the
<button><img></button>
mutated via CSS so, that the inner image of <BUTTON>
would entirely visually become the button itsself - I mean without the
outer elements borders and so...
...
|
by: George Hester |
last post by:
http://hesterloli.dnsalias.com/test/javascript_image.htm
The image is the 100x100 px block. If we right-click in it and try to save the image we cannot. Is it possible to say set a mime-type so...
|
by: Tim Marshall |
last post by:
Is this possible does anyone know? I mean other than using imaging
software.
The scenario is this. I have a form with a large image control over
which is imposed a grid of squares (label...
|
by: dale zhang |
last post by:
Hi,
I am trying to read an image from MS Access DB based on the following article:
http://www.vbdotnetheaven.com/Code/Sept2003/2175.asp
The article author is using PictureBox for windows...
|
by: dale zhang |
last post by:
Hi,
I am trying to save and read an image from MS Access DB based on the
following article:
http://www.vbdotnetheaven.com/Code/Sept2003/2175.asp
Right now, I saved images without any...
|
by: lgbjr |
last post by:
Hello All,
I¡¯m using a context menu associated with some pictureboxes to provide
copy/paste functionality. Copying the image to the clipboard was easy. But
pasting an image from the clipboard...
|
by: Tom John |
last post by:
Hi
I am storing images in an access database, based on an MSDN article.
The code i use to store is as follows:
<code>
'Create the command object
Dim command As New...
|
by: Andrea Gavana |
last post by:
Hello NG,
sorry if the message is not strictly Python-related, but it is
fantastically impossible to send post to Image-SIG.
I am using PIL to load and display some pictures (via wxPython) in a...
|
by: jitu78 |
last post by:
GIF Images
Use GIF files for images that have a small number of colors. GIF files are always reduced to no more than 256 unique colors. The compression algorithm for GIF files is less complex than...
|
by: Saaima |
last post by:
Hi All
when I store a picture of size 800*600 pixels in database (SqlServer)
field Photo (Image) and load it into crystal report through query by dragging and dropping
the field on report it...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |