YUV的subsmapling有以下幾種處理方式
JPEG color subsampling則有444, 422, 420三種,Python可以利用Pillow直接幫忙處理轉換
https://pillow.readthedocs.io/en/5.1.x/handbook/image-file-formats.html#jpeg
from PIL import Image
# convert a imgae to different yuv subsampling format
if __name__ == '__main__':
name = raw_input('Input file-path: ')
fmt = input('jpg output format( YUV444(0) YUV422(1) YUV420(2)): ')
im = Image.open(name)
print im.size
im.convert('RGB').save('out.jpg', subsampling=fmt)