summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xphotoblaster/modules/pbgenerate/__init__.py13
-rwxr-xr-xshare/frontend/im/index.html4
-rw-r--r--share/frontend/im/js/main.js1
3 files changed, 13 insertions, 5 deletions
diff --git a/photoblaster/modules/pbgenerate/__init__.py b/photoblaster/modules/pbgenerate/__init__.py
index 5baad8b..cf9b330 100755
--- a/photoblaster/modules/pbgenerate/__init__.py
+++ b/photoblaster/modules/pbgenerate/__init__.py
@@ -32,6 +32,7 @@ class PbGenerate(ModuleBase):
'width': '200',
'black': 'black',
'tile': 'true',
+ 'maintain_proportions': 'true',
'white': 'white',
'contrast': '100',
'hue': '90',
@@ -63,6 +64,7 @@ class PbGenerate(ModuleBase):
'background': {'type': 'img_url'},
# BOOLS
+ 'maintain_proportions': {'type': 'bool', 'default': True},
'coalesce': {'type': 'bool'},
'nearest': {'type': 'bool'},
'merge_early': {'type': 'bool'},
@@ -175,11 +177,12 @@ class PbGenerate(ModuleBase):
]
else:
cmd.append("-resize")
- cmd += [
- "{}x{}".format(
- self.params.width or "", self.params.height or ""
- )
- ]
+ dimensions_str = "{}x{}".format(
+ self.params.width or "", self.params.height or ""
+ )
+ if not self.params.maintain_proportions:
+ dimensions_str += "!"
+ cmd.append(dimensions_str)
if self.params.black != "black" or self.params.white != 'white':
cmd += [
"+level-colors",
diff --git a/share/frontend/im/index.html b/share/frontend/im/index.html
index 64a42d3..8170b6c 100755
--- a/share/frontend/im/index.html
+++ b/share/frontend/im/index.html
@@ -107,6 +107,10 @@
<input type="text" id="img-height" /><small>px</small>
<br/>
+ <label>maintain proportions?</label>
+ <input type="checkbox" id="img-maintain_proportions" value="1" checked="true" />
+ <br/>
+
<label>nearest neighbor?</label>
<input type="checkbox" id="img-nearest" value="1" />
<br/>
diff --git a/share/frontend/im/js/main.js b/share/frontend/im/js/main.js
index 27dbc96..36ae071 100644
--- a/share/frontend/im/js/main.js
+++ b/share/frontend/im/js/main.js
@@ -22,6 +22,7 @@ var Main =
transparent: $('#img-transparent:checked').val() !== undefined ? "true" : "false",
flip: $('#img-flip:checked').val() !== undefined ? "true" : "false",
flop: $('#img-flop:checked').val() !== undefined ? "true" : "false",
+ maintain_proportions: $('#img-maintain_proportions:checked').val() !== undefined ? "true" : "false",
nearest: $('#img-nearest:checked').val() !== undefined ? "true" : "false",
rotate: $("#img-rotate").val(),
subtract: $("#img-subtract").val(),