added function to determine image compression