views:

37

answers:

1

Hello world!

To reduce the size of some images I have, I'd like to remove the white paddings that some have. The idea would be that if one has large white areas on the borders, then those can be cropped to save some space.

Any idea?

Thank you,
CFP.

A: 

I got the cropping borders using

    Dim MinX As Integer = W : Dim MaxX As Integer = 0
    Dim MinY As Integer = H : Dim MaxY As Integer = 0

    Dim White As Integer = Color.White.ToArgb()
    For x As Integer = 0 To W - 1
        For y As Integer = 0 To H - 1
            If Not Output.GetPixel(x, y).ToArgb() = White Then
                MinX = Math.Min(MinX, x)
                MaxX = Math.Max(MaxX, x)
                MinY = Math.Min(MinY, y)
                MaxY = Math.Max(MaxY, y)
            End If
        Next
    Next
CFP