Ejemplo n.º 1
0
        private void button2_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Filter = "Tif files(*.tif)|*.tif|jpeg files(*.jpg)|*.jpg|Bitmap Files(*.bmp)|*.bmp|PNG Files(*.png)|*.png";
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                fileimagepath = ofd.FileName;
                photo ph = GetPhoto();
                pixel2            = (Color[, ])ph.pixel.Clone();
                pictureBox2.Image = ph.image;
                textBox11.Text    = ph.image.Width.ToString();
                textBox12.Text    = ph.image.Height.ToString();
                secwidth          = ph.image.Width;
                secheight         = ph.image.Height;
            }
        }
Ejemplo n.º 2
0
        private void button3_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Filter = "jpeg files(*.jpg)|*.jpg|Bitmap Files(*.bmp)|*.bmp|PNG Files(*.png)|*.png|Tif files(*.tif)|*.tif";
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                fileimagepath = ofd.FileName;
                photo  ph    = GetPhoto();
                Bitmap image = (Bitmap)ph.image.Clone();
                pixel             = (Color[, ])ph.pixel.Clone();
                pictureBox1.Image = image;
                textBox9.Text     = image.Width.ToString();
                textBox10.Text    = image.Height.ToString();
                coverheight       = image.Height;
                coverwidth        = image.Width;
            }
        }
Ejemplo n.º 3
0
        private photo GetPhoto()
        {
            Bitmap image = (Bitmap)Image.FromFile(fileimagepath);

            Color[,] pixel = new Color[image.Width, image.Height];
            for (int i = 0; i < image.Width; i++)
            {
                for (int j = 0; j < image.Height; j++)
                {
                    pixel[i, j] = image.GetPixel(i, j);
                }
            }
            photo result = new photo();

            result.image = (Bitmap)image.Clone();
            result.pixel = (Color[, ])pixel.Clone();
            return(result);
        }