Matlab function to time justification images