![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Professional Programmer
Join Date: Feb 2005
Posts: 434
Rep Power: 4
![]() |
What is the best way to double the size of an image and still have an acceptable quality?
I have a JPEG image format in mind.
__________________
I looked it up on the Intergnats! |
|
|
|
|
|
#2 |
|
Programming Guru
![]() ![]() |
In pygame you can do it like so:
import pygame
image = pygame.image.load("my_image.jpeg")
size = image.get_size()
image = pygame.transform.scale(image, (size[0]*2, size[1]*2))
pygame.image.save("my_new_image.bmp", image)The problem with that is it can only be saved in bitmap. I used PIL to do this, but don't feel like digging through old code to get it out. Sorry. If you search for the "Python Image Library Documentation", they already have example code for how to do it. By the way, I haven't tested the pygame code. But it'll be roughly that if not exactly. |
|
|
|
|
|
#3 |
|
Professional Programmer
Join Date: Feb 2005
Posts: 434
Rep Power: 4
![]() |
Sane,
that works! The arguments in save() have to be reversed.
__________________
I looked it up on the Intergnats! |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|