private void setImage(Bitmap b) { ImagingTool tool = new ImagingTool(b); tool.ResizeImage(pictureBox.Size); pictureBox.Image = tool.OutputImage; }
public void LoadImage() { this.Cursor = Cursors.WaitCursor; try { disposeColourViewer(); mColourViewer = null; mInputImage = (Bitmap)Image.FromFile(mSettings.InputImagePath); if (mInputImage.Height > 1000 || mInputImage.Width > 1000) { // too big. resize to be smaller. float maxDim = Math.Max(mInputImage.Width, mInputImage.Height); float scale = maxDim / 1000; Size newSize = new Size((int)((float)mInputImage.Width / scale), (int)((float)mInputImage.Height / scale)); ImagingTool tool = new ImagingTool(mInputImage); tool.ResizeImage(newSize, InterpolationMode.Default); mInputImage = tool.OutputImage; } mSettings.InputImageSize = mInputImage.Size; mSettings.FixSizeRatio = fixRatioCheck.Checked; mResizedImage = null; //mCroppedImage = null; mRecolouredImage = null; mPatternImage = null; } catch (ArgumentException e) { MessageBox.Show("Ooops! Bad Argument" + Environment.NewLine + "Filename = " + mSettings.InputImagePath + Environment.NewLine + e + Environment.NewLine + e.StackTrace); } finally { this.Cursor = Cursors.Default; } RedrawTab1Images(); RedrawTab2Images(); RedrawTab3Images(); }
public void LoadImage() { this.Cursor = Cursors.WaitCursor; try { disposeColourViewer(); mColourViewer = null; mInputImage = (Bitmap)Image.FromFile(mSettings.InputImagePath); if (mInputImage.Height > 1000 || mInputImage.Width > 1000) { // too big. resize to be smaller. float maxDim = Math.Max(mInputImage.Width, mInputImage.Height); float scale = maxDim / 1000; Size newSize = new Size((int)((float)mInputImage.Width / scale),(int)((float) mInputImage.Height / scale)); ImagingTool tool = new ImagingTool(mInputImage); tool.ResizeImage(newSize,InterpolationMode.Default); mInputImage = tool.OutputImage; } mSettings.InputImageSize = mInputImage.Size; mSettings.FixSizeRatio = fixRatioCheck.Checked; mResizedImage = null; //mCroppedImage = null; mRecolouredImage = null; mPatternImage = null; } catch (ArgumentException e) { MessageBox.Show("Ooops! Bad Argument" + Environment.NewLine + "Filename = " + mSettings.InputImagePath + Environment.NewLine + e + Environment.NewLine + e.StackTrace); } finally { this.Cursor = Cursors.Default; } RedrawTab1Images(); RedrawTab2Images(); RedrawTab3Images(); }