Exemple #1
0
 public ProcessImage(string bmpfilename)
 {
     FreeImageEngine.Message += new OutputMessageFunction(FreeImageEngine_Message);
     try
     {
         FreeImageBitmap fib  = new FreeImageBitmap(bmpfilename);
         FreeImagePlugin plug = PluginRepository.Plugin(fib.ImageFormat);
         ReplaceBitmap(fib);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 private void bLoadImage_Click(object sender, EventArgs e)
 {
     if (ofd.ShowDialog() == DialogResult.OK)
     {
         try
         {
             // Load the file using autodetection
             FreeImageBitmap fib = new FreeImageBitmap(ofd.FileName);
             // Rescale the image so that it fits the picturebox
             // Get the plugin that was used to load the bitmap
             FreeImagePlugin plug = PluginRepository.Plugin(fib.ImageFormat);
             lImageFormat.Text = String.Format("Image-format: {0}", plug.Format);
             // Replace the existing bitmap with the new one
             ReplaceBitmap(fib);
         }
         catch
         {
         }
     }
 }