can i display images in C?

This is a discussion on can i display images in C? within the C Programming forums, part of the General Programming Boards category; Is there any way i can display any image files (any extension) in C?? I heard that bitmap files can ...

  1. #1
    Registered User
    Join Date
    Feb 2009
    Posts
    4

    can i display images in C?

    Is there any way i can display any image files (any extension) in C??

    I heard that bitmap files can be displayed. Can anyone tell me how?

  2. #2
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Where do want them displayed and for what purpose? This is some specific system library stuff I think, so the method depends on the OS.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  3. #3
    Cogito Ergo Sum
    Join Date
    Mar 2007
    Location
    Sydney, Australia
    Posts
    463
    You can...only if you honour the cabbage
    =========================================
    Everytime you segfault, you murder some part of the world

  4. #4
    Registered User
    Join Date
    Oct 2008
    Posts
    110
    You can 'create' greyscale .pgm images using c, provided you already have a file for the image to be created to, in the same directory as the executable. I think you can do simialr things with coloured bitmaps, but not sure.
    PHI is one 'H' of alot more interesting than PI!

  5. #5
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,548
    Of course you can create / edit / whatever bitmaps. It's basically just mathematical formulas.
    Anyhow, you will probably want/need 3rd party libraries for that, seeing as it's complex.
    The OS will do the job of displaying it on the screen for you.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  6. #6
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by bertazoid View Post
    You can 'create' greyscale .pgm images using c, provided you already have a file for the image to be created to, in the same directory as the executable. I think you can do simialr things with coloured bitmaps, but not sure.
    You can create color bitmaps such as .xpm images using a text editor, and convert them to anything else using a system command. They are pure text files -- go look. So a simple C program to do the same thing would make it even easier.

    However, that's different issue than actually displaying them.
    Last edited by MK27; 02-20-2009 at 07:26 AM.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  7. #7
    Registered User
    Join Date
    Oct 2008
    Posts
    110
    Quote Originally Posted by MK27 View Post
    You can create color bitmaps such as .xpm images using a text editor, and convert them to anything else using a system command. They are pure text files -- go look. So a simple C program to do the same thing would make it even easier.
    I thought it was possible, but never actually tried it myself, seems an obvious enough extension of being able to read/write .pgm images though.

    OP: If you want to program a GUI in c, then you can use GTK toolkit, and there is probably ways of creating and displaying images within that, but I'm not sure exactly what you mean by displaying an image.
    PHI is one 'H' of alot more interesting than PI!

  8. #8
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by bertazoid View Post
    OP: If you want to program a GUI in c, then you can use GTK toolkit, and there is probably ways of creating and displaying images within that,
    Check. GTK's great, and it was actually first developed for "GIMP", which is an image manipulation program like photoshop.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. display character size...(quite urgent..)
    By karthi in forum C Programming
    Replies: 10
    Last Post: 07-11-2007, 09:42 PM
  2. new problem with class
    By jrb47 in forum C++ Programming
    Replies: 0
    Last Post: 12-01-2006, 07:39 AM
  3. Display Images?
    By mburt in forum C++ Programming
    Replies: 14
    Last Post: 08-24-2006, 10:23 AM
  4. Tab Controls - API
    By -KEN- in forum Windows Programming
    Replies: 7
    Last Post: 06-02-2002, 09:44 AM
  5. display pcx / bmp images
    By Unregistered in forum A Brief History of Cprogramming.com
    Replies: 9
    Last Post: 11-27-2001, 08:56 AM

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