# albumentations CenterCrop HorizontalFlip Blur ToGray equivalent pipeline from PIL import Image import numpy as np def box_blur_3x3(img): padded = np.pad(img.astype(np.float32), ((1, 1), (1, 1), (0, 0)), mode='edge') out = np.zeros_like(img, dtype=np.float32) for y in range(img.shape[0]): for x in range(img.shape[1]): out[y, x] = padded[y:y+3, x:x+3].mean(axis=(0, 1)) return np.rint(out).astype(np.uint8) src = np.array(Image.open('input.ppm').convert('RGB')) top, left = (src.shape[0] - 4) // 2, (src.shape[1] - 4) // 2 crop = src[top:top+4, left:left+4, :] flipped = crop[:, ::-1, :] blurred = box_blur_3x3(flipped) gray = np.rint(0.299 * blurred[:, :, 0] + 0.587 * blurred[:, :, 1] + 0.114 * blurred[:, :, 2]).astype(np.uint8) expected = np.repeat(gray[:, :, None], 3, axis=2) Image.fromarray(expected).save('transformed_image.png') open('transform_report.txt', 'w', encoding='utf-8').write('CenterCrop HorizontalFlip Blur ToGray gray pipeline applied with albumentations-compatible semantics.\n')