Reformatted code
Drop images above 1 megabyte
Only reencode image once