locked
Saving Icons .ico RRS feed

  • Question

  • User1657576574 posted

    I have 2 jpg images, 1 is 16 x 16 and the other is 32 x 32.

    I would like to save both images into 1 .ico file e.g. the icon file contains 2 images of different sizes.

     

    Here is what I have come up with so far:

            Dim img16 As Drawing.Bitmap = Drawing.Image.FromFile(HttpContext.Current.Server.MapPath("~/files/16.jpg"))
            Dim img32 As Drawing.Bitmap = Drawing.Image.FromFile(HttpContext.Current.Server.MapPath("~/files/32.jpg"))
    
    
            Dim ico16 As Drawing.Icon = Drawing.Icon.FromHandle(img16.GetHicon)
            Dim ico32 As Drawing.Icon = Drawing.Icon.FromHandle(img32.GetHicon)
    
            Dim st As IO.Stream = New IO.FileStream(HttpContext.Current.Server.MapPath("~/files/test.ico"), IO.FileMode.Create)
    
            Dim wr As New IO.BinaryWriter(st)
    
            ico32.Save(st)
            wr.Flush()
    
            ico16.Save(st)
            wr.Flush()
    
            wr.Close()


    I wonder if someone could help me.

    Thank you

    Sunday, November 29, 2009 6:37 AM

Answers