Move ws image buffer to ws object

I'd prefer the callback function named as the callback, so `free_buffer` should be `deinit_buffer` or `deinit_callback`.