Search code examples
pythonimage-processingimage-editing

Is it possible to convert 4:3 pictures to 16:9 using Python (2.7)


I have been searching the net for a while, but to no avail! Is there an image editing library for python that will allow me to convert 4:3 pictures to 16:9?

Any information and/or links are much appreciated!

Thanks!


Solution

  • For naive resizing using one of a few various filter types, you can use Image.resize from the PIL:

    im.resize(size) => image

    im.resize(size, filter) => image

    Returns a resized copy of an image. The size argument gives the requested size in pixels, as a 2-tuple: (width, height).

    The filter argument can be one of NEAREST (use nearest neighbour), BILINEAR (linear interpolation in a 2x2 environment), BICUBIC (cubic spline interpolation in a 4x4 environment), or ANTIALIAS (a high-quality downsampling filter). If omitted, or if the image has mode "1" or "P", it is set to NEAREST.