Using cast insted of function to calculate image size

Using casting int instead of intval function is faster in calculating image size