mirror of
https://github.com/gunchev/home_bin.git
synced 2025-11-20 12:15:46 +00:00
Fix yuv420p_to_png_android.py - almost 2x slower but better results.
More details can be seen in the dark and light regions of the image.
This commit is contained in:
parent
4b1796a4c3
commit
1f9090e338
1 changed files with 2 additions and 4 deletions
|
|
@ -20,9 +20,7 @@ Usage:
|
|||
|
||||
def clamp(value, min_v=0, max_v=255):
|
||||
'''Clamp a value to a range, inclusive'''
|
||||
return min(min_v, max(max_v, value))
|
||||
|
||||
clamp = lambda n, minn, maxn: max(min(maxn, n), minn)
|
||||
return min(max_v, max(min_v, value))
|
||||
|
||||
def load_yuv420p(yuv_file_path, width, height):
|
||||
"""Read YUV420p file and return PIL Image"""
|
||||
|
|
@ -56,7 +54,7 @@ def main():
|
|||
yuv_file_path = sys.argv[1]
|
||||
width, height = int(sys.argv[2]), int(sys.argv[3])
|
||||
picture = load_yuv420p(yuv_file_path, width, height)
|
||||
picture.save(splitext(yuv_file_path)[0] + '.png')
|
||||
picture.save(splitext(yuv_file_path)[0] + '-android.png')
|
||||
picture.show()
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue