Results 1 to 6 of 6

Thread: [RESOLVED] save picture as bitmap or jpeg

  1. #1

    Thread Starter
    Addicted Member Redangel's Avatar
    Join Date
    Oct 2005
    Location
    England
    Posts
    214

    Resolved [RESOLVED] save picture as bitmap or jpeg

    i am try to save a picturefile as a bitmap or a jpeg but cannot seem to figure out how to do this can any one help!!! i tryed this

    VB Code:
    1. Private Sub cmdSave_Click()
    2. 'Call for the common dialog control to show the save menue
    3. Dim myPic As String
    4.     cdbFile.ShowSave
    5.     myPic = frmDraw.Image
    6.     Open myPic For Output As #1.bmp
    7.         Print #1, myPic
    8.         Close #1
    9. End Sub

    thanks in advance RedAngel
    Last edited by Redangel; Nov 6th, 2005 at 09:17 AM. Reason: update code

  2. #2

  3. #3

    Thread Starter
    Addicted Member Redangel's Avatar
    Join Date
    Oct 2005
    Location
    England
    Posts
    214

    Re: save picture as bitmap or jpeg

    thanks rhino bull but i also want the user to be able to browse to where to save the bitmap hence the use of the (cdbFile.ShowSave)

  4. #4

    Thread Starter
    Addicted Member Redangel's Avatar
    Join Date
    Oct 2005
    Location
    England
    Posts
    214

    Re: save picture as bitmap or jpeg

    got it working with this

    Private Sub cmdSave_Click()
    'Call for the common dialog control to show the save menue
    cdbFile.ShowSave
    SavePicture frmDraw.Image, "Save Picture1.bmp"
    End Sub

  5. #5
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: save picture as bitmap or jpeg

    Here's what I would do:
    VB Code:
    1. Private Sub Command1_Click()
    2. Dim strFile$
    3.  
    4.     With CommonDialog1
    5.         .Flags = cdlOFNExplorer
    6.         .Filter = "Windows Bitmap (*.bmp;)|*.bmp;"
    7.         .ShowSave
    8.         strFile = .FileName
    9.         If Not strFile = "" Then
    10.             SavePicture Picture1.Picture, strFile
    11.         End If
    12.     End With
    13.  
    14. End Sub

  6. #6
    PowerPoster Keithuk's Avatar
    Join Date
    Jan 2004
    Location
    Staffordshire, England
    Posts
    2,236

    Re: [RESOLVED] save picture as bitmap or jpeg

    Set your CommonDialog.Filter to bmp or jpg then which ever Filter is selected use SavePicture or BmpToJpeg.dll.

    http://www.vbforums.com/showthread.php?t=292119&

    There's no need to register this dll just put it in your Windows\System folder.
    Keith

    I've been programming with VB for 25 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width