You can apply random geometric transformations (rotation, anisotropy, scale, and translation) to an image using ocrodeg.transform_image.
To generate a set of random parameters that are suitable for document degradation, use ocrodeg.random_transform(). You can pass these parameters as keyword arguments to transform_image or override specific ranges by providing your own values.
# Generate random parameters
params = ocrodeg.random_transform()
# Apply the transformation
degraded_image = ocrodeg.transform_image(image, **params)
# Alternatively, apply specific parameters directly
degraded_image = ocrodeg.transform_image(image, angle=0.05, aniso=1.2, scale=0.9, translation=(0.01, 0.02))