Potongan kode untuk membuka gambar via menustrip
openFileDialog1.Filter = "jpg files (*.jpg)|*.jpg|All files (*.*)|*.*";
if (openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
image = (Bitmap) Bitmap.FromFile(openFileDialog1.FileName);
pictureBox1.Image = image;
}
Variabel image diatas adalah variabel global class
Bitmap image;
Kemudian tambahkan pada slider nya
try
{
label1.Text = trackBar1.Value.ToString();
// create filter
BrightnessCorrection filter = new BrightnessCorrection(trackBar1.Value);
// apply the filter
pictureBox1.Image = filter.Apply(image);
}
catch (Exception ept)
{
System.Diagnostics.Debug.Print(ept.ToString());
}
No comments:
Post a Comment