frame is already an image.
this is clearly the result of blindly copypasting 2 code snippets, that dont belong together