Hello guys!

I want a simple app to crop a bit of some images. The fact is that all the codes I've found were too complicated, and I didn't understood a single letter of it.

Can somebody help me with it? The codes I saw where using and start point and a end point, but I don't need it, since what I want to do will always start from the sides (crop from left to center, from right to center, from bottom to center, from top to center). Can somebody help me?

Edit: here is the code I was talking about:

Private Function CropBitmap(ByRef bmp As Bitmap, ByVal cropX As Integer, ByVal cropY As Integer, ByVal cropWidth As Integer, ByVal cropHeight As Integer) As Bitmap
Dim rect As New Rectangle(cropX, cropY, cropWidth, cropHeight)
Dim cropped As Bitmap = bmp.Clone(rect, bmp.PixelFormat)
Return cropped
End Function

Edited by RenanLazarotto: n/a

6 Years
Discussion Span
Last Post by RenanLazarotto

Assume you crop 5 pixel
so use


Here is use BMP.height, BMP.width and BMP for example....


So, if I want to remove from bottom, I use: CropBitmap(BPM,0,5,BMP.width,BMP.height) ?

And to remove from top, I should use: CropBitmap(BPM,0,-5,BMP.width,BMP.height) ?

Edited by RenanLazarotto: n/a


I know, but lets say that I want to remove from right to left.

SO my X would be something like: x = Image.Width - 5 And the same to bottom to top: y = Image.Height - 5


no if you want to crop from right to left then you need to subtract the value from width not X

So my X would be something like:
x = Image.Width - 5 
And the same to bottom to top:
y = Image.Height - 5

Like this? :D


Hey guys, is my last post corret?
I could simply test, I know, but I'm not home neither have access to Visual Studio :P

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.