Initial image formatting code with corresponding initialization.