diff options
| -rw-r--r-- | photoblaster/modules/.ropeproject/globalnames | bin | 282 -> 476 bytes | |||
| -rwxr-xr-x | photoblaster/modules/pbgenerate.py | 60 |
2 files changed, 42 insertions, 18 deletions
diff --git a/photoblaster/modules/.ropeproject/globalnames b/photoblaster/modules/.ropeproject/globalnames Binary files differindex d474d53..6a68327 100644 --- a/photoblaster/modules/.ropeproject/globalnames +++ b/photoblaster/modules/.ropeproject/globalnames diff --git a/photoblaster/modules/pbgenerate.py b/photoblaster/modules/pbgenerate.py index 68a2303..1cab3fd 100755 --- a/photoblaster/modules/pbgenerate.py +++ b/photoblaster/modules/pbgenerate.py @@ -2,7 +2,7 @@ from photoblaster.config import BIN_CONVERT, OUTPUT_IMAGE_TYPES,\ DEFAULT_FINALFORMAT from photoblaster.modules import Pb -_DEFAULT_TAG = "im" +_DEFAULT_TAG = "PbGenerate" _GRAVITY_PARAMS = [ "NorthWest", "North", "NorthEast", "West", @@ -17,7 +17,9 @@ _COMPOSE_PARAMS = [ ] _DISPOSE_PARAMS = ["None", "Previous", "Background"] _DISPOSE_DEFAULT = "None" -_HUE_DEFUALT = '100'; +_HUE_DEFUALT = '100' + + class PbGenerate(Pb): example_params = { """Example params. Used with the classmethod Pb.run_example""" @@ -35,7 +37,6 @@ class PbGenerate(Pb): 'saturation': '100', 'merge_early': 'true', 'format': 'gif', -# 'background': 'bob', 'background': 'http://i.asdf.us/im/bc/new_1430440747.gif', 'subtract': '#EE7AE9', 'transparent': 'true', @@ -46,6 +47,7 @@ class PbGenerate(Pb): 'callback': 'jsonp1430442384162', 'fuzz': '5' } + def __init__(self, **kwargs): super(PbGenerate, self).__init__(**kwargs) """ @@ -53,11 +55,11 @@ class PbGenerate(Pb): Types are defined as in their individual params classes. """ _definitions = { - #IMAGES + # IMAGES 'url': {'type': 'img_url'}, 'background': {'type': 'img_url'}, - #BOOLS + # BOOLS 'coalesce': {'type': 'bool'}, 'nearest': {'type': 'bool'}, 'merge_early': {'type': 'bool'}, @@ -66,12 +68,12 @@ class PbGenerate(Pb): 'tile': {'type': 'bool'}, 'transparent': {'type': 'bool'}, - #COLORS + # COLORS 'black': {'type': 'color', 'default': 'black'}, 'white': {'type': 'color', 'default': 'white'}, 'subtract': {'type': 'color'}, - #INTS + # INTS 'fuzz': {'type': 'int'}, 'width': {'type': 'int'}, 'height': {'type': 'int'}, @@ -81,24 +83,35 @@ class PbGenerate(Pb): 'rotate': {'type': 'int'}, 'hue': {'type': 'int', 'default': _HUE_DEFUALT}, - #ENUMS - 'compose': {'type': 'enum', 'enum_values': _COMPOSE_PARAMS, 'default': 'Atop'}, + # ENUMS + 'compose': { + 'type': 'enum', + 'enum_values': _COMPOSE_PARAMS, + 'default': 'Atop'}, 'gravity': { - 'type': 'enum', 'enum_values': _GRAVITY_PARAMS, 'default': _GRAVITY_DEFAULT + 'type': 'enum', + 'enum_values': _GRAVITY_PARAMS, + 'default': _GRAVITY_DEFAULT }, 'dispose': { - 'type': 'enum', 'enum_values': _DISPOSE_PARAMS, 'default': 'None' + 'type': 'enum', + 'enum_values': _DISPOSE_PARAMS, + 'default': 'None' }, 'format': { - 'type': 'enum', 'enum_values': OUTPUT_IMAGE_TYPES, 'default': DEFAULT_FINALFORMAT + 'type': 'enum', + 'enum_values': OUTPUT_IMAGE_TYPES, + 'default': DEFAULT_FINALFORMAT }, - #STRINGS + # STRINGS "username": {'type': "string"}, "callback": {'type': "string"}, } - """Definitions and arguments are merged into attributes of the params object""" + """ + Definitions and arguments are merged into attributes + of the params object""" self.params.definitions_import( _definitions, kwargs, classname=self.__class__.__name__ ) @@ -144,12 +157,23 @@ class PbGenerate(Pb): cmd += ["-transparent", self.params.subtract] if self.params.width or self.params.height: if self.params.nearest and self.params.format == "gif": - cmd += ["-coalesce", "+map", "-interpolate", "Nearest", "-interpolative-resize"] + cmd += [ + "-coalesce", "+map", + "-interpolate", "Nearest", + "-interpolative-resize" + ] else: cmd.append("-resize") - cmd += ["{}x{}".format(self.params.width or "", self.params.height or "")] + cmd += [ + "{}x{}".format( + self.params.width or "", self.params.height or "" + ) + ] if self.params.black != "black" or self.params.white != 'white': - cmd += ["+level-colors", "{},{}".format(self.params.black, self.params.white)] + cmd += [ + "+level-colors", + "{},{}".format(self.params.black, self.params.white) + ] if self.params.contrast: cmd += ['-contrast-stretch', self.params.contrast] if self.params.brightness or self.params.saturation or self.params.hue: @@ -160,7 +184,7 @@ class PbGenerate(Pb): self.params.hue or 100 ) ] - cmd.append("-coalesce")#why? #FIXME + cmd.append("-coalesce") # why? FIXME cmd += [self.filepath] self._call_cmd(cmd) |
