summaryrefslogtreecommitdiff
path: root/misc
diff options
context:
space:
mode:
authorJason Ekstrand <jason.ekstrand@intel.com>2015-12-08 14:23:53 -0800
committerJason Ekstrand <jason.ekstrand@intel.com>2015-12-08 14:34:48 -0800
commite7451f4361c5c79b4f96297a1aff6630a3aab083 (patch)
tree7cd1275e19ad19a3d05cd2e9b6dd10155c7dcaa3 /misc
parent8db88894655efa8223cbd7e9a059af0afc832446 (diff)
gen_image: Take an operation parameter
Diffstat (limited to 'misc')
-rwxr-xr-xmisc/gen_image7
1 files changed, 6 insertions, 1 deletions
diff --git a/misc/gen_image b/misc/gen_image
index 2575d41..50d79fa 100755
--- a/misc/gen_image
+++ b/misc/gen_image
@@ -16,6 +16,7 @@ def die(msg):
def parse_args():
p = argparse.ArgumentParser()
+ p.add_argument('operation')
p.add_argument('src_filename')
p.add_argument('dest_filename')
return p.parse_args()
@@ -25,6 +26,7 @@ def main():
src_filename = args.src_filename
dest_filename = args.dest_filename
+ operation = args.operation
if re.search('grayscale', dest_filename):
imread_flags = cv2.IMREAD_GRAYSCALE
@@ -40,7 +42,10 @@ def main():
width = int(match.groups(0)[0])
height = int(match.groups(0)[1])
- res = cv2.resize(img, (width, height), interpolation = cv2.INTER_CUBIC)
+ if operation == 'scale':
+ res = cv2.resize(img, (width, height), interpolation = cv2.INTER_CUBIC)
+ else:
+ die('invalid operation: {!r}'.format(dest_filename))
cv2.imwrite(dest_filename, res)