When my program reads a JPG file, draws some text on the picturebox, and saves the file, the saved file is not readable by MS Photo Editor. It IS readable by MS Explorer, MS Word, & PhotoImpact. When I copied the saved files to a USB thumbdrive and tried to print the pics at CVS, they were not readable.
Here is how I process each file (PB is a picbox inside a Panel):
READ:
Dim PicIN As Image = Image.FromFile(txtFolderIN.Text & txtPicNameIN.Text)
PB.Image = PicIN
DRAW:
Dim bmap As Bitmap
bmap = New Bitmap(PB.Image)
Dim g As Graphics
g = Graphics.FromImage(bmap)
Fontsize = txtFontsize.Text
g.DrawString(txtRootName.Text, New Font("Arial", Fontsize, FontStyle.Bold), Brushes.Yellow, _
txtXdraw.Text, txtYdraw.Text)
g.DrawString(txtDateTime.Text, New Font("Arial", Fontsize, FontStyle.Bold), Brushes.Yellow, _
txtXdraw.Text, txtYdraw.Text + CInt(CSng(Fontsize) * 1.5))
PB.Image = bmap
g.Dispose()
SAVE:
PB.Image.Save(FolderOUT & PicNameOUT)
I have noticed that the "Date Pic Taken" in the JPG file header is missing after I save the new file - perhaps something else is being trashed.
When I read the new file with PhotoImpact and save it, then it IS readable by MS Photo Editor. But I have over 400 pics from a trip to Norway, and I grow faint if I think about doing that to all 400.
Any guesses about what is causing the problem?
Or other suggestions?
Here is how I process each file (PB is a picbox inside a Panel):
READ:
Dim PicIN As Image = Image.FromFile(txtFolderIN.Text & txtPicNameIN.Text)
PB.Image = PicIN
DRAW:
Dim bmap As Bitmap
bmap = New Bitmap(PB.Image)
Dim g As Graphics
g = Graphics.FromImage(bmap)
Fontsize = txtFontsize.Text
g.DrawString(txtRootName.Text, New Font("Arial", Fontsize, FontStyle.Bold), Brushes.Yellow, _
txtXdraw.Text, txtYdraw.Text)
g.DrawString(txtDateTime.Text, New Font("Arial", Fontsize, FontStyle.Bold), Brushes.Yellow, _
txtXdraw.Text, txtYdraw.Text + CInt(CSng(Fontsize) * 1.5))
PB.Image = bmap
g.Dispose()
SAVE:
PB.Image.Save(FolderOUT & PicNameOUT)
I have noticed that the "Date Pic Taken" in the JPG file header is missing after I save the new file - perhaps something else is being trashed.
When I read the new file with PhotoImpact and save it, then it IS readable by MS Photo Editor. But I have over 400 pics from a trip to Norway, and I grow faint if I think about doing that to all 400.
Any guesses about what is causing the problem?
Or other suggestions?