private void button_Export_Click(object sender, EventArgs e) { SaveFileDialog saveFileDialog = new SaveFileDialog(); saveFileDialog.Filter = "Supported files|*.png;*.bmp;*.jpeg;*.dds;*.pvr"; if (saveFileDialog.ShowDialog() == DialogResult.OK) { string extension = Path.GetExtension(saveFileDialog.FileName); Type fileType = FileHelper.GetFileTypeFromExtension(extension.Substring(1, extension.Length - 1).ToUpper()); BaseImage baseImage = (BaseImage)Activator.CreateInstance(fileType, new object[] { m_texture.Image }); baseImage.Write(saveFileDialog.FileName); } }