////////////////////////////////////////////////////////////////////////////////////////////////////// // Extraer fichero GIM como PNG ////////////////////////////////////////////////////////////////////////////////////////////////////// private void saveToPNGToolStripMenuItem_Click(object sender, EventArgs e) { if (saveFileDialog.ShowDialog() == DialogResult.OK) { Bitmap gim = GIM.Decode(Files[listBox.SelectedIndex].buffer); gim.Save(saveFileDialog.FileName); } }
////////////////////////////////////////////////////////////////////////////////////////////////////// // Ver fichero GIM ////////////////////////////////////////////////////////////////////////////////////////////////////// private void viewToolStripMenuItem_Click(object sender, EventArgs e) { Bitmap preview = GIM.Decode(Files[listBox.SelectedIndex].buffer); pictureBox.Width = preview.Width; pictureBox.Height = preview.Height; pictureBox.Image = preview; pictureBox.BackgroundImage = null; }
////////////////////////////////////////////////////////////////////////////////////////////////////// // Convertir fichero GIM a PNG ////////////////////////////////////////////////////////////////////////////////////////////////////// private void buttonConvert_Click(object sender, EventArgs e) { if (openFileDialog.ShowDialog() == DialogResult.OK) { BinaryReader file = new BinaryReader(File.Open(openFileDialog.FileName, FileMode.Open)); if (file.ReadUInt32() != 0x2E47494D) // 4D 49 47 2E { MessageBox.Show("Incorrect header. Correct file?"); file.Close(); return; } file.Close(); string inf = openFileDialog.FileName; string outf = Path.ChangeExtension(openFileDialog.FileName, ".png"); Bitmap preview = GIM.Decode(inf); preview.Save(outf); pictureBox.Width = preview.Width; pictureBox.Height = preview.Height; pictureBox.Image = preview; pictureBox.BackgroundImage = null; } }