1
Fork 0

Compare commits

..

No commits in common. "586fd61781f4016a54a7d062798576c9069c19cd" and "50f2df77df6c6a80e949f371d67b2ebb66c3284b" have entirely different histories.

6 changed files with 7 additions and 90 deletions

3
.envrc
View File

@ -1,3 +0,0 @@
#!/usr/bin/env bash
use flake

1
.gitignore vendored
View File

@ -1,3 +1,2 @@
.direnv/
# Don't include rendered JPEGs and PNGs in git. # Don't include rendered JPEGs and PNGs in git.
public/**/*.png public/**/*.png

View File

@ -1,59 +0,0 @@
{
"nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1705309234,
"narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1705242415,
"narHash": "sha256-a8DRYrNrzTudvO7XHUPNJD89Wbf1ZZT0VbwCsPnHWaE=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "ea780f3de2d169f982564128804841500e85e373",
"type": "github"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

View File

@ -1,13 +0,0 @@
{
inputs.flake-utils.url = "github:numtide/flake-utils";
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
{
devShells.default = import ./shell.nix { inherit pkgs; };
}
);
}

View File

@ -2,7 +2,7 @@
from pathlib import Path from pathlib import Path
from subprocess import run from subprocess import run
from typing import List, Optional, Tuple from typing import List, Optional
def main() -> None: def main() -> None:
@ -14,7 +14,8 @@ def main() -> None:
convert_to_image( convert_to_image(
source=svg, source=svg,
destination=svg.with_name(f"{svg.stem}-{resolution}.png"), destination=svg.with_name(f"{svg.stem}-{resolution}.png"),
resolution=(resolution, resolution), width=resolution,
height=resolution,
) )
else: else:
convert_to_image(source=svg, destination=svg.with_suffix(".png")) convert_to_image(source=svg, destination=svg.with_suffix(".png"))
@ -23,20 +24,19 @@ def main() -> None:
def convert_to_image( def convert_to_image(
source: Path, source: Path,
destination: Path, destination: Path,
resolution: Optional[Tuple[int, int]] = None, width: Optional[int] = None,
height: Optional[int] = None,
) -> None: ) -> None:
"""Convert an SVG to an image with `inkscape`."""
inkscape_args: List[str] = ["inkscape", str(source), "-o", str(destination)] inkscape_args: List[str] = ["inkscape", str(source), "-o", str(destination)]
if resolution is not None: if width is not None and height is not None:
inkscape_args.extend(["-w", str(resolution[0]), "-h", str(resolution[1])]) inkscape_args.extend(["-w", str(width), "-h", str(height)])
run(args=inkscape_args) run(args=inkscape_args)
mat2_image(destination) mat2_image(destination)
def mat2_image(image: Path) -> None: def mat2_image(image: Path) -> None:
"""Run `mat2` on the image path."""
run(args=["mat2", "--inplace", image]) run(args=["mat2", "--inplace", image])

View File

@ -1,7 +0,0 @@
{ pkgs ? import <nixpkgs> { } }:
with pkgs;
mkShell rec {
packages = [ inkscape python3 ];
}