auto retry image compression with decreasing sample size