Esempio n. 1
0
        public static ZArrayDescriptor loadImage()
        {
            OpenFileDialog dialog1 = new OpenFileDialog();

            dialog1.Filter           = "All files (*.*)|*.*|bmp files (*.bmp)|*.bmp";
            dialog1.FilterIndex      = 1;
            dialog1.RestoreDirectory = true;


            if (dialog1.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    dialog1.InitialDirectory = dialog1.FileName;

                    Image            newImage = Image.FromFile(dialog1.FileName);
                    ZArrayDescriptor z_array  = new ZArrayDescriptor(newImage.Width, newImage.Height);
                    z_array = Util_array.getArrayFromImage(newImage);

                    return(z_array);
                }
                catch (Exception ex) { System.Windows.Forms.MessageBox.Show("class File_Helper Ошибка при чтении изображения" + ex.Message); return(null); }
            }
            return(null);
        }
Esempio n. 2
0
        public static ZArrayDescriptor loadImage_from_File(string str)
        {
            try
            {
                Image            newImage = Image.FromFile(str);
                ZArrayDescriptor z_array  = new ZArrayDescriptor(newImage.Width, newImage.Height);
                z_array = Util_array.getArrayFromImage(newImage);

                return(z_array);
            }
            catch (Exception ex) { System.Windows.Forms.MessageBox.Show("class File_Helper loadImage_from_File Ошибка при чтении изображения" + ex.Message); return(null); }
        }