Splitting image processing into its own file, minor cleanup.