def calc_rowsize(bits, width):
        """ Computes number of bytes per row in a image (stride). """
        ## The size of each row is rounded up to the nearest multiple of 4 bytes.
        return int(((bits * width + 31) // 32)) * 4