Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

(2005) Saved Image not readable by MS Photo Editor

Status
Not open for further replies.

GPerk

Programmer
Jul 6, 2002
161
US
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?

 
By doing a binary dump of saved image, I found that it was being save in the .PNG format. That means 2 things are wrong:
1. My version of MS Photo Editor cannot read a PNG format image
2. The default PB.Image.Save format is PNG.

This was fixed by changing the last source line in my original post to:
PB.Image.Save(FolderOUT & PicNameOUT,_
Drawing.Imaging.ImageFormat.Jpeg)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top