| 922 | |
| 923 | |
| 924 | def resize_video(clip): |
| 925 | # TODO log rotation done? |
| 926 | |
| 927 | if clip.rotation in (90, 270): |
| 928 | clip = clip.resize(clip.size[::-1]) |
| 929 | clip.rotation = 0 |
| 930 | |
| 931 | # Caution, must match image size |
| 932 | max_size = settings.DEFAULT_MAX_SIZE |
| 933 | |
| 934 | if clip.w > clip.h: |
| 935 | if clip.w < max_size: |
| 936 | width = clip.w |
| 937 | else: |
| 938 | width = max_size |
| 939 | clip = clip.resize(width = width) |
| 940 | else: |
| 941 | if clip.h < max_size: |
| 942 | height = clip.h |
| 943 | else: |
| 944 | height = max_size |
| 945 | clip = clip.resize(height = height) |
| 946 | |
| 947 | return clip |
| 948 | |
| 949 | |
| 950 | # CAREFUL DANGEROUS FUNCTION |