{"action":"opened","issue":{"url":"https://api.github.com/repos/python-pillow/Pillow/issues/2372","repository_url":"https://api.github.com/repos/python-pillow/Pillow","labels_url":"https://api.github.com/repos/python-pillow/Pillow/issues/2372/labels{/name}","comments_url":"https://api.github.com/repos/python-pillow/Pillow/issues/2372/comments","events_url":"https://api.github.com/repos/python-pillow/Pillow/issues/2372/events","html_url":"https://github.com/python-pillow/Pillow/issues/2372","id":202823645,"number":2372,"title":"ImageTk.getimage is broken","user":{"login":"wiredfool","id":19792,"avatar_url":"https://avatars.githubusercontent.com/u/19792?v=3","gravatar_id":"","url":"https://api.github.com/users/wiredfool","html_url":"https://github.com/wiredfool","followers_url":"https://api.github.com/users/wiredfool/followers","following_url":"https://api.github.com/users/wiredfool/following{/other_user}","gists_url":"https://api.github.com/users/wiredfool/gists{/gist_id}","starred_url":"https://api.github.com/users/wiredfool/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wiredfool/subscriptions","organizations_url":"https://api.github.com/users/wiredfool/orgs","repos_url":"https://api.github.com/users/wiredfool/repos","events_url":"https://api.github.com/users/wiredfool/events{/privacy}","received_events_url":"https://api.github.com/users/wiredfool/received_events","type":"User","site_admin":false},"labels":[{"id":485342677,"url":"https://api.github.com/repos/python-pillow/Pillow/labels/Hasn't%20worked%20in%2020%20years","name":"Hasn't worked in 20 years","color":"c5def5","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-01-24T13:52:42Z","updated_at":"2017-01-24T13:52:42Z","closed_at":null,"body":"### What did you do?\r\n\r\nLooked at the api, tried `ImageTk.getimage`\r\n\r\n### What did you expect to happen?\r\n\r\nAn Image.\r\n\r\n### What actually happened?\r\n\r\nI got a TkError. Digging through the code, get image calls `tkImaging.c:PyImagingPhotoGet`:\r\n```\r\nstatic int\r\nPyImagingPhotoGet(ClientData clientdata, Tcl_Interp* interp,\r\n               int argc, char **argv)\r\n{\r\n    Tk_PhotoHandle photo;\r\n    Tk_PhotoImageBlock block;\r\n\r\n    if (argc != 2) {\r\n        Tcl_AppendResult(interp, \"usage: \", argv[0],\r\n                         \" srcPhoto\", (char *) NULL);\r\n        return TCL_ERROR;\r\n    }\r\n\r\n    /* get Tcl PhotoImage handle */\r\n    photo = Tk_FindPhoto(interp, argv[1]);\r\n    if (photo == NULL) {\r\n        Tcl_AppendResult(\r\n            interp, \"source photo must exist\", (char *) NULL\r\n            );\r\n        return TCL_ERROR;\r\n    }\r\n\r\n    Tk_PhotoGetImage(photo, &block);\r\n\r\n    printf(\"pixelPtr = %p\\n\", block.pixelPtr);\r\n    printf(\"width = %d\\n\", block.width);\r\n    printf(\"height = %d\\n\", block.height);\r\n    printf(\"pitch = %d\\n\", block.pitch);\r\n    printf(\"pixelSize = %d\\n\", block.pixelSize);\r\n    printf(\"offset = %d %d %d %d\\n\", block.offset[0], block.offset[1],\r\n           block.offset[2], block.offset[3]);\r\n\r\n    Tcl_AppendResult(\r\n        interp, \"this function is not yet supported\", (char *) NULL\r\n        );\r\n\r\n    return TCL_ERROR;\r\n}\r\n```\r\n\r\nNote that every code path ends in an error. \r\n\r\n### What versions of Pillow and Python are you using?\r\n\r\nmaster. But it really doesn't matter, since most of this code hasn't been touched since the PIL import. Except for the Tk reorg. Which didn't actually check that this code could run. \r\n\r\n\r\n```python\r\n            self.image = ImageTk.PhotoImage(im)\r\n            ImageTk.getimage(self.image)\r\n```\r\n"}}
{"actor":{"display_login":"wiredfool"}}