Resizing of PIL images

Discussion in 'Python' started by Tuvas, Dec 21, 2005.

  1. Tuvas

    Tuvas Guest

    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!
    Tuvas, Dec 21, 2005
    #1
    1. Advertising

  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!


    newsize = (width, height)

    im = im.resize(newsize)

    </F>
    Fredrik Lundh, Dec 21, 2005
    #2
    1. Advertising

  3. Tuvas

    Peter Hansen Guest

    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
    Peter Hansen, Dec 21, 2005
    #3
  4. 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>
    Fredrik Lundh, Dec 21, 2005
    #4
  5. Tuvas

    Peter Hansen Guest

    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...
    Peter Hansen, Dec 21, 2005
    #5
  6. Tuvas

    Tuvas Guest

    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.
    Tuvas, Dec 21, 2005
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ron Vecchi
    Replies:
    1
    Views:
    379
  2. KK
    Replies:
    0
    Views:
    368
  3. Sverre
    Replies:
    2
    Views:
    3,505
    Sverre
    Dec 17, 2009
  4. Pil (Trustworthy from Experience)

    Resizing a div by resizing its borders

    Pil (Trustworthy from Experience), Apr 18, 2009, in forum: Javascript
    Replies:
    9
    Views:
    329
    Proper
    Apr 21, 2009
  5. Proper
    Replies:
    0
    Views:
    184
    Proper
    Apr 18, 2009
Loading...

Share This Page