Looks about right to me. You can use drawImage directly so you dont have to convert (although the conversion happens implicitly anyway).