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

Recommended Answers

All 7 Replies

Assume you crop 5 pixel
so use

CropBitmap(BPM,5,5,BMP.width-10,BMP.height-10)

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) ?

actually X =left here and Y =top.

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

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.