Skip to content

Instantly share code, notes, and snippets.

@mustafaboleken
Created June 14, 2023 16:21
Show Gist options
  • Save mustafaboleken/38e89ed0d00520da5dcb3388e10de9c6 to your computer and use it in GitHub Desktop.
Save mustafaboleken/38e89ed0d00520da5dcb3388e10de9c6 to your computer and use it in GitHub Desktop.
import sys
import PIL.Image as Image
import pathlib
width = int(sys.argv[1])
height = int(sys.argv[2])
output_name = sys.argv[3]
frame_data = sys.stdin.buffer.read()
pathlib.Path('/usr/local/antmedia/image').mkdir(parents=True, exist_ok=True)
img = Image.frombuffer("RGBA", (width, height), frame_data, "raw", "RGBA", 0, 1)
img.save(f"/usr/local/antmedia/image/{output_name}.png")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment