Images

This is a discussion on Images within the C++ Programming forums, part of the General Programming Boards category; I am trying to figure out how to just show 2 basic images (I dont care what type of format ...

  1. #1
    Registered User
    Join Date
    Dec 2006
    Posts
    51

    Images

    I am trying to figure out how to just show 2 basic images (I dont care what type of format the picture is in) and I found this thing called a LoadImage() function but I have no idea how to use it and google wasn't being really helpful. So can someone help point me to a tutorial of some sort so I can figure out what to do

    Thanks for reading this
    -Shadowwoelf

  2. #2
    System.out.println("");
    Join Date
    Jan 2005
    Posts
    84
    I think this is what you are looking for. In particular lesson 13.

    http://www.functionx.com/win32/index.htm

  3. #3
    Hardware Engineer
    Join Date
    Sep 2001
    Posts
    1,398
    Shadowwoelf,

    FYI - A bitmap (pixel-map) is the simplest/easiest format to use. A bitmap file is just an array that contains 3 numbers (3 colors) for each pixel that make-up the image. (For a black & white image, you only need one gray-scale number for each "dot".)

    It's fairly easy to display a bitmap or to create simple graphics in a Windows GUI application... once you have a Windows Application. You might have to re-scale the image, depending on the size of the bitmap, the size of your window and your monitor resolution. But, that's easy too. However, it's not so easy to write a "simple" Windows program.

    If you want to display a compressed format such as JPEG, you need to decode it first (essentially, convert it to a bitmap). You can get libraries to do that, and I think Visual C++ comes with functions to decode the common formats. Or if you want a challange, you can write your own. If you want to write your own decoder, you can get information on various file formats at wotsit.org.

    All of this is platform specific. So for example, Loadimage() may not work on a Linux system. (There is no color, graphics, mouse, sound, or networking in ANSI/ISO Standard C++. All of these are platform specific.)
    Last edited by DougDbug; 12-22-2006 at 12:18 PM.

  4. #4
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,048
    You can use GCC's libpng etc to load images.

    I think, though, that if someone can't find information about LoadImage they might not be up to programming that kind of thing. You could use an external program. For Windows, you could always launch the default image viewer.
    Code:
    system("start image.bmp");
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Images
    By _Nate_ in forum C Programming
    Replies: 4
    Last Post: 05-18-2008, 10:50 PM
  2. Images
    By gvector1 in forum C++ Programming
    Replies: 7
    Last Post: 02-25-2003, 08:59 AM
  3. images, icons, and cursors, OH MY!
    By DarkViper in forum Windows Programming
    Replies: 3
    Last Post: 01-07-2003, 01:26 PM
  4. STL, Queues And Images
    By simly01 in forum C++ Programming
    Replies: 3
    Last Post: 06-24-2002, 12:31 PM
  5. A simple question on Images....
    By LonelyPlanetWa in forum C Programming
    Replies: 7
    Last Post: 05-20-2002, 07:34 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21