Seite 1 von 1
Bild größen
Verfasst: Sonntag 30. März 2014, 15:04
von FemeS
Hallo,
ich habe das Problem, dass ich nur kleine .gif Bilder im Interface angezeigt bekomme.
Wie kann ich nun große .jpg ect. Bilder so in .gif konvertieren, dass Python sie vollständig anzeigt?
Ich habe FormatFactory benutzt, aber er zeigt mir dann immer nur den ersten Pixel der Grafik an.
mfg Felix
Re: Bild größen
Verfasst: Sonntag 30. März 2014, 15:32
von BlackJack
@FemeS: Die Frage lässt sich so ohne Quelltext nicht beantworten.
Re: Bild größen
Verfasst: Mittwoch 21. Mai 2014, 14:57
von Ene Uran
Hier ist ein typisches Beispiel ...
Code: Alles auswählen
#!/usr/bin/env python
'''
display an image using Tkinter and PIL (Python Image Library)
using PIL allows Tkinter to read more than just .gif image files
you can use PIL fork Pillow from:
https://pypi.python.org/pypi/Pillow/2.0.0
'''
import Tkinter as tk
# ImageTk may need its own install on Ubuntu
from PIL import ImageTk
root = tk.Tk()
# pick an image file you have in your working directory or
# give the full file path
image_file = "JenniferMetcalfe.jpg"
root.title(image_file)
# load and convert to a format Tkinter can handle
image_tk = ImageTk.PhotoImage(file=image_file)
# put the image on a typical widget
label = tk.Label(root, image=image_tk)
label.pack(padx=5, pady=5)
root.mainloop()