Better image alignment handling