Thanks to Pygame, there’s a quick and easy method to get the dimensions of an image. You just have to load it into a Surface and use the Surface methods get_height() and get_width().
import pygame img = pygame.image.load("filename.png") print "Width = " + `img.get_width()` print "Height = " + `img.get_height()`
Be First to Comment