Image manipulation program in Java