Code cleanup

Added write32BitInt function as per suggested on reddit in order to
optimize.

Removed the string part of the encode function, due to different way of
handling pixel data.