overbrowsing / pruner

✂️ A plugin to stitch multiple images into a single canvas.
http://overbrowsing.com/pruner/
MIT License
0 stars 0 forks source link

Visualisations: Add Configuration as Function Parameters #2

Open printerscanner opened 2 days ago

printerscanner commented 2 days ago

It would be beneficial to move the current hard-coded configuration values into parameters for the Python program. This way, users can adjust these settings without needing to modify the source code directly. The goal is to make the tool more flexible and user-friendly.


# Configuration
def generate_viewport_widths(start=500, end=1680, num_points=100): # Range of viewport widths (pixels)
    return np.linspace(start, end, num_points)
viewport_widths = generate_viewport_widths()
viewport_height = 750  # Viewport height (pixels)
cols, rows = 5, 5  # Columns and rows
tile_width, tile_height = 300, 200  # Tile size (pixels)
mobile_scale = 1.2  # Mobile scale factor (i.e. 1.2 = 120%)
mobile_breakpoint = 768  # Mobile breakpoint (pixels)

Argparse

To allow users to input their configurations via command-line parameters, we should use Python’s argparse package. This will also generate helpful --help text in the terminal, providing guidance on how to use the tool.

Argparse Docs

headlesshorse commented 2 days ago

I agree—and we could potentially create an interface as an HTML document where the graph is visualised and the files (tiles) are generated, making the tool even more interactive and user-friendly.