Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3601186
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T20:35:24+00:00 2026-05-18T20:35:24+00:00

How to convert bmp to jpg in vb6 ?

  • 0

How to convert bmp to jpg in vb6 ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T20:35:24+00:00Added an answer on May 18, 2026 at 8:35 pm

    check this link

        'Convert BMP to JPG with this code. (Note: Requires vic32.dll available from
    'http://www.catenary.com/)
    
    'PLACE ALL THIS IN A NEW MODULE
    
    Declare Function bmpinfo Lib "VIC32.DLL" (ByVal Fname As String, bdat As BITMAPINFOHEADER) As Long
    Declare Function allocimage Lib "VIC32.DLL" (image As imgdes, ByVal wid As Long, ByVal leng As Long, ByVal BPPixel As Long) As Long
    Declare Function loadbmp Lib "VIC32.DLL" (ByVal Fname As String, desimg As imgdes) As Long
    Declare Sub freeimage Lib "VIC32.DLL" (image As imgdes)
    Declare Function convert1bitto8bit Lib "VIC32.DLL" (srcimg As imgdes, desimg As imgdes) As Long
    Declare Sub copyimgdes Lib "VIC32.DLL" (srcimg As imgdes, desimg As imgdes)
    Declare Function savejpg Lib "VIC32.DLL" (ByVal Fname As String, srcimg As imgdes, ByVal quality As Long) As Long
    
    
    
    ' Image descriptor
    Type imgdes
      ibuff As Long
      stx As Long
      sty As Long
      endx As Long
      endy As Long
      buffwidth As Long
      palette As Long
      colors As Long
      imgtype As Long
      bmh As Long
      hBitmap As Long
    End Type
    
    Type BITMAPINFOHEADER
       biSize As Long
       biWidth As Long
       biHeight As Long
       biPlanes As Integer
       biBitCount As Integer
       biCompression As Long
       biSizeImage As Long
       biXPelsPerMeter As Long
       biYPelsPerMeter As Long
       biClrUsed As Long
       biClrImportant As Long
    End Type
    
    'PLACE THIS IN YOUR FORM DECLERATIONS
    
    Private Sub ConvertToJPEG(bmp_fname As String, jpg_fname As String, Optional quality As Long)
      Dim tmpimage As imgdes    ' Image descriptors
      Dim tmp2image As imgdes
      Dim rcode As Long
      'Dim quality As Long
      Dim vbitcount As Long
      Dim bdat As BITMAPINFOHEADER ' Reserve space for BMP struct
      'Dim bmp_fname As String
      'Dim jpg_fname As String
    
      'bmp_fname = "test.bmp"
      'jpg_fname = "test.jpg"
    
      If quality = 0 Then quality = 75
    
       ' Get info on the file we're to load
      rcode = bmpinfo(bmp_fname, bdat)
      If (rcode <> NO_ERROR) Then
         msgbox "error: Unable to get file info"
         Exit Sub
      End If
    
      vbitcount = bdat.biBitCount
      If (vbitcount >= 16) Then  ' 16-, 24-, or 32-bit image is loaded into 24-bit buffer
         vbitcount = 24
      End If
    
       ' Allocate space for an image
      rcode = allocimage(tmpimage, bdat.biWidth, bdat.biHeight, vbitcount)
      If (rcode <> NO_ERROR) Then
        msgbox "error: Not enough memory"
        Exit Sub
      End If
    
       ' Load image
      rcode = loadbmp(bmp_fname, tmpimage)
      If (rcode <> NO_ERROR) Then
         freeimage tmpimage ' Free image on error
         msgbox "error: Cannot load file"
         Exit Sub
      End If
    
      If (vbitcount = 1) Then ' If we loaded a 1-bit image, convert to 8-bit grayscale
          ' because jpeg only supports 8-bit grayscale or 24-bit color images
        rcode = allocimage(tmp2image, bdat.biWidth, bdat.biHeight, 8)
        If (rcode = NO_ERROR) Then
            rcode = convert1bitto8bit(tmpimage, tmp2image)
            freeimage tmpimage  ' Replace 1-bit image with grayscale image
            copyimgdes tmp2image, tmpimage
        End If
      End If
    
      ' Save image
      rcode = savejpg(jpg_fname, tmpimage, quality)
      freeimage tmpimage
      Kill bmp_fname
      msgbox "picture saved: " & jpg_fname
    
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any way to convert a bmp image to jpg/png without losing the
I have images of various formats (.png, .jpg, .bmp, etc.) stored as compressed text
i was already able to convert a BMP image into binary memory stream but
I need to convert PNG file to BMP file on runtime. I can't do
Convert angle in degrees to a point How could I convert an angle (in
How do I convert function input parameters to the right type? I want to
I need to convert latitude/longitude coordinates into Easting/Northing coordinates in the Alberta 10 TM
How do I convert the value of a PHP variable to string? I was
How do I convert the RGB values of a pixel to a single monochrome
I need to convert a named instance of SQL server 2005, to a default

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.