⌘BABAKOV.NET Let's code!
100% [light] [ru]
~/tags/image $

#Image

6 posts

6 total

Rotating an Image by 90 Degrees in C#

Here I will provide a function to rotate an image by 90 degrees, but not to display a pictureBox at a certain angle, but rather to transform the image so that the input is one image and the output is an absolutely different, but identical to the first, image - rotated by 90 degrees.

127 views 0 comments 0 likes ./Read →

Cutting a rectangular area of an image in C#

From the archive... Recently, I had to make a simple image cropping tool, so that the user could manually select an area on the source image and cut it out. In principle, nothing complicated, the most difficult thing is probably drawing the selection rectangle when you click the mouse button and move it over the image - highlighting the necessary area.<br><br>First, the most important thing. On the image <b>pictureBox</b> immediately set the <b>SizeMode</b> property to <i>AutoSize</i>, without any <i>Zoom-ы</i> if you don't want to deal with scaling.<br><br>Next - we need to make it work so that scrolling works when selecting with the mouse. It just so happened that this is a painful place in .NET (it doesn't work on its own, and that's it).<br><br>To make it work, do this:

242 views 0 comments 0 likes ./Read →

How to Open Images in C#

From the archive - might come in handy... It seems there's nothing simpler than opening an image from disk in C#. But, there are some pitfalls! Here are two examples. The first method (incorrect): if (openFileDialog1.ShowDialog() == DialogResult.OK) {…

95 views 0 comments 0 likes ./Read →

Changing Image Size in C#

From the archive - might come in handy... Often when adding images to a project, you need to change the image size, and often you want to do it properly, with the image proportions preserved. Personally, I often need to insert images into a ListView and shrink them correctly (so they don't spread out in a square of the specified size). This is exactly where the procedure below will help. <br><br>Size change procedure:

103 views 0 comments 0 likes ./Read →