irst
design brightness tab like this layout
For load an image in tool see this
how to Open an image
code:
Write code on the trackbar_scroll event
Dim
value As Double
= TrackBarBrightness.Value * 0.01F
DomainUpDownBrightness.Text = value
This line set the
brightness value of image in domainUpDown control withrange -100 to 100.
And below we demine
single type array in 5 x 5 matrix
Dim
colorMatrixElements As
Single()() = { _
New
Single() {1, 0, 0, 0, 0}, _
New
Single() {0, 1, 0, 0, 0}, _
New
Single() {0, 0, 1, 0, 0}, _
New
Single() {0, 0, 0, 1, 0}, _
New
Single() {value, value, value, 0, 1}}
Define colormatrix
Dim
colorMatrix As New
Imaging.ColorMatrix(colorMatrixElements)
An
ImageAttributes object maintains color and grayscale settings for five
adjustment categories: default, bitmap, brush, pen, and text. For example, you
can specify a color-adjustment matrix for the default category, a different
color-adjustment matrix for the bitmap category, and still a different
color-adjustment matrix for the pen category.
Dim
imageAttributes As
New ImageAttributes()
imageAttributes.SetColorMatrix(colorMatrix,
ColorMatrixFlag.Default, ColorAdjustType.Bitmap)
Dim
_img As Image = Img 'PictureBox1.Image
Dim
_g As Graphics
Dim
bm_dest As New
Bitmap(CInt(_img.Width),
CInt(_img.Height))
_g = Graphics.FromImage(bm_dest)
_g.DrawImage(_img, New
Rectangle(0, 0, bm_dest.Width + 1, bm_dest.Height + 1), 0, 0, bm_dest.Width + 1,
bm_dest.Height + 1, GraphicsUnit.Pixel, imageAttributes)
PictureBox1.Image = bm_dest