mrteach
Posts: 181
Joined: Sun May 26, 2013 6:49 am

pygame transforming images

Sun Aug 31, 2014 1:29 am

alright so I was wondering is it possible to transform an image to fit the screen, with correct ratios

currently I'm just stretching the image

img = pygame.transform.scale(img,(transform_x,transform_y))

my screen size is 1024x768

Sleep Mode zZ
Posts: 319
Joined: Sun Aug 19, 2012 5:56 am
Location: Finland

Re: pygame transforming images

Sun Aug 31, 2014 1:54 am

Of course. You have the dimensions of the image and you have the dimensions of the screen. The rest should be very simple math.

mrteach
Posts: 181
Joined: Sun May 26, 2013 6:49 am

Re: pygame transforming images

Sun Aug 31, 2014 2:41 am

Sleep Mode zZ wrote:Of course. You have the dimensions of the image and you have the dimensions of the screen. The rest should be very simple math.
i see no easy one command method i guess =(

I just want to throw in a variety of images into a directory and show them fullscreen =/

let see how my algebra is...

mrteach
Posts: 181
Joined: Sun May 26, 2013 6:49 am

Re: pygame transforming images

Sun Aug 31, 2014 3:06 am

easier then expected lol

Return to “Python”