I have a problem in saving grayscale picture from picture box i have this code for grayscale
And this is for my save
when i save the picture it seems that the grayscale doesnt apply. And also when i move to other forms and return to the form where the picturebox is located the grayscale picture return to its original picture
Code:
Private Sub CMDGRAY_Click() Dim Color As Long Dim NewColor As Long Picture2.Picture = LoadPicture(CommonDialog1.FileName) Picture2.ScaleMode = vbPixels X = Picture2.ScaleWidth Y = Picture2.ScaleHeight For i = 0 To Y - 1 For j = 0 To X - 1 Color = (Picture2.Point(j, i) / (vbWhite / 255)) NewColor = Color * (vbWhite / 255) Picture2.PSet (j, i), NewColor Next Next Picture2.ScaleMode = vbPixels End Sub
Code:
Private Sub mnuSave_Click() CommonDialog1.Filter = "Jpeg Files(*.jpg)|*.jpg" CommonDialog1.ShowSave If CommonDialog1.FileName <> Empty Then SavePicture Picture2.Picture, CommonDialog1.FileName End If End Sub
Comment