Results 1 to 36 of 36

Thread: [RESOLVED] Save bmp to gif

  1. #1

    Thread Starter
    PowerPoster Ellis Dee's Avatar
    Join Date
    Mar 2007
    Location
    New England
    Posts
    3,530

    Resolved [RESOLVED] Save bmp to gif

    Please help; I can't figure out how to convert a bmp to gif. This is for a personal use program that only I will ever run.

  2. #2
    New Member jirohjoy's Avatar
    Join Date
    Jul 2008
    Location
    La Union, Philippines
    Posts
    3

    Re: Save bmp to gif

    open the file in photoshop then click save as, then below the filename, u select the file type. select gif.

  3. #3
    Frenzied Member longwolf's Avatar
    Join Date
    Oct 2002
    Posts
    1,343

    Re: Save bmp to gif

    Quote Originally Posted by jirohjoy
    open the file in photoshop then click save as, then below the filename, u select the file type. select gif.
    ROFL

  4. #4
    Frenzied Member longwolf's Avatar
    Join Date
    Oct 2002
    Posts
    1,343

    Re: Save bmp to gif

    I have a module that will save it as a jpg, will that work for you?

  5. #5
    Frenzied Member longwolf's Avatar
    Join Date
    Oct 2002
    Posts
    1,343

    Re: Save bmp to gif

    I'm ready for bed so I'll post the jpg info now.

    You'll need to find/ download the DILib.dll
    Or I could email it to you.

    Here's the module that goes with it:

    modJpgDISave
    Code:
    Option Explicit
    'the mod requires DILIB.DLL, either in the folder with the app
    'or in the proper windows dir and registered
    
    'It takes a .bmp (the only image type VB can save) from a picture control
    'then converts/saves it as a .jpg
    
    
    Public Declare Function DIWriteJpg Lib "DILib.dll" Alias "#1" _
                                        (DestPath As String, _
                                         SrcPath As String, _
                                         ByVal Quality As Long, _
                                         Optional ByVal progressive As Long) As Long
    
    Public Const DI_SUCCESS = 0
    Public Const DI_ERR_CALL = 1
    Public Const DI_ERR_INFILE = 2
    Public Const DI_ERR_OUTFILE = 3
    
    Public g_sPicFile As String
    
    Public Function SaveAsJPG(ByRef objPicCntrl As Object, _
                              ByRef DestFilePath As String, _
                              Optional ByRef Quality As Long = 100) As String
    'Takes the image from any VB picture control with a Picture Property
    'and saves it to file
    'Returns and empty string if Successful
    'otherwise returns the error msg
        Dim sTempBmp As String
        Dim rtnVal As Long
        Dim sMsg As String
        
        If Quality > 100 Then
            Quality = 100
        ElseIf Quality < 1 Then
            Quality = 1
        End If
        
        sTempBmp = AddSep(App.Path) & "temp.bmp"
        SavePicture objPicCntrl.Picture, sTempBmp
        DoEvents
        rtnVal = DIWriteJpg(ByVal DestFilePath, ByVal sTempBmp, Quality) ', Abs(chkProg.Value))
        DoEvents
        SaveAsJPG = ErrMsg(rtnVal, DestFilePath, sTempBmp)
        Kill sTempBmp
    End Function
    
    Private Function ErrMsg(ByRef ErrNumber As Long, ByRef JpgPath As String, ByRef SourcePath As String) As String
    'converts the error number from the dll to a string
        Dim sMsg As String
        
        If ErrNumber <> DI_SUCCESS Then
            sMsg = "DIWriteJpg did not succeed" & vbCrLf
            Select Case ErrNumber
    '            Case DI_SUCCESS 'Success
    '                picJpg.Picture = LoadPicture(loadStr)
                Case DI_ERR_CALL 'An error occured
                    sMsg = sMsg & "Error Call (0x00000001)"
                Case DI_ERR_INFILE
                    sMsg = sMsg & "Error InFile (0x00000002): " & SourcePath
                Case DI_ERR_OUTFILE
                    sMsg = sMsg & "Error OutFile (0x00000003): " & JpgPath
            End Select
            ErrMsg = sMsg
        End If
    End Function
    
    Public Function AddSep(ByVal Path As String) As String
        If RIGHT(Path, 1) = "\" Then
            AddSep = Path
        Else
            AddSep = Path & "\"
        End If
    End Function

  6. #6

    Thread Starter
    PowerPoster Ellis Dee's Avatar
    Join Date
    Mar 2007
    Location
    New England
    Posts
    3,530

    Re: Save bmp to gif

    Jpegs are both too big and too lossy. I'm really looking for GIF.

    I found many solutions, all of which require vic32.dll. After downloading several different versions of vic32.dll, I can't get past the following error message:
    Attached Images Attached Images  

  7. #7

    Thread Starter
    PowerPoster Ellis Dee's Avatar
    Join Date
    Mar 2007
    Location
    New England
    Posts
    3,530

    Re: Save bmp to gif

    I don't need this to be a clean or professional solution, since as I said I'm the only one who will ever run it. If there were some way to open the file in paint and automate a Save As, that would be fine. Can you use Sendkeys to manipulate the file menu of paint?

    Or a shareware conversion utility with command line processing would be fine as well. Mostly I need the compression I'm getting from paint, since I'm attaching these images to a messageboard with a small attachment limit.

    Paint compresses the 9.4mb bitmaps down to 179k gifs.

  8. #8
    VB For Fun Edgemeal's Avatar
    Join Date
    Sep 2006
    Location
    WindowFromPoint
    Posts
    4,255

    Re: Save bmp to gif

    Ever try this one?

    EDIT: Re-Uploaded zip file (this one should be the original code).
    Attached Files Attached Files
    Last edited by Edgemeal; Nov 3rd, 2008 at 05:01 AM.

  9. #9
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: Save bmp to gif

    Quote Originally Posted by Ellis Dee
    Jpegs are both too big and too lossy. I'm really looking for GIF
    GIFs can be worse, depending on how many colors are in the BMP. GIFs have a max of 256 colors.

    MS Paint for example, uses a default 216 color palette. Using some advanced adaptive palette algorithms +/- dithering can make the GIF appear better. Converting BMP to GIF can be done manually since the compression algorithm is pretty much open source -- but the the palette will determine the overall quality.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  10. #10
    Cumbrian Milk's Avatar
    Join Date
    Jan 2007
    Location
    0xDEADBEEF
    Posts
    2,448

    Re: Save bmp to gif

    imagemagick might be a bit bulky for what you want but it will do the job, possibly better than many others, in theory it can be used in VB. As LaVolpe is saying the conversion from (presumably) 24 or 32 bit down to 8 bit is the key to the quality.

    Here's a couple of links that you could use to code your own converter (not including the conversion to 8bit)
    LZW Compression/Decompression Algorithm in VB

    Gif spec

    Alternatively you might want to consider converting to Ping, depending on the nature of the image Pings can compress to a similar size to Gifs without any data loss. (Photos convert badly)

  11. #11

    Thread Starter
    PowerPoster Ellis Dee's Avatar
    Join Date
    Mar 2007
    Location
    New England
    Posts
    3,530

    Re: Save bmp to gif

    Attached is a zip of one of the original bitmap images plus its gif counterpart after converting with paint so you guys can get a feel for what might work best.

    I run a crawler each day and post the results to the group forum, but it is tedious to have to open paint and convert the image manually each day. Edgemeal's suggestion looks promising. It's slow -- which I don't care about at all -- but it creates a gif of 185k compared to the 177k in the archive. (Converting the same bitmap.) That's probably close enough.

    Is there any way for a PNG or JPG to compress smaller while still leaving the text clearly legible? I'm open to any ideas; I'm not married to GIFs. Anything I can do to reduce the final image size would be highly desirable.
    Attached Files Attached Files

  12. #12
    VB For Fun Edgemeal's Avatar
    Join Date
    Sep 2006
    Location
    WindowFromPoint
    Posts
    4,255

    Re: Save bmp to gif

    Quote Originally Posted by Ellis Dee
    Attached is a zip of one of the original bitmap images plus its gif counterpart after converting with paint so you guys can get a feel for what might work best.

    I run a crawler each day and post the results to the group forum, but it is tedious to have to open paint and convert the image manually each day. Edgemeal's suggestion looks promising. It's slow -- which I don't care about at all -- but it creates a gif of 185k compared to the 177k in the archive. (Converting the same bitmap.) That's probably close enough.

    Is there any way for a PNG or JPG to compress smaller while still leaving the text clearly legible? I'm open to any ideas; I'm not married to GIFs. Anything I can do to reduce the final image size would be highly desirable.
    Using GDI+ I created a 177K GIF from that BMP, quality looks OK, guess you'll just have to try it.
    Attached Files Attached Files

  13. #13
    Frenzied Member longwolf's Avatar
    Join Date
    Oct 2002
    Posts
    1,343

    Re: Save bmp to gif

    Did some playing with it.
    The bmp only uses 7 colors so a gif is the way to go.
    Using PSP and reducing the colorDepth to 8, took the gif size down to 129 kb.

    The lowest setting I tried with the jpg code I posted was 20% quality.
    It was almost 4 times the size of the gif, and artifacting badly.
    Last edited by longwolf; Nov 4th, 2008 at 02:06 AM.

  14. #14
    Cumbrian Milk's Avatar
    Join Date
    Jan 2007
    Location
    0xDEADBEEF
    Posts
    2,448

    Re: Save bmp to gif

    Quote Originally Posted by Ellis Dee
    Is there any way for a PNG or JPG to compress smaller while still leaving the text clearly legible? I'm open to any ideas; I'm not married to GIFs. Anything I can do to reduce the final image size would be highly desirable.
    The nature or your image is not suited to jpeg compression which is best suited for photographs. Ping works well, down to 40k without any data loss (66k if not indexed).

    Edit: Hmm, it seems photobucket has messed with the file by reducing the dimensions making the file size larger(??) attached is the 40KB version.
    Attached Files Attached Files
    Last edited by Milk; Nov 4th, 2008 at 04:43 AM.

  15. #15

    Thread Starter
    PowerPoster Ellis Dee's Avatar
    Join Date
    Mar 2007
    Location
    New England
    Posts
    3,530

    Re: Save bmp to gif

    Quote Originally Posted by Milk
    The nature or your image is not suited to jpeg compression which is best suited for photographs. Ping works well, down to 40k without any data loss (66k if not indexed).
    That is phenomenal; an ideal format. I have no clue how to automate the conversion, though. Little help?

    EDIT: Actually, looks like Edgemeal's posted solution can convert to png. I'll see if I can get it to work.

  16. #16

    Thread Starter
    PowerPoster Ellis Dee's Avatar
    Join Date
    Mar 2007
    Location
    New England
    Posts
    3,530

    Re: Save bmp to gif

    Hmm, Edgemeal's solution -- which is fantastic, thanks! -- creates a 195k png. How did you make the 40k version?

    Edge, I'd rate you but it says I have to spread it around.

    EDIT: Milk, did you create that 40k png using ImageMagick? I was quickly overwhelmed when looking at that site. Are there instructions on how to download a simple exe version anywhere?
    Last edited by Ellis Dee; Nov 4th, 2008 at 09:32 AM.

  17. #17
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: Save bmp to gif

    Ellis Dee, will your app always run on XP or higher? Or will it always run on Win2K with GDI+ installed (not installed by default but is a free download for 2K). If not, converting to PNG requires a bunch more work.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  18. #18

    Thread Starter
    PowerPoster Ellis Dee's Avatar
    Join Date
    Mar 2007
    Location
    New England
    Posts
    3,530

    Re: Save bmp to gif

    Quote Originally Posted by LaVolpe
    Ellis Dee, will your app always run on XP or higher? Or will it always run on Win2K with GDI+ installed (not installed by default but is a free download for 2K). If not, converting to PNG requires a bunch more work.
    Yes, only XP or higher. (It will only ever be run by me on my personal machine, which is XP.)

  19. #19
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: Save bmp to gif

    Quote Originally Posted by Ellis Dee
    Hmm, Edgemeal's solution -- which is fantastic, thanks! -- creates a 195k png. How did you make the 40k version?

    Edge, I'd rate you but it says I have to spread it around.

    EDIT: Did you create that using ImageMagick? I was quickly overwhelmed when looking at that site. Are there instructions on how to download a simple exe version anywhere?
    PNG uses several different filtering mechanisms to try and compress images more and more. The app is probably testing all 5 filters and picking the best one.
    I can beat the 195k -- how about 66kb? But I didn't use an application, I used old fashioned parsing, bit shifting & compression via the official zLIB.dll.

    Edited: Found a miscalc in my routines, got it down to 51kb.
    Attached Files Attached Files
    Last edited by LaVolpe; Nov 4th, 2008 at 09:50 AM.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  20. #20

    Thread Starter
    PowerPoster Ellis Dee's Avatar
    Join Date
    Mar 2007
    Location
    New England
    Posts
    3,530

    Re: Save bmp to gif

    I do not know how to do that. Could you post the code you used?

  21. #21
    PowerPoster dilettante's Avatar
    Join Date
    Feb 2006
    Posts
    24,487

    Re: Save bmp to gif

    You can also do this simply using WIA if you have it installed:
    Code:
    Option Explicit
    '
    'Requires a reference to:
    '   Microsoft Windows Image Acquisition Library v2.0
    '
    
    Public Sub ImgConvert( _
        ByVal InFileName As String, _
        ByVal OutFileName As String, _
        ByVal OutFormat As String)
        
        Dim Img As WIA.ImageFile
        Dim ImgProc As WIA.ImageProcess
        
        Set Img = New WIA.ImageFile
        Img.LoadFile InFileName
        Set ImgProc = New WIA.ImageProcess
        With ImgProc.Filters
            .Add ImgProc.FilterInfos("Convert").FilterID
            .Item(1).Properties("FormatID").Value = OutFormat
        End With
        Set Img = ImgProc.Apply(Img)
        
        On Error Resume Next
        Kill OutFileName
        On Error GoTo 0
        Img.SaveFile OutFileName
    End Sub
    
    Private Sub Main()
        ImgConvert "Western City.bmp", "Western City.gif", wiaFormatGIF
        ImgConvert "Western City.bmp", "Western City.png", wiaFormatPNG
        MsgBox "Complete"
    End Sub
    It does not do any extensive optimization of compression (yielding the same 176K to 194K files as already described).

    The PNGOUT plugin for IrfanView (relying on KZIP deflation) can produce a PNG output at about 34.4KB. The stand alone command line PNGOUT utility might be useful from a VB6 program. PNGOUT Tutorial.

  22. #22
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: Save bmp to gif

    Quote Originally Posted by Ellis Dee
    I do not know how to do that. Could you post the code you used?
    Attached is probably more than what you are expecting. Just unzip it to a new folder and run the project. I created a special form, for you, when it starts up. Let me know what you think; the best part is that because it is raw source code, you can customize/automate to your heart's desire.

    Edited: attachments removed
    Last edited by LaVolpe; Nov 10th, 2008 at 12:27 PM.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  23. #23

    Thread Starter
    PowerPoster Ellis Dee's Avatar
    Join Date
    Mar 2007
    Location
    New England
    Posts
    3,530

    Re: Save bmp to gif

    Quote Originally Posted by Edgemeal
    Using GDI+ I created a 177K GIF from that BMP, quality looks OK, guess you'll just have to try it.
    Edgemeal, this is driving me crazy. Why doesn't my picturebox have a numeric .Picture property like yours does? What's the trick?

    I'd really like to use your technique because it's the only one that uses pure VB6 code; no references required. But no matter what I do, the following line always returns false:

    If GdipCreateBitmapFromHBITMAP(hBitmap, 0&, lBitmap) = 0 Then

    hBitmap is always 0 in my project, and always has a nice juicy number in yours. Even when I copied all your code over verbatim, and even copied the picturebox control from your project directly into mine. Still nada.

    Please help!
    Last edited by Ellis Dee; Nov 8th, 2008 at 11:04 AM.

  24. #24
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: Save bmp to gif

    Ellis Dee. Actually GDI+ is an external reference for systems less than XP. Win2k, NT4, and lower requires users to download the dll or get it from elsewhere (i.e., some other app installed it).

    Regarding the error, hBitmap should be the GDI bitmap (i.e., picturebox's image handle), lBitmap should be non-zero if all went fine -- that would be the GDI+ reference.

    One of my favorite reference sites for GDI+
    http://www.com.it-berater.org/gdiplus/GdiPlus.htm
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  25. #25

    Thread Starter
    PowerPoster Ellis Dee's Avatar
    Join Date
    Mar 2007
    Location
    New England
    Posts
    3,530

    Re: Save bmp to gif

    Quote Originally Posted by LaVolpe
    Regarding the error, hBitmap should be the GDI bitmap (i.e., picturebox's image handle), lBitmap should be non-zero if all went fine -- that would be the GDI+ reference.
    I copied all of his code verbatim, but the .Picture property of the picturebox gets passed as 0, which causes the call to fail.

    Why would his picturebox's .Picture property have a value in his project, but then return 0 when I copy & paste it into my project?

  26. #26

    Thread Starter
    PowerPoster Ellis Dee's Avatar
    Join Date
    Mar 2007
    Location
    New England
    Posts
    3,530

    Re: Save bmp to gif

    And LaVolpe, not sure what's going on with the project you attached, but I get a blizzard of popups.

    When opening the project, it first tells me an rtf file isn't found, which I ignore and continue to load anyway.

    Then when I run it, it tells me I need to extract a dll from a RES file, which I say yes to. Then it tells me it wrote the dll to the app.path and that I should try again.

    Lather, rinse, repeat. All it ever does is repeat these three messages, endlessly.

  27. #27
    Cumbrian Milk's Avatar
    Join Date
    Jan 2007
    Location
    0xDEADBEEF
    Posts
    2,448

    Re: Save bmp to gif

    Quote Originally Posted by Ellis Dee
    Why would his picturebox's .Picture property have a value in his project, but then return 0 when I copy & paste it into my project?
    This just means you have no Bitmap loaded into the picturebox in your project.

  28. #28
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: Save bmp to gif

    Quote Originally Posted by Ellis Dee
    And LaVolpe, not sure what's going on with the project you attached, but I get a blizzard of popups.

    When opening the project, it first tells me an rtf file isn't found, which I ignore and continue to load anyway.

    Then when I run it, it tells me I need to extract a dll from a RES file, which I say yes to. Then it tells me it wrote the dll to the app.path and that I should try again.

    Lather, rinse, repeat. All it ever does is repeat these three messages, endlessly.
    Ellis, sorry about that. The zLIB1.dll it wrote to your project folder obviously isn't in the system's DLL path. If you toss that DLL into your system path, all should be fine. I didn't include the RTF because it is rather large. If you decide you like the project, I can post the rtf too. Let me know.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  29. #29
    VB For Fun Edgemeal's Avatar
    Join Date
    Sep 2006
    Location
    WindowFromPoint
    Posts
    4,255

    Re: Save bmp to gif

    Quote Originally Posted by Ellis Dee
    Edgemeal, this is driving me crazy. Why doesn't my picturebox have a numeric .Picture property like yours does? What's the trick?
    No tricks, just a valid image handle should do, for example instead of a picbox you could use the StdPicture obj.
    Code:
        Dim StdPic As StdPicture
        Set StdPic = LoadPicture("FileName.BMP")
        SavePictureFromHDC StdPic.Handle, "FileName.PNG"
        Set StdPic = Nothing

  30. #30

    Thread Starter
    PowerPoster Ellis Dee's Avatar
    Join Date
    Mar 2007
    Location
    New England
    Posts
    3,530

    Re: Save bmp to gif

    Does an image file have to exist in order to have an image handle?

    I'm drawing the image on the picturebox using Line and Print methods. I never do a LoadPicture() call.

    Is that why I have no handle?

  31. #31
    VB For Fun Edgemeal's Avatar
    Join Date
    Sep 2006
    Location
    WindowFromPoint
    Posts
    4,255

    Re: Save bmp to gif

    Quote Originally Posted by Ellis Dee
    I'm drawing the image on the picturebox using Line and Print methods. I never do a LoadPicture() call.
    Try doing it like this,
    Picture1.AutoRedraw = True ' autodraw on
    Picture1.Line (40, 40)-(400, 400) ' Draw stuff
    Picture1.Picture = Picture1.Image ' copy image
    SavePictureFromHDC.... ' save it

  32. #32

    Thread Starter
    PowerPoster Ellis Dee's Avatar
    Join Date
    Mar 2007
    Location
    New England
    Posts
    3,530

    Re: Save bmp to gif

    I'll try that later this morning when I have a minute and let you know how it works.

    I really appreciate your help.

  33. #33
    PowerPoster ThEiMp's Avatar
    Join Date
    Dec 2007
    Location
    Take The PCI Bus Across To The CPU!!
    Posts
    3,948

    Re: Save bmp to gif

    Try using the CommonDialog control to Open, change the extension. And then Close it, using those commands. Also I am not quite sure on the command to change the filename, but it will either be in a batch file usage or in VB.
    I have a huge free products range, of computer software in which you can download using any kind of 64-Bit Web Browser. Also there is coming a Social Networking section that I am making on my Website...

    |Ambra Productions Inc. | The Black Sun Society | The Black Shield | Ambra College | Church of the Black Sun | Ambra Productions Inc's Homepage | Boomtick Venues: Ambar Nightclub, Jack Rabbit Slim's, Villa Nightclub and Lucy's Love Shack | Pasta Ambra | Fish Feast Company | Wallet Wizard | Ambrose Liquor | Ambar Tavern | Ambra University | Ambra Cheese |

    Do you wish to do unpaid work for me??? If so, the PM me on this Forum, and then we can get to work, programming for the future of computers go by the name of ThEiMp. This is my ghost writers name. Also my nickname, means that I am: The Imperial of the Technology Industry, so then to make it really short, I just then wrote: The Imp, which is where I get the nickname from...

  34. #34
    PowerPoster ThEiMp's Avatar
    Join Date
    Dec 2007
    Location
    Take The PCI Bus Across To The CPU!!
    Posts
    3,948

    Re: Save bmp to gif

    Also you shouldn't try to use image compression, becuase it will remove chunks of code away from the file itself and then continue use of file compression will screw with the file's image quality. Image compression, is the last process on any image that you make using an image processing package, like Paint Shop Pro or even Photo Shop.
    I have a huge free products range, of computer software in which you can download using any kind of 64-Bit Web Browser. Also there is coming a Social Networking section that I am making on my Website...

    |Ambra Productions Inc. | The Black Sun Society | The Black Shield | Ambra College | Church of the Black Sun | Ambra Productions Inc's Homepage | Boomtick Venues: Ambar Nightclub, Jack Rabbit Slim's, Villa Nightclub and Lucy's Love Shack | Pasta Ambra | Fish Feast Company | Wallet Wizard | Ambrose Liquor | Ambar Tavern | Ambra University | Ambra Cheese |

    Do you wish to do unpaid work for me??? If so, the PM me on this Forum, and then we can get to work, programming for the future of computers go by the name of ThEiMp. This is my ghost writers name. Also my nickname, means that I am: The Imperial of the Technology Industry, so then to make it really short, I just then wrote: The Imp, which is where I get the nickname from...

  35. #35
    VB For Fun Edgemeal's Avatar
    Join Date
    Sep 2006
    Location
    WindowFromPoint
    Posts
    4,255

    Re: Save bmp to gif

    Quote Originally Posted by Ellis Dee
    I'll try that later this morning when I have a minute and let you know how it works.

    I really appreciate your help.
    Or instead of using .Picture in the save command try using the .Image.
    ' AutoRedraw on
    ' Draw stuff
    SavePictureFromHDC(Picture1.Image,.... ' save it

  36. #36

    Thread Starter
    PowerPoster Ellis Dee's Avatar
    Join Date
    Mar 2007
    Location
    New England
    Posts
    3,530

    Re: Save bmp to gif

    Quote Originally Posted by Edgemeal
    Or instead of using .Picture in the save command try using the .Image.
    ' AutoRedraw on
    ' Draw stuff
    SavePictureFromHDC(Picture1.Image,.... ' save it
    Finally got around to trying your suggestions.

    This works flawlessly; you rock. Thanks!

    I'm marking this thread resolved, though I may post some followup questions as I get time to play with the PNG format. GIF will suffice in the meantime.

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