using System.IO;
using System.Drawing.Drawing2D;
using System.Drawing;
using System.IO;
private Stream TrimeImage(Stream StreamOriginalImage,int DispMaxWidth, int DispMaxHeight)
{
Bitmap mg = new Bitmap(StreamOriginalImage);
Size newSize = new Size(Convert.ToInt32(DispMaxWidth), Convert.ToInt32(DispMaxHeight));
double ratio = 0d;
double myThumbWidth = 0d;
double myThumbHeight = 0d;
int x = 0;
int y = 0;
Bitmap bp;
if ((mg.Width / Convert.ToDouble(newSize.Width)) > (mg.Height /
Convert.ToDouble(newSize.Height)))
ratio = Convert.ToDouble(mg.Width) / Convert.ToDouble(newSize.Width);
else
ratio = Convert.ToDouble(mg.Height) / Convert.ToDouble(newSize.Height);
myThumbHeight = Math.Ceiling(mg.Height / ratio);
myThumbWidth = Math.Ceiling(mg.Width / ratio);
//Size thumbSize = new Size((int)myThumbWidth, (int)myThumbHeight);
Size thumbSize = new Size((int)newSize.Width, (int)newSize.Height);
bp = new Bitmap(newSize.Width, newSize.Height);
x = (newSize.Width - thumbSize.Width) / 2;
y = (newSize.Height - thumbSize.Height);
// Had to add System.Drawing class in front of Graphics ---
System.Drawing.Graphics g = Graphics.FromImage(bp);
g.SmoothingMode = SmoothingMode.HighQuality;
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
g.PixelOffsetMode = PixelOffsetMode.HighQuality;
Rectangle rect = new Rectangle(x, y, thumbSize.Width, thumbSize.Height);
g.DrawImage(mg, rect, 0, 0, mg.Width, mg.Height, GraphicsUnit.Pixel);
MemoryStream memoryStream = new MemoryStream();
if (bp != null)
{
bp.Save(memoryStream, System.Drawing.Imaging.ImageFormat.Jpeg);
}
return memoryStream;
}
1.ie properties trust site put url
2.site administrator-> site lib and list
3.select report data sourc->microsoft sql server analltical service
4.report builder model->Report model(name)->ok
5.doc lib->report builder report->chose any report