Problems saving an image with PIL

0

I can not save my image when I click on the guardar menu. I searched and what I found was the function: Image.save . This is my code:

from tkinter import *
from tkinter import Tk    
from tkinter import PhotoImage
from tkinter import Canvas
from tkinter import NW
from tkinter import Menu
from tkinter import filedialog
from PIL import Image, ImageTk
from sys import argv
import tkinter as tk

def guardar():
    global imagen
    ventana.filename=filedialog.asksaveasfilename(initialdir="C:/User/Imágenes")
    ruta=ventana.filename
    imagen = Image.save(ruta)
    imagenL = ImageTk.PhotoImage(imagen)
    canvas.create_image(0,0,anchor=NW,image=imagenL) 
    
asked by Airam 17.01.2018 в 19:21
source

1 answer

0

I think your problem could be in the path of the image.

try this:

do not use "." in "window.filename" better use "_" and do it like this:

with open(ventana_filename,"r")as arc:
    ruta = arc.read()
    
answered by 19.04.2018 в 08:11