2

为了减小我拥有的一些图像的大小,我想删除一些图像的白色填充。这个想法是,如果边界上有大的白色区域,那么可以裁剪这些区域以节省一些空间。

任何想法?

4

1 回答 1

3

我使用了裁剪边框

    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
于 2010-08-21T22:26:55.217 回答