IRCForumları - IRC ve mIRC Kullanıcılarının Buluşma Noktası

IRCForumları - IRC ve mIRC Kullanıcılarının Buluşma Noktası (https://www.ircforumlari.net/)
-   C# (https://www.ircforumlari.net/c/)
-   -   Resmin Boyutunu Değiştirme (https://www.ircforumlari.net/c/124413-resmin-boyutunu-degistirme.html)

Cemalizim 19 Temmuz 2008 16:09

Resmin Boyutunu Değiştirme
 
Gif ve Jpg formatındaki resimlerin genişlik ve yükseklik değerlerini değiştiren kod


PHP- Kodu:

System.IO.MemoryStream memoryStream = new System.IO.MemoryStreambyteArray );
System.Drawing.Image image System.Drawing.Image.FromStreammemoryStream );
System.Drawing.Image thumbnail = new BitmapnewWidthnewHeight );
System.Drawing.Graphics graphic System.Drawing.Graphics.FromImagethumbnail );
 
graphic.InterpolationMode InterpolationMode.HighQualityBicubic;
graphic.SmoothingMode SmoothingMode.HighQuality;
graphic.PixelOffsetMode PixelOffsetMode.HighQuality;
graphic.CompositingQuality CompositingQuality.HighQuality;
 
graphic.DrawImage(image00newWidthnewHeight);                
 
if( 
contentType == "image/gif" )
{
     
using thumbnail )
     {
          
OctreeQuantizer quantizer = new OctreeQuantizer 255 ) ;
          
using Bitmap quantized quantizer.Quantize bitmap ) )
          {
          
Response.ContentType "image/gif";
          
quantized.Save Response.OutputStream ImageFormat.Gif ) ;
          }
     }
}


if(  
contentType == "image/jpeg" )
     {
     
info ImageCodecInfo.GetImageEncoders();
     
EncoderParameters encoderParameters;
     
encoderParameters = new EncoderParameters(1);
     
encoderParameters.Param[0] = new EncoderParameter(Encoder.Quality100L);
     
Response.ContentType "image/jpeg";
     
thumbnail.Save(Response.OutputStreaminfo[1], encoderParameters);


Alıntıdır.


Tüm Zamanlar GMT +3 Olarak Ayarlanmış. Şuanki Zaman: 03:55.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO
Copyright ©2004 - 2025 IRCForumlari.Net Sparhawk