PIL will be your answer. Here is an example ...
# load, resize and save image with Python Imaging Library (PIL) # optionally display images using Tkinter # PIL from: http://www.pythonware.com/products/pil/ # or # http://www.lfd.uci.edu/~gohlke/pythonlibs/ from PIL import Image # pick an image file you have .bmp .jpg .gif. .png # (if not in the working directory, give full path) file_in = 'Roses.jpg' pil_image = Image.open(file_in) # retrieve some information print("image.size = (%d, %d)" % pil_image.size) print("image.format = %s" % pil_image.format) # 'JPEG' # common modes are # "L" (luminance) for greyscale images, # "RGB" for true color images, # "CMYK" for pre-press images print("image.mode = %s" % pil_image.mode) # 'RGB' # change to a 200x100 size image using best downsize filter image200x100 = pil_image.resize((200, 100), Image.ANTIALIAS) # save the resized image as .jpg file to working directory # (you could save it as .bmp, .gif, .png too) file_out = 'Roses200x100.jpg' image200x100.save(file_out) print("File saved as %s" % file_out) # optional show image using Tkinter ... # for Python3 use tkinter import Tkinter as tk from PIL import ImageTk root = tk.Tk() root.title(file_in) # convert PIL image objects to Tkinter PhotoImage objects tk_image1 = ImageTk.PhotoImage(pil_image) tk_image2 = ImageTk.PhotoImage(image200x100) # display the images on labels label1 = tk.Label(root,image=tk_image1) label1.pack(padx=5, pady=5) label2 = tk.Label(root,image=tk_image2) label2.pack(padx=5, pady=5) root.mainloop()
Edited 5 Years Ago by vegaseat: code example
Thanks Vegaseat I've got it working now
I am developing a simple job card creator application with VB.net 2012, using Access 2010 as database.
The code I have generated to write data from a datagridview to the database table is successfully saving the data, but with an error "Parameter @name has no default value". The ...
write a C++ program which take inputs from the user/keyboard and calculate his ZAKAT.
get the input from user may include
-Amount invested in business
-Amount given to other business partners as loan
-Amount payable to others
I made a prime number finder, it finds the nearest prime that is above and below any integer (Does not work that well with giant numbers.)
Made this in cpp.sh
Why would I need the x=y+1-1;?
x=y; just doesnt seem to work
Why is this?
And I know my coding ...