LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
Search this Thread
Old 07-21-2004, 08:14 PM   #1
marlor
Member
 
Registered: May 2004
Distribution: Slackware C
Posts: 274

Rep: Reputation: 30
viewing images in console??


hi people,

the topic is basically my question

is there a prog to view jpg, gif ... in console?

thanks in advance
 
Old 07-21-2004, 10:12 PM   #2
Schrambo
Member
 
Registered: Mar 2004
Location: Western Australia
Distribution: Debian Slackware CentOS
Posts: 102

Rep: Reputation: 15
Pretty much no. But if you can open an image up in another program though the CLI if your in a desktop enviroment like this

$ <name of program> image.jpg
example
$ kuickshow Screenshot.png

thats about it, sorry man.
 
Old 07-22-2004, 12:11 AM   #3
bobtmasse
LQ Newbie
 
Registered: May 2003
Location: In front of the monitor
Posts: 16

Rep: Reputation: 0
Try seejpeg. Works on more than JPEGs too:

gif, ppm, bmp, tga.
 
Old 07-22-2004, 12:45 AM   #4
tank728
Member
 
Registered: Sep 2003
Posts: 142

Rep: Reputation: 16
I think mplayer might be able to display images in console.

-tank
 
Old 07-22-2004, 08:53 AM   #5
keefaz
Senior Member
 
Registered: Mar 2004
Distribution: Slackware
Posts: 4,617

Rep: Reputation: 136Reputation: 136
Hello, I did program an image viewer utility in SDL as an exercice, it can display image in console (assuming framebuffer is set)
require :
SDL (provided by sdl official slackware package)
SDL_image (you can get it here : LinuxPackages

Save it as view_image.c
Compile it as :
gcc -o view_image view_image.c `sdl-config --libs` -lSDL_image
Code:
#include <SDL/SDL.h>
#include <SDL/SDL_image.h>
#include <stdio.h>
#include <stdlib.h>

static SDL_Surface *screen;

void usage( void )
{
	printf("Usage: view_image image_file\n");
	printf("Display an image. Press <ESC> to exit\n");
}

int main(int argc, char * argv[])
{
	SDL_Surface *image;
    SDL_Rect dest;
	SDL_Event event;
	Uint8 *keys;

	char image_path[255];
	int image_type;
	
	if(argc == 1) {
		usage();
		exit(1);
	}
	
	strcpy(image_path, argv[1]);

	if(SDL_Init(SDL_INIT_VIDEO) != 0) {
		printf("can't init SDL video: %s\n", SDL_GetError());
		return 1;
	}

	atexit(SDL_Quit);

	screen = SDL_SetVideoMode(0, 0, 0, SDL_SWSURFACE);
	
    image = IMG_Load( image_path );
    if ( image == NULL ) {
        fprintf(stderr, "Couldn't load %s: %s\n",
                        image_path, SDL_GetError());
        return 0;
    }
	
	screen = SDL_SetVideoMode(image->w, image->h, 0, SDL_SWSURFACE );

    dest.x = 0;
    dest.y = 0;
    dest.w = image->w;
    dest.h = image->h;
    SDL_BlitSurface(image, NULL, screen, &dest);

    SDL_UpdateRects(screen, 1, &dest);
	
	while ( SDL_WaitEvent(&event) >= 0 ) {
		keys = SDL_GetKeyState(NULL);
		if (event.type == SDL_QUIT || keys[SDLK_ESCAPE] == SDL_PRESSED  ) { 
			SDL_FreeSurface(image);
			exit(0); 
		}
	}
	return 0;
}
So to view an image in console, just type : ./view_image <image_name>

Last edited by keefaz; 07-22-2004 at 08:56 AM.
 
1 members found this post helpful.
Old 07-22-2004, 06:59 PM   #6
seaelf
Member
 
Registered: Apr 2004
Location: Virginia
Distribution: Slackware 10.1 & 12.0
Posts: 66

Rep: Reputation: 16
image viewer in console

Howdy... have you tried zgv?
good luck
Neil
 
  


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
viewing jpeg images in kde justwantin Slackware 5 11-15-2005 04:30 PM
Viewing images fom the console dxdad Linux - Software 1 09-29-2004 06:22 PM
Do you relaxe by viewing 1024x768 images? vbp6us General 7 03-29-2003 11:51 AM
viewing images on the command line darkangel Linux - General 3 02-14-2002 11:44 AM
HELP! Viewing .TIFF Images ascii2k Linux - General 0 03-26-2001 11:05 AM


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

Main Menu
Advertisement
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