Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. Visual Basic
  4. Icon not saving in correct format

Icon not saving in correct format

Scheduled Pinned Locked Moved Visual Basic
graphicshelpquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    MatrixCoder
    wrote on last edited by
    #1

    I am trying to save an image from a PictureBox to an icon file, but I'm having two problems. 1. When saving the image to an icon, (.ico and ImageFormat.Icon) it saves but it gets an "Unknown File Type" icon instead of it's own. But if I save it as a bitmap, (.ico and ImageFormat.Bmp) it saves and displays fine. Why is this? Shouldn't it be the other way around? 2. No matter which format I save the icon in, when trying to open it in a icon editor I get an error saying either: "Not An Icon File" or "Invalid Icon Header File". I have done plenty of research and every site I found says to save an icon the same way I am. Which is:

    Dim IconImg As Bitmap
    IconImg = ImgBox.Image
    IconImg.Save("C:\Image.ico", System.Drawing.Imaging.ImageFormat.Icon)

    What am I missing? Thanks for the help!


    Trinity: Neo... nobody has ever done this before. Neo: That's why it's going to work.

    S 1 Reply Last reply
    0
    • M MatrixCoder

      I am trying to save an image from a PictureBox to an icon file, but I'm having two problems. 1. When saving the image to an icon, (.ico and ImageFormat.Icon) it saves but it gets an "Unknown File Type" icon instead of it's own. But if I save it as a bitmap, (.ico and ImageFormat.Bmp) it saves and displays fine. Why is this? Shouldn't it be the other way around? 2. No matter which format I save the icon in, when trying to open it in a icon editor I get an error saying either: "Not An Icon File" or "Invalid Icon Header File". I have done plenty of research and every site I found says to save an icon the same way I am. Which is:

      Dim IconImg As Bitmap
      IconImg = ImgBox.Image
      IconImg.Save("C:\Image.ico", System.Drawing.Imaging.ImageFormat.Icon)

      What am I missing? Thanks for the help!


      Trinity: Neo... nobody has ever done this before. Neo: That's why it's going to work.

      S Offline
      S Offline
      Sonia Gupta
      wrote on last edited by
      #2

      Try This Link . Hope This will help u.]

      M 1 Reply Last reply
      0
      • S Sonia Gupta

        Try This Link . Hope This will help u.]

        M Offline
        M Offline
        MatrixCoder
        wrote on last edited by
        #3

        Thanks, but that involves drastically editing my code, and it saves the icons in 16-bit colors instead of 32-bit (and I can't figure out why). Is there another way? Thanks anyway!


        Trinity: Neo... nobody has ever done this before. Neo: That's why it's going to work.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups