Thanks to antonijn, for fixing image not releasing resources and reversed pixel copying not working properly