Sign in to follow this  
H0bbes

Manipulating Image

Recommended Posts

I want to manipulate a image, i have a image *.jpg with 500x350 of dimenssions. I like to do with functions or routines that can make a new image with 100x100 and save into disk. I don´t want to use some programs(that i need to pay) that can be find at a search in google. If someone knows tutorials or something that can help me i will me greatfull with you. Tank you to read my post.

Share this post


Link to post
Share on other sites
Im not sure about tutorials, but it shouldn't be hard to write yourself, Just get a group of pixels in large pic to represent a single pixel in smaller pic. Take an average of the groups colour values and use that value for the pixel in the small pic.

Thats how Id go about it anyway.

Share this post


Link to post
Share on other sites

from PIL import Image
import os

filename = "my_image.bmp"
image = Image.open(filename)
image.thumbnail((100, 100), Image.ANTIALIAS)
newName = "tn" + os.path.splitext(filename)[0] + ".jpg"
image.save(newName)
image.close()

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this