Revert "Support writing image to memory and remove RubyInline dependency"

This reverts commit 6f3e79c2a7c1271444e2f38a5c07cf797e3ae01c.