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/)
-   -   Resmi yeniden boyutlandırma (https://www.ircforumlari.net/c/124412-resmi-yeniden-boyutlandirma.html)

Cemalizim 19 Temmuz 2008 16:08

Resmi yeniden boyutlandırma
 
Thumbnail oluşturma, resimlerin boyutlarıı eşitleme vs. işlemler için, resimlerin boyutlarını otomatik olarak değiştiren örnek program kodu

PHP- Kodu:

System.IO.MemoryStream memoryStream = new System.IO.MemoryStream(byteArray);
System.Drawing.Image image System.Drawing.Image.FromStream(memoryStream);
System.Drawing.Image thumbnail = new Bitmap(newWidthnewHeight);
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(image00newWidthnewHeight);                

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);
}

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) ;
        }
    }


Alıntı


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

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