Skip to content
Snippets Groups Projects
Commit 2dea6af3 authored by Pavle Arezina's avatar Pavle Arezina
Browse files

Adding output file functionality closing #14

parent 88b72325
No related branches found
No related tags found
No related merge requests found
......@@ -28,20 +28,29 @@
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
this.folderBrowserDialog1 = new System.Windows.Forms.FolderBrowserDialog();
this.gifView = new System.Windows.Forms.PictureBox();
this.mainMenu1 = new System.Windows.Forms.MainMenu(this.components);
this.menuItem1 = new System.Windows.Forms.MenuItem();
this.menuItem2 = new System.Windows.Forms.MenuItem();
this.JPEG = new System.Windows.Forms.MenuItem();
this.PNG = new System.Windows.Forms.MenuItem();
this.BMP = new System.Windows.Forms.MenuItem();
this.TIFF = new System.Windows.Forms.MenuItem();
((System.ComponentModel.ISupportInitialize)(this.gifView)).BeginInit();
this.SuspendLayout();
//
// button1
//
this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.button1.Location = new System.Drawing.Point(12, 506);
this.button1.Location = new System.Drawing.Point(9, 411);
this.button1.Margin = new System.Windows.Forms.Padding(2);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(139, 35);
this.button1.Size = new System.Drawing.Size(104, 28);
this.button1.TabIndex = 0;
this.button1.Text = "Open GIF";
this.button1.UseVisualStyleBackColor = true;
......@@ -50,9 +59,10 @@
// button2
//
this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.button2.Location = new System.Drawing.Point(431, 506);
this.button2.Location = new System.Drawing.Point(323, 411);
this.button2.Margin = new System.Windows.Forms.Padding(2);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(139, 35);
this.button2.Size = new System.Drawing.Size(104, 28);
this.button2.TabIndex = 1;
this.button2.Text = "Save GIF";
this.button2.UseVisualStyleBackColor = true;
......@@ -64,20 +74,69 @@
//
// gifView
//
this.gifView.Location = new System.Drawing.Point(12, 12);
this.gifView.Location = new System.Drawing.Point(9, 10);
this.gifView.Margin = new System.Windows.Forms.Padding(2);
this.gifView.Name = "gifView";
this.gifView.Size = new System.Drawing.Size(558, 488);
this.gifView.Size = new System.Drawing.Size(418, 396);
this.gifView.TabIndex = 2;
this.gifView.TabStop = false;
//
// mainMenu1
//
this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem1});
//
// menuItem1
//
this.menuItem1.Index = 0;
this.menuItem1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem2});
this.menuItem1.Text = "File";
//
// menuItem2
//
this.menuItem2.Index = 0;
this.menuItem2.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.JPEG,
this.PNG,
this.BMP,
this.TIFF});
this.menuItem2.Text = "Output As Image";
//
// JPEG
//
this.JPEG.Index = 0;
this.JPEG.Text = "JPEG";
this.JPEG.Click += new System.EventHandler(this.menuItem3_Click);
//
// PNG
//
this.PNG.Index = 1;
this.PNG.Text = "PNG";
this.PNG.Click += new System.EventHandler(this.menuItem4_Click);
//
// BMP
//
this.BMP.Index = 2;
this.BMP.Text = "BMP";
this.BMP.Click += new System.EventHandler(this.menuItem5_Click);
//
// TIFF
//
this.TIFF.Index = 3;
this.TIFF.Text = "TIFF";
this.TIFF.Click += new System.EventHandler(this.menuItem6_Click);
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(582, 553);
this.ClientSize = new System.Drawing.Size(436, 449);
this.Controls.Add(this.gifView);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Margin = new System.Windows.Forms.Padding(2);
this.Menu = this.mainMenu1;
this.Name = "Form1";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Form1";
......@@ -94,6 +153,13 @@
private System.Windows.Forms.OpenFileDialog openFileDialog1;
private System.Windows.Forms.FolderBrowserDialog folderBrowserDialog1;
private System.Windows.Forms.PictureBox gifView;
private System.Windows.Forms.MainMenu mainMenu1;
private System.Windows.Forms.MenuItem menuItem1;
private System.Windows.Forms.MenuItem menuItem2;
private System.Windows.Forms.MenuItem JPEG;
private System.Windows.Forms.MenuItem PNG;
private System.Windows.Forms.MenuItem BMP;
private System.Windows.Forms.MenuItem TIFF;
}
}
......@@ -87,5 +87,129 @@ namespace Gifitti
}
}
private Boolean chkImage()
{
Boolean check = true;
try
{
int Length = globalGif.GetFrameCount(FrameDimension.Time);
}
catch (Exception e)
{
check = false;
MessageBox.Show("Must load a gif before getting output");
}
return (check);
}
private void menuItem3_Click(object sender, EventArgs e)
{
if(chkImage())
{
String x = "";
if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
{
x = folderBrowserDialog1.SelectedPath;
}
List<Image> IMGs = new List<Image>();
Image test;
int Length = globalGif.GetFrameCount(FrameDimension.Time);
if (x != "")
{
for (int i = 0; i < Length; i++)
{
globalGif.SelectActiveFrame(FrameDimension.Time, i);
test = globalGif;
String y = "\\tmpj-" + i + ".jpg";
String xy = x + y;
test.Save(@xy, ImageFormat.Jpeg);
}
}
}
}
private void menuItem4_Click(object sender, EventArgs e)
{
if (chkImage())
{
String x = "";
if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
{
x = folderBrowserDialog1.SelectedPath;
}
List<Image> IMGs = new List<Image>();
Image test;
int Length = globalGif.GetFrameCount(FrameDimension.Time);
if (x != "")
{
for (int i = 0; i < Length; i++)
{
globalGif.SelectActiveFrame(FrameDimension.Time, i);
test = globalGif;
String y = "\\tmpp-" + i + ".png";
String xy = x + y;
test.Save(@xy, ImageFormat.Png);
}
}
}
}
private void menuItem5_Click(object sender, EventArgs e)
{
if (chkImage())
{
String x = "";
if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
{
x = folderBrowserDialog1.SelectedPath;
}
List<Image> IMGs = new List<Image>();
Image test;
int Length = globalGif.GetFrameCount(FrameDimension.Time);
if (x != "")
{
for (int i = 0; i < Length; i++)
{
globalGif.SelectActiveFrame(FrameDimension.Time, i);
test = new Bitmap(globalGif);
String y = "\\tmpb-" + i + ".bmp";
String xy = x + y;
test.Save(@xy);
}
}
}
}
private void menuItem6_Click(object sender, EventArgs e)
{
if (chkImage())
{
String x = "";
if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
{
x = folderBrowserDialog1.SelectedPath;
}
List<Image> IMGs = new List<Image>();
Image test;
int Length = globalGif.GetFrameCount(FrameDimension.Time);
if (x != "")
{
for (int i = 0; i < Length; i++)
{
globalGif.SelectActiveFrame(FrameDimension.Time, i);
test = globalGif;
String y = "\\tmpt-" + i + ".tiff";
String xy = x + y;
test.Save(@xy, ImageFormat.Tiff);
}
}
}
}
}
}
......@@ -123,4 +123,7 @@
<metadata name="folderBrowserDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>184, 17</value>
</metadata>
<metadata name="mainMenu1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>353, 17</value>
</metadata>
</root>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment