Example #1
0
        public void DefaultRGB()
        {
            string fname = "f:\\Penguins.jpg";

            //fname = "f:\\4_大昭寺_IMG_GE.tif";
            UInt16[] rBuffer = null, gBuffer = null, bBuffer = null;
            int      width = 0, height = 0;

            ReadRasterFile(fname, out width, out height, out rBuffer, out gBuffer, out bBuffer);
            Console.WriteLine("Width:" + width.ToString() + ",Height:" + height.ToString());
            Stopwatch sw = new Stopwatch();

            sw.Start();
            using (IBitmapBuilder <UInt16> builder = BitmapBuilderFactory.CreateBitmapBuilderUInt16())
            {
                Bitmap bitmap = new Bitmap(width, height, PixelFormat.Format24bppRgb);
                //bitmap.Palette = _colorPalette;
                builder.Build(width, height, rBuffer, gBuffer, bBuffer, ref bitmap);
                //builder.Build(width, height, gBuffer, ref bitmap);
                bitmap.Save(fname + ".bmp", ImageFormat.Bmp);
                bitmap.Dispose();
            }
            sw.Stop();
            Console.WriteLine("Lost Time:" + sw.ElapsedMilliseconds.ToString());
            //MessageBox.Show(sw.ElapsedMilliseconds.ToString());
        }
Example #2
0
        public void StretchRGB()
        {
            string fname = "f:\\FY3A_Mersi_2010_06_24_10_00_1000M_L1B_PRJ_Whole.LDF";

            UInt16[] rBuffer = null, gBuffer = null, bBuffer = null;
            int      width = 0, height = 0;

            //BitmapToArray(fname, 3, 4, 2, out width, out height, out rBuffer, out gBuffer, out bBuffer);
            ReadRasterFile(fname, 6, 4, 3, out width, out height, out rBuffer, out gBuffer, out bBuffer);
            Console.WriteLine("Width:" + width.ToString() + ",Height:" + height.ToString());
            IRgbStretcher <UInt16> rgbs      = new LinearRgbStretcherUInt16(0, 1000, true);
            Func <UInt16, byte>    stretcher = (rgbs).Stretcher;

            using (IBitmapBuilder <UInt16> builder = BitmapBuilderFactory.CreateBitmapBuilderUInt16())
            {
                Bitmap bitmap = new Bitmap(width, height, PixelFormat.Format24bppRgb);
                //
                Stopwatch sw = new Stopwatch();
                sw.Start();
                //
                builder.Build(width, height, rBuffer, gBuffer, bBuffer, stretcher, stretcher, stretcher, ref bitmap);
                sw.Stop();
                Console.WriteLine("Lost Time:" + sw.ElapsedMilliseconds.ToString());
                MessageBox.Show(sw.ElapsedMilliseconds.ToString());
                bitmap.Save(fname + ".bmp", ImageFormat.Bmp);
                bitmap.Dispose();
            }
        }