resize

Automatically Resize Command Line Window

Automatically Resize Command Line Window on Windows Question: I’m writing a program in Python, the data I want it to show must be able to fit on the screen at the same time without needing to scroll around. The default command line size does not allow for this. Is there any way to automatically resize …

Total answers: 2

Python: Resize an existing array and fill with zeros

Python: Resize an existing array and fill with zeros Question: I think that my issue should be really simple, yet I can not find any help on the Internet whatsoever. I am very new to Python, so it is possible that I am missing something very obvious. I have an array, S, like this [x …

Total answers: 5

PIL: enlarge an image

PIL: enlarge an image Question: I’m having trouble getting PIL to enlarge an image. Large images get scaled down just fine, but small images won’t get bigger. # get the ratio of the change in height of this image using the # by dividing the height of the first image s = h / float(image.size[1]) …

Total answers: 2

Python Curses Handling Window (Terminal) Resize

Python Curses Handling Window (Terminal) Resize Question: This is two questions really: how do I resize a curses window, and how do I deal with a terminal resize in curses? Is it possible to know when a window has changed size? I really can’t find any good doc, not even covered on http://docs.python.org/library/curses.html Asked By: …

Total answers: 5

Resizing and stretching a NumPy array

Resizing and stretching a NumPy array Question: I am working in Python and I have a NumPy array like this: [1,5,9] [2,7,3] [8,4,6] How do I stretch it to something like the following? [1,1,5,5,9,9] [1,1,5,5,9,9] [2,2,7,7,3,3] [2,2,7,7,3,3] [8,8,4,4,6,6] [8,8,4,4,6,6] These are just some example arrays, I will actually be resizing several sizes of arrays, not …

Total answers: 3

Does Python PIL resize maintain the aspect ratio?

Does Python PIL resize maintain the aspect ratio? Question: Does PIL resize to the exact dimensions I give it no matter what? Or will it try to keep the aspect ratio if I give it something like the Image.ANTIALIAS argument? Asked By: frederix || Source Answers: How do I resize an image using PIL and …

Total answers: 10

PIL Image.resize() not resizing the picture

PIL Image.resize() not resizing the picture Question: I have some strange problem with PIL not resizing the image. from PIL import Image img = Image.open(‘foo.jpg’) width, height = img.size ratio = floor(height / width) newheight = ratio * 150 img.resize((150, newheight), Image.ANTIALIAS) img.save(‘mugshotv2.jpg’, format=’JPEG’) This code runs without any errors and produces me image named …

Total answers: 3