LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 09-15-2007, 01:02 AM   #1
susovan0010
LQ Newbie
 
Registered: Sep 2007
Posts: 12

Rep: Reputation: 0
How to display BMP image at stdout.....help plz


Hi,
1> I am using Red hat EL.4. I want to display any BMP image (using C) at stdout. I have already used fread(). fwrite() and able to copy a image but yet to print at stdout.
when I am using the function 'fwrite(&file_structure,sizeof(file_structure),1,s tdout)' its giving me the corresponding characters at stdout.

2> I also want to know, how to use the graphics mode under linux using C. Is there any header file and function like windows '#include<graphics.h>' and 'initgraph()'


please help me.....
 
Old 09-15-2007, 01:37 AM   #2
SciYro
Senior Member
 
Registered: Oct 2003
Location: hopefully not here
Distribution: Gentoo
Posts: 2,038

Rep: Reputation: 51
1) see as stdout is text, and its outputting characters, i say its working perfectly. What exactly where you trying to do, actually display the image?

2) Nope, well, there is the framebuffer, but really, there is little reason to use it, unless of course you need display graphics as a command line only program. You should look up graphical libraries. There are quite a few, the choice will mostly depend upon what type of graphics you are trying to display.

3) As a side note, if you where actually trying to display the image on the screen in question 1, then you need a graphical output to do that, not text based. A graphics library is the best way to go about it, as already mentioned.

http://wiki.linuxquestions.org/wiki/Graphics_libraries
 
Old 09-15-2007, 02:11 AM   #3
susovan0010
LQ Newbie
 
Registered: Sep 2007
Posts: 12

Original Poster
Rep: Reputation: 0
How to display BMP image at stdout.....help

Many many thanks for your help.....
 
Old 09-15-2007, 04:15 AM   #4
susovan0010
LQ Newbie
 
Registered: Sep 2007
Posts: 12

Original Poster
Rep: Reputation: 0
Thanks........

Quote:
Originally Posted by SciYro View Post
1) see as stdout is text, and its outputting characters, i say its working perfectly. What exactly where you trying to do, actually display the image?

2) Nope, well, there is the framebuffer, but really, there is little reason to use it, unless of course you need display graphics as a command line only program. You should look up graphical libraries. There are quite a few, the choice will mostly depend upon what type of graphics you are trying to display.

3) As a side note, if you where actually trying to display the image on the screen in question 1, then you need a graphical output to do that, not text based. A graphics library is the best way to go about it, as already mentioned.

http://wiki.linuxquestions.org/wiki/Graphics_libraries

Thanks for your help.
I have downloaded and install g2-0.72 and trying to run a small
program. When compiled with gcc giving me errors as bellow...

any help?????????

#include <g2.h>
#include <g2_PS.h>

main()
{
int id;
id = g2_open_PS("rect.ps", g2_A4, g2_PS_land);
g2_rectangle(id, 20, 20, 150, 150);
g2_close(id);
}

[root@localhost C Programs]# gcc test.c
/tmp/cc8u4Gof.o(.text+0x29): In function `main':
: undefined reference to `g2_open_PS'
/tmp/cc8u4Gof.o(.text+0x6a): In function `main':
: undefined reference to `g2_rectangle'
/tmp/cc8u4Gof.o(.text+0x78): In function `main':
: undefined reference to `g2_close'
collect2: ld returned 1 exit status
 
Old 09-15-2007, 07:17 AM   #5
AwesomeMachine
Senior Member
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian jessie/sid; OpenSuSE; Fedora
Posts: 1,593

Rep: Reputation: 162Reputation: 162
Install ImageMagick and type

display <filename>
 
Old 09-17-2007, 11:12 AM   #6
susovan0010
LQ Newbie
 
Registered: Sep 2007
Posts: 12

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by AwesomeMachine View Post
Install ImageMagick and type

display <filename>
Thanks......problem solved.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how can i display image over video verma.sunil786 Programming 1 06-21-2007 04:48 PM
saving webcam image to bmp Four Programming 0 12-13-2006 08:04 PM
redirecting stdout to /dev/null and stderr to stdout? Thinking Programming 1 05-18-2006 02:36 AM
if lilo bmp image missing ? abs Slackware 8 08-17-2004 03:40 PM
Image conversor bmp & png to jpeg Adony Linux - Software 2 06-19-2004 03:43 PM


All times are GMT -5. The time now is 04:02 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration