Re: [Tutor] how to display an image using python

2005-04-14 Thread Jay Loden
If you don't mind using an external program, you could use the 'display' 
command from ImageMagick. 

-Jay

On Thursday 14 April 2005 07:59 pm, Ertl, John wrote:
> All,
>
> I have asked this question before, but one more time most have commented
> about manipulation but displaying the image has become the big issue.  I
> want to display png and gif images on a Linux machine using python.  I am
> using PyNGL to make the images and PIL to manipulate them but I cannot load
> xv on the machines and PIL uses xv to display.  I have looked at
> PythonMagick but I could not even get past installing it.  It does not have
> a setup.py and uses boost.  I am hoping for a more straightforward Python
> way.
>
> Thanks,
>
> John Ertl
> ___
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


RE: [Tutor] how to display an image using python

2005-04-14 Thread Ertl, John
Danny,

Pygame.org...I would not have thought to look there.  In my google it did
not pop up.  I will definitely take a look and thanks for the example. 

John Ertl 

-Original Message-
From: Danny Yoo [mailto:[EMAIL PROTECTED]
Sent: Thursday, April 14, 2005 12:25
To: Ertl, John
Cc: Tutor
Subject: Re: [Tutor] how to display an image using python


> xv on the machines and PIL uses xv to display.  I have looked at
> PythonMagick but I could not even get past installing it.  It does not
have
> a setup.py and uses boost.  I am hoping for a more straightforward Python
> way.

Hi John,


You may want to try PyGame:

http://www.pygame.org/

Although it's mainly for game development, it provides a simple graphics
API that we can use to display images.  If you're running Linux, it's
likely that you have the Simple DirectMedia Layer (SDL) library installed.


I'm not too familiar with the API, but I was able to get some kind of
working example.  We can first construct an image surface:

http://www.pygame.org/docs/ref/pygame_image.html

by loading one from our file:

##
>>> import pygame.image
>>> picture = pygame.image.load("na-cat.gif")
>>>
>>> picture.get_size()
(256, 48)
##


At this point, 'picture' contains a "surface":

http://www.pygame.org/docs/ref/Surface.html

We can copy ('blit') this surface onto our main screen:


##
>>> import pygame.display
>>> pygame.display.set_mode(picture.get_size())

>>> main_surface = pygame.display.get_surface()
>>> main_surface.blit(picture, (0, 0))
>>> pygame.display.update()
##


I hope this helps!
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] how to display an image using python

2005-04-14 Thread Danny Yoo


> xv on the machines and PIL uses xv to display.  I have looked at
> PythonMagick but I could not even get past installing it.  It does not have
> a setup.py and uses boost.  I am hoping for a more straightforward Python
> way.

Hi John,


You may want to try PyGame:

http://www.pygame.org/

Although it's mainly for game development, it provides a simple graphics
API that we can use to display images.  If you're running Linux, it's
likely that you have the Simple DirectMedia Layer (SDL) library installed.


I'm not too familiar with the API, but I was able to get some kind of
working example.  We can first construct an image surface:

http://www.pygame.org/docs/ref/pygame_image.html

by loading one from our file:

##
>>> import pygame.image
>>> picture = pygame.image.load("na-cat.gif")
>>>
>>> picture.get_size()
(256, 48)
##


At this point, 'picture' contains a "surface":

http://www.pygame.org/docs/ref/Surface.html

We can copy ('blit') this surface onto our main screen:


##
>>> import pygame.display
>>> pygame.display.set_mode(picture.get_size())

>>> main_surface = pygame.display.get_surface()
>>> main_surface.blit(picture, (0, 0))
>>> pygame.display.update()
##


I hope this helps!

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] how to display an image using python

2005-04-14 Thread Ertl, John
All,

I have asked this question before, but one more time most have commented
about manipulation but displaying the image has become the big issue.  I
want to display png and gif images on a Linux machine using python.  I am
using PyNGL to make the images and PIL to manipulate them but I cannot load
xv on the machines and PIL uses xv to display.  I have looked at
PythonMagick but I could not even get past installing it.  It does not have
a setup.py and uses boost.  I am hoping for a more straightforward Python
way.  

Thanks,

John Ertl 
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor