Пример #1
0
        public static System.Drawing.Bitmap Update_Gray(this Bitmap bm, ushort[] myDepthFrame)
        {
            if (myDepthFrame != null && myDepthFrame.Length > 0)
            {
                byte[] pixels = ImageExtensions.ConvertUshortToByte(myDepthFrame);

                bm = bm.Update_Gray(pixels);

                return(bm);
            }
            else
            {
                return(null);
            }
        }
Пример #2
0
        public static void SaveImageJPG(this Bitmap bmp, string filepath, long quality)
        {
            // Encoder parameter for image quality
            EncoderParameter qualityParam = new EncoderParameter(System.Drawing.Imaging.Encoder.Quality, quality);

            // Jpeg image codec
            ImageCodecInfo jpegCodec = ImageExtensions.GetEncoderInfo("image/jpeg");

            if (jpegCodec == null)
            {
                return;
            }

            EncoderParameters encoderParams = new EncoderParameters(1);

            encoderParams.Param[0] = qualityParam;

            bmp.Save(filepath, jpegCodec, encoderParams);
        }