473,387 Members | 1,592 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Resizing of PIL images

I am seeking a way to resize a PIL image, even if the original is a
smaller dimention than the new size. Resizing seems to only make an
image smaller, and not larger. I have a 700x700 sized picture,
sometimes that will display an image larger and other times smaller. Is
there an easy way to do this, a command that I am missing from the
library? Thanks!

Dec 21 '05 #1
5 2572
"Tuvas" wrote:
I am seeking a way to resize a PIL image, even if the original is a
smaller dimention than the new size. Resizing seems to only make an
image smaller, and not larger. I have a 700x700 sized picture,
sometimes that will display an image larger and other times smaller. Is
there an easy way to do this, a command that I am missing from the
library? Thanks!


newsize = (width, height)

im = im.resize(newsize)

</F>

Dec 21 '05 #2
Tuvas wrote:
I am seeking a way to resize a PIL image, even if the original is a
smaller dimention than the new size. Resizing seems to only make an
image smaller, and not larger. I have a 700x700 sized picture,
sometimes that will display an image larger and other times smaller. Is
there an easy way to do this, a command that I am missing from the
library? Thanks!


See the docs on transform(). From the sounds of it, if resize() won't
stretch something (it's own docs don't make that clear), then
transform() with appropriate arguments will.

-Peter

Dec 21 '05 #3
Peter Hansen wrote:
See the docs on transform(). From the sounds of it, if resize() won't
stretch something (it's own docs don't make that clear)


"resize" resizes the image to the given size.

"thumbnail" (which is an in-place operation) doesn't; it creates an
image no larger than the given size.

</F>

Dec 21 '05 #4
Fredrik Lundh wrote:
Peter Hansen wrote:
See the docs on transform(). From the sounds of it, if resize() won't
stretch something (it's own docs don't make that clear)


"resize" resizes the image to the given size.

"thumbnail" (which is an in-place operation) doesn't; it creates an
image no larger than the given size.


Ah... probably thumbnail() was what the OP was using when he referred to
resizing...

Dec 21 '05 #5
I used thumbnail originally, and am using resize now. Perhaps it has to
do with the image type (That is based on strings), but the resize
function just didn't do it for me. No idea why... Oh well, probably
just a problem for me, but, I've found a way around it, for the time
being.

Dec 21 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: lawrence | last post by:
Can someone please tell me where I can get some open source code for resizing images? I know such code has been written a million times and I don't feel like doing it again from scratch.
4
by: Matthias Czapla | last post by:
Hi! I want to resize uploaded GIF images. Currently I do it like this: <?php // ... $img = imagecreatefromgif($path); $img_scaled = imagecreate($new_width, $new_height);...
2
by: Alex Hopson | last post by:
I'm using the code below to loop through some images and resize each image twice, once to create a thumbnail and once to create a small image. The page stops loading around the 38th image out of...
10
by: riki | last post by:
Hi, i have a big problem...i'm using one jscript for resizing of all of my pics in popUp...in main html i'm having many little pics and clicking on them they open in popUp and resize to larger...
9
by: Bryan R. Meyer | last post by:
Hello Everyone, The problem of browser resizing has become an issue for me. While redesigning my webpage, I set the left and right margins to be auto so that my content would be centered. ...
13
by: Jon Yeager | last post by:
I need to display a bunch of pictures that are all of various dimensions into a fixed dimension space, like MSN Messenger does with its user photos in the chat windows. Forcing image dimensions...
5
by: Jim | last post by:
I've heard that resizing images through PHP (either GD2 or ImageMagick) is a processor intensive exercise. I'm setting up a site where users will be uploading up to 10 images along with the details...
1
by: Ron Vecchi | last post by:
I am using asp.net to upload an image and then perform resizing on it and saving the different sizes to file. The resized images were coming up and being displayed in the bowser fine but the image...
6
by: tomasio | last post by:
Dear NG, years have passed and I am still more designer than programmer. I build a new version of my website which has a few nasty bugs, especially on my startpage: Resizing text brakes the...
10
by: mishrarajesh44 | last post by:
hii all, I am facing a problem currently.. i have a script for image uploading and resizing.. the image uploading takes place properly for every size images.. but, the resizing works for...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.