diff --git a/charidotella/__init__.py b/charidotella/__init__.py index 6a442cb..a966cef 100644 --- a/charidotella/__init__.py +++ b/charidotella/__init__.py @@ -401,6 +401,7 @@ def run_generators(configuration: dict[str, typing.Any]): "timecode": True, "h264_crf": 15, "ffmpeg": "ffmpeg", + "scale": 1, } }, }, @@ -426,6 +427,7 @@ def run_generators(configuration: dict[str, typing.Any]): "alpha": 0.1, "png_compression_level": 6, "background_color": "#191919", + "scale": 1, }, }, { @@ -479,6 +481,7 @@ def run_generators(configuration: dict[str, typing.Any]): "cumulative_ratio": 0.01, "timecode": False, "ffmpeg": "ffmpeg", + "scale": 1, }, }, ] diff --git a/charidotella/tasks/colourtime.py b/charidotella/tasks/colourtime.py index b972a5a..79d2ca7 100644 --- a/charidotella/tasks/colourtime.py +++ b/charidotella/tasks/colourtime.py @@ -5,6 +5,7 @@ import event_stream import matplotlib import matplotlib.colors +import PIL.Image EXTENSION = ".png" @@ -35,7 +36,13 @@ def run( alpha=parameters["alpha"], background_colour=matplotlib.colors.to_rgba(parameters["background_color"]), ) - image.save( + image.resize( + size=( + image.width * parameters["scale"], + image.height * parameters["scale"], + ), + resample=PIL.Image.Resampling.NEAREST, # type: ignore + ).save( str(output), compress_level=parameters["png_compression_level"], format="png", diff --git a/charidotella/tasks/event_rate.py b/charidotella/tasks/event_rate.py index abcd1d5..aa41681 100644 --- a/charidotella/tasks/event_rate.py +++ b/charidotella/tasks/event_rate.py @@ -15,7 +15,11 @@ def run( ): subprocess.run( [ - str(importlib.resources.files("charidotella").joinpath("executables/event_rate")), + str( + importlib.resources.files("charidotella").joinpath( + "executables/event_rate" + ) + ), str(input), str(output), f"--begin={begin}", diff --git a/charidotella/tasks/video.py b/charidotella/tasks/video.py index cc9cd4c..f93d956 100644 --- a/charidotella/tasks/video.py +++ b/charidotella/tasks/video.py @@ -18,19 +18,30 @@ def run( int(value) for value in subprocess.run( [ - str(importlib.resources.files("charidotella").joinpath("executables/size")), + str( + importlib.resources.files("charidotella").joinpath( + "executables/size" + ) + ), str(input), ], check=True, capture_output=True, ).stdout.split(b"x") ) + width *= parameters["scale"] + height *= parameters["scale"] es_to_frames_arguments = [ - str(importlib.resources.files("charidotella").joinpath("executables/es_to_frames")), + str( + importlib.resources.files("charidotella").joinpath( + "executables/es_to_frames" + ) + ), f"--input={input}", f"--begin={begin}", f"--end={end}", f"--frametime={parameters['frametime']}", + f"--scale={parameters['scale']}", f"--style={parameters['style']}", f"--tau={parameters['tau']}", f"--oncolor={parameters['on_color']}", diff --git a/charidotella/tasks/wiggle.py b/charidotella/tasks/wiggle.py index 7730bfc..28efe79 100644 --- a/charidotella/tasks/wiggle.py +++ b/charidotella/tasks/wiggle.py @@ -39,6 +39,7 @@ def run( f"--begin={begin}", f"--end={end}", f"--frametime={frametime}", + f"--scale={parameters['scale']}", f"--style={parameters['style']}", f"--tau={tau}", f"--oncolor={parameters['on_color']}", diff --git a/command_line_tools b/command_line_tools index bf2f61f..1fb3fa4 160000 --- a/command_line_tools +++ b/command_line_tools @@ -1 +1 @@ -Subproject commit bf2f61f1262d4536d17e85cd594be352908c0347 +Subproject commit 1fb3fa4d7553f3857ab3a31073b28e32a0f27721 diff --git a/configuration-schema.json b/configuration-schema.json index bd63d6b..cbcc975 100644 --- a/configuration-schema.json +++ b/configuration-schema.json @@ -125,6 +125,10 @@ "background_color": { "type": "string" }, + "scale": { + "type": "integer", + "exclusiveMinimum": 0 + }, "cycle": { "type": ["string", "integer"] } @@ -136,7 +140,8 @@ "colormap", "alpha", "png_compression_level", - "background_color" + "background_color", + "scale" ] }, { @@ -245,6 +250,10 @@ "ffmpeg": { "type": "string" }, + "scale": { + "type": "integer", + "exclusiveMinimum": 0 + }, "lambda_max": { "type": "number", "minimum": 0.0 @@ -263,6 +272,7 @@ "cumulative_ratio", "timecode", "h264_crf", + "scale", "ffmpeg" ] }, @@ -313,6 +323,10 @@ "ffmpeg": { "type": "string" }, + "scale": { + "type": "integer", + "exclusiveMinimum": 0 + }, "lambda_max": { "type": "number", "minimum": 0.0 @@ -329,7 +343,8 @@ "off_color", "idle_color", "cumulative_ratio", - "ffmpeg" + "ffmpeg", + "scale" ] } ] diff --git a/setup.py b/setup.py index 8e6f77d..7c521d4 100644 --- a/setup.py +++ b/setup.py @@ -77,7 +77,7 @@ setuptools.setup( name="charidotella", - version="0.2", + version="0.3", url="https://github.com/neuromorphicsystems/charidotella", author="Alexandre Marcireau", author_email="alexandre.marcireau@gmail.com",