Thread: printing picture files

  1. #1
    Registered User
    Join Date
    Jul 2004
    Posts
    15

    Exclamation printing picture files

    how can i print a picture file (say a file created using paintbrush) to the screen in c/c++?

    is it possible?

  2. #2
    Compulsive Liar Robc's Avatar
    Join Date
    Jul 2004
    Posts
    149
    >is it possible?
    Yes. But you'd need either an API that works with the file type you intend to display, or you need the details of that file type (obtainable from www.wotsit.org) so that you can do it manually.

  3. #3
    Registered User
    Join Date
    Jul 2004
    Posts
    15
    what exactly is an API?
    please forgive my ignorance but i have only worked on turbo c++

  4. #4
    Compulsive Liar Robc's Avatar
    Join Date
    Jul 2004
    Posts
    149
    >what exactly is an API?
    Application Programming Interface. It's basically a library of functions and types that helps you to do something without having to do it all by hand.

    >please forgive my ignorance but i have only worked on turbo c++
    How convenient, Turbo C++ supports the BGI API. Read your documentation for how to use it.

  5. #5
    Registered User
    Join Date
    Jul 2004
    Posts
    15

    Smile

    thanks very much for the info.

  6. #6
    Its not rocket science vasanth's Avatar
    Join Date
    Jan 2002
    Posts
    1,683
    well if you just can get the putpixel function working from some API you can some what print the BMP on the screen..(even console screen)... but for JPEG or anything else you will require API's that deal with that specific format..

    The reason being that BMP is not compressed and you can pretty much directly read the RGB values where as in other file formats are compressed and you need appropriate algorithms to handle them... The chess game I had posted here long back made use of simple fread and putpixel to print the BMP on console window.. you can search for that.



    just forgot and my example above made use of the BGI graphics library in Turbo C so should be easy for u to follow..

  7. #7
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Placing information on the screen has nothing to do with reading a file format. They're two entirely different tasks. If you have them as one in the same function, I'd suggest a rewrite of your code.

    Quzah.
    Hope is the first step on the road to disappointment.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Reading .dat files from a folder in current directory...
    By porsche911nfs in forum C++ Programming
    Replies: 7
    Last Post: 04-04-2009, 09:52 PM
  2. Error opening files in a different dir
    By Ozzie in forum C++ Programming
    Replies: 3
    Last Post: 10-09-2008, 06:55 AM
  3. Working with muliple source files
    By Swarvy in forum C++ Programming
    Replies: 1
    Last Post: 10-02-2008, 08:36 AM
  4. Help on printing files
    By Unregistered in forum C++ Programming
    Replies: 5
    Last Post: 04-20-2002, 08:59 PM
  5. printing txt files
    By baphomet in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 03-10-2002, 09:53 PM