// Load RGB image Reg_Set(10, "|(USER_MACRO)\example.ppm") Call("LOAD_PPM") // Convert to grayscale #10 = Buf_Num Call("RGB_TO_GRAYSCALE") Buf_Switch(#10) Buf_Quit(OK) // Convert to RGB Call("GRAYSCALE_TO_RGB") // Save the image Reg_Set(10, "|(USER_MACRO)\example_gray.ppm") Call("SAVE_PPM") // Cleanup and exit Buf_Switch(#20) Buf_Quit(OK) return