Resmin Boyutunu Değiştirme

DrogbA

Forum Üyesi
Katılım
27 Ara 2020
Mesajlar
3,440
Tepkime puanı
0
Puanları
36
PHP:
 System.IO.MemoryStream memoryStream = new System.IO.MemoryStream( byteArray );
System.Drawing.Image image = System.Drawing.Image.FromStream( memoryStream );
System.Drawing.Image thumbnail = new Bitmap( newWidth, newHeight );
System.Drawing.Graphics graphic = System.Drawing.Graphics.FromImage( thumbnail );
 
graphic.InterpolationMode = InterpolationMode.HighQualityBicubic;
graphic.SmoothingMode = SmoothingMode.HighQuality;
graphic.PixelOffsetMode = PixelOffsetMode.HighQuality;
graphic.CompositingQuality = CompositingQuality.HighQuality;
 
graphic.DrawImage(image, 0, 0, newWidth, newHeight);                
 
if( contentType == "image/gif" )
{
     using ( thumbnail )
     {
          OctreeQuantizer quantizer = new OctreeQuantizer ( 255 , 8 ) ;
          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.Quality, 100L);
     Response.ContentType = "image/jpeg";
     thumbnail.Save(Response.OutputStream, info[1], encoderParameters);
}
 

Nutella

Bayan Üye
Özel Üye
Katılım
2 Ocak 2021
Mesajlar
3,559
Tepkime puanı
0
Puanları
36
Cinsiyet
  1. Bayan
Takım
Galatasaray
Paylaşım için teşekkürler.
 
metal işleme
Üst