随笔分类 - c# Image
摘要:public static Bitmap ChangeOpacity(Image img, float opacityvalue) { Bitmap bmp = new Bitmap(img.Width,img.Height); // Determining Width and Height of Source Image Graphics graphics = Graphics.FromImage(bmp); ColorMatrix colormatrix = new ColorMatrix(); ...
阅读全文
摘要:public static byte[] Bitmap2Byte(Bitmap bitmap) { using (MemoryStream stream = new MemoryStream()) { bitmap.Save(stream , ImageFormat.Jpeg); byte[] data = new byte[stream.Length]; stream.Seek(0 , SeekOrigin.Begin); ...
阅读全文
摘要:public static void ChangeColour(this Bitmap bmp, byte inColourR, byte inColourG, byte inColourB, byte outColourR, byte outColourG, byte outColourB) { // Specify a pixel format. PixelFormat pxf = PixelFormat.Format24bppRgb; // Lock the bitmap's bits. ...
阅读全文
摘要:Invoke(new EventHandler(delegate { Bitmap bitmap2 = (Bitmap)eventArgs.Frame.Clone(); ThreadPool.QueueUserWorkItem(delegate { bitmap2.Save(@"G:\VCAP\" + last.T...
阅读全文
摘要:方法一:Rectangle bounds = Screen.GetBounds(Point.Empty); using (Bitmap bitmap = new Bitmap(bounds.Width, bounds.Height)) { using (Graphics g = Graphics.FromImage(bitmap)) { g.CopyFromScreen(Point.Empty, Point.Empty, bounds.Size); ...
阅读全文
摘要:http://www.cnblogs.com/softidea/p/3265576.html
阅读全文
摘要:public static unsafe byte[] ConvertTo8Byte(Bitmap img) { byte[] result = new byte[img.Width * img.Height]; int n = 0; BitmapData data = img.LockBits(new Rectangle(0, 0, img.Width, img.Height), ImageLockMode.ReadOnly, ...
阅读全文
摘要:Bitmap bit = new Bitmap(renderImage.Width, renderImage.Height); using (Graphics g = Graphics.FromImage(bit)) { g.DrawImage(pictureBox1.Image, new Rectangle(0, 0, renderImage.Width, renderImage.Height), new Rectangle(0, 0, renderImage.Width, renderImage.Height), ...
阅读全文
摘要:/// /// 通过FileStream 来打开文件,这样就可以实现不锁定Image文件,到时可以让多用户同时访问Image文件 /// /// /// public static Bitmap ReadImageFile(string path) { FileStream fs = File.OpenRead(path); //OpenRead int filelength = 0; filelength = (int)...
阅读全文
摘要:/// <summary> /// 将源图像灰度化,但是没有转化为8位灰度图像。 /// http://www.bobpowell.net/grayscale.htm /// </summary> /// <param name="original"> 源图像。 </param> /// <returns> 灰度RGB图像。 </returns> public static Bitmap MakeGrayScale(Bitmap original) { //create a...
阅读全文
摘要:#region 图片旋转函数 /// <summary> /// 以逆时针为方向对图像进行旋转 /// </summary> /// <param name="b">位图流</param> /// <param name="angle">旋转角度[0,360](前台给的)</param> /// <returns></returns> public static Bitmap Rotate(Bitmap b, int angle) { angle = angl
阅读全文
摘要:第一种方法: public static byte[] GetImagePixel(Bitmap img) { byte[] result = new byte[img.Width*img.Height*3]; int n = 0; for (int i = 0; i < img.Height; i++) { for (int j = 0; j < img.Width; j++) { result[...
阅读全文
摘要:Re: Source pixel format is not supported by the filter !by andrew.kirillov » Tue Mar 16, 2010 12:57 pmYou need to check 2 things:1) Check documentation to see which pixel formats are supported by particular image processing routine (8 bpp greyscale or 24 bpp RGB or 32 bpp, etc). It was told man
阅读全文
摘要:http://blog.csdn.net/gisfarmer/article/details/3764734
阅读全文
摘要:public static Bitmap GetThumbnail(Bitmap b, int destHeight, int destWidth) { System.Drawing.Image imgSource = b; System.Drawing.Imaging.ImageFormat thisFormat = imgSource.RawFormat; int sW = 0, sH = 0; // 按比例缩放 ...
阅读全文
摘要:public static System.Drawing.Image ByteArrayToImage(byte[] b) { ImageConverter imgconv = new ImageConverter(); System.Drawing.Image img = (System.Drawing.Image)imgconv.ConvertFrom(b); return img; } public static byte[] ImageToByteArray(System.Dra...
阅读全文
摘要:private void DSApictureBox_MouseDown(object sender, MouseEventArgs e) { if (drawLine) { start = new PointF(e.X,e.Y); start = LineAlgorithm.Control2Image(matrix,start); if (list1.Count == 0) { ...
阅读全文
摘要:Image image = Image.FromFile(item.FullName); Image bt = new Bitmap(image); listImages.Add(bt); image.Dispose();
阅读全文
摘要:public static Bitmap CropBitmap(Bitmap bitmap, int cropX, int cropY, int cropWidth, int cropHeight) { Rectangle rect = new Rectangle(cropX, cropY, cropWidth, cropHeight); Bitmap cropped = bitmap.Clone(rect, bitmap.PixelFormat); return cropped; } static void Main(string[] args) { string path = ...
阅读全文

浙公网安备 33010602011771号