Ilano 0 Denunciar post Postado Maio 10, 2007 Olá pessoal, Estou fazendo um web site e preciso saber como faço para dimensionar um grupo de imagens em um quadro de tamanho único, ou seja, qualquer imagem q abrir deverá caber neste quadro, tem como fazer isso? Grato, Ilano. Compartilhar este post Link para o post Compartilhar em outros sites
N3G4T1V3 0 Denunciar post Postado Maio 10, 2007 Veja se essa função te ajuda:public static Bitmap ScaleBitmap(Bitmap inputBmp, double xScaleFactor, double yScaleFactor) { //Create a new bitmap object based on the input Bitmap newBmp = new Bitmap( (int)(inputBmp.Size.Width * xScaleFactor), (int)(inputBmp.Size.Height * yScaleFactor), PixelFormat.Format24bppRgb);//Graphics.FromImage doesn't like Indexed pixel format //Create a graphics object attached to the new bitmap Graphics newBmpGraphics = Graphics.FromImage(newBmp); //Set the interpolation mode to high quality bicubic //interpolation, to maximize the quality of the scaled image newBmpGraphics.InterpolationMode = InterpolationMode.HighQualityBicubic; newBmpGraphics.ScaleTransform((float)xScaleFactor, (float)yScaleFactor); //Draw the bitmap in the graphics object, which will apply //the scale transform //Note that pixel units must be specified to ensure the framework doesn't attempt //to compensate for varying horizontal resolutions in images by resizing; in this case, //that's the opposite of what we want. Rectangle drawRect = new Rectangle(0, 0, inputBmp.Size.Width, inputBmp.Size.Height); newBmpGraphics.DrawImage(inputBmp, drawRect, drawRect, GraphicsUnit.Pixel); //Return the bitmap, as the operations on the graphics object //are applied to the bitmap newBmpGraphics.Dispose(); //newBmp will have a RawFormat of MemoryBmp because it was created //from scratch instead of being based on inputBmp. Since it it inconvenient //for the returned version of a bitmap to be of a different format, now convert //the scaled bitmap to the format of the source bitmap return ConvertBitmap(newBmp, inputBmp.RawFormat); } Compartilhar este post Link para o post Compartilhar em outros sites
eriva_br 7 Denunciar post Postado Maio 11, 2007 talvez ajude: http://msdn2.microsoft.com/en-us/library/k...d4e(vs.80).aspx http://www.codeproject.com/csharp/imageresize.asp http://www.glennjones.net/Post/799/Highqua...ageswithnet.htm http://www.dotnet247.com/247reference/msgs/57/289835.aspx Compartilhar este post Link para o post Compartilhar em outros sites