diff options
| author | yo mama <pepper@scannerjammer.com> | 2016-10-06 08:36:47 -0700 |
|---|---|---|
| committer | yo mama <pepper@scannerjammer.com> | 2016-10-06 08:36:47 -0700 |
| commit | c56370307ef7dff2a1942a5cddc327d250de5fb4 (patch) | |
| tree | 8e2b8bc6e43e9ca79c18d813b4afd9e9bbf14362 | |
| parent | 1fa8cd2f45e502d2bcec75013aaf0f067c38ac27 (diff) | |
cool
| -rwxr-xr-x | photoblaster/modules/pbgenerate/__init__.py | 13 | ||||
| -rwxr-xr-x | share/frontend/im/index.html | 4 | ||||
| -rw-r--r-- | share/frontend/im/js/main.js | 1 |
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(), |
