|
-
Mar 20th, 2002, 05:26 PM
#1
Thread Starter
Junior Member
Save image using Image Edit control
Hi,
I'm trying to save a picture using the image edit control that comes with VB6. I am using the SaveAs method to save the .jpg file under another name but I keep getting a 321 error Invalid File Format.
Here's my Code:
ImgEdit1.SaveAs "C:\My Documents\" & Text1.Text & ".jpg", wiFileTypeJPG
Any help is appreciated
THanks
ML
-
Mar 20th, 2002, 06:29 PM
#2
Addicted Member
Unless you learn huffman coding and write yourself a .jpeg algorithm your not going to be able to save it as anything else other than a .bmp!
Who needs rhetorical questions anyway?
Bazza NET - The place you want to be!

-
Mar 20th, 2002, 09:32 PM
#3
This works for me. With this control, I have always had better luck using the using numbers instead of any constants.
VB Code:
Option Explicit
Private Sub Command1_Click()
Dim strFile As String
strFile = "C:\My Documents\" & Text1.Text & ".jpg"
ImgEdit1.SaveAs strFile, 6, , 6, 1024
End Sub
-
Mar 21st, 2002, 09:12 AM
#4
Thread Starter
Junior Member
Thanks for the help but I am still getting the same error message:
Run Time error '321':
Invalid File Format
Unable to execute the SaveAs method
Here's my code for the Save button on my form:
Private Sub cmdSave_Click()
Dim strFile As String
If Text1.Text = "" Then
MsgBox "No File Name Entered", vbOKOnly
Else:
strFile = "C:\My Documents\" & Text1.Text & ".jpg"
ImgEdit1.SaveAs strFile, 6, , 6, 1024
End If
End Sub
These are .jpg pictures to begin with so I am not trying to save them in a different format, just trying to rename them. I can get it to work as long as I don't try to save it to the .jpg format.
-
Mar 21st, 2002, 03:27 PM
#5
I'm not sure what the difference is, but at home where I'm running Win2K and VB with SP5 it runs fine. At work I'm using a Win98 machine and VB with SP4 and it comes up with the same error as what you are getting.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|