import os import struct import sys def convert_plut_to_cube(plut_path, cube_path): """ Converts a custom binary .plut format back to .cube (Adobe 3D LUT). Format: - Magic: 'PLUT' (4 bytes) - Version: 1 (uint32) - Size: Dimension of the 3D LUT, e.g., 32 (uint32) - Data Type: 0 for UINT8 RGB, 1 for UINT16 RGB (uint32) - Payload: Raw RGB data """ try: with open(plut_path, 'rb') as f: magic = f.read(4) if magic != b'PLUT': print(f"Error: Invalid magic in {plut_path}") return False version = struct.unpack(' {os.path.basename(cube_path)}...") if convert_plut_to_cube(plut_path, cube_path): count += 1 print(f"Successfully reverted {count} LUT files.") if __name__ == '__main__': main()