diff --git a/README.md b/README.md index 53eb705..b0830ef 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,4 @@ -xBRZ upscaling commandline tool -=============================== +# xBRZ upscaling commandline tool Copyright (c) 2020 Przemysław Grzywacz @@ -18,23 +17,18 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . - - -Overview --------- +## Overview This tool allows you to scale your graphics with xBRZ algorithm, see https://en.wikipedia.org/wiki/Pixel-art_scaling_algorithms#xBR_family -External code -------------- +## External code The following external code is included in this repository: * https://sourceforge.net/projects/xbrz/files/xBRZ/ - xBRZ implementation -Dependencies ------------- +## Dependencies The following dependencies are needed to compile xbrzscale: @@ -56,28 +50,36 @@ Some additional libraries are needed. I'm sure you'll figure it out. If you need SDL1.2 support, check sdl1.2 git branch. -Compiling ---------- +## Compiling -For Mac and Linux: +### For Mac and Linux: run `make` and you should end up with a binary called `xbrzscale`. -For Windows: +### For Windows: run `mingw32-make -f Makefile-win` and you should end up with a binary called `xbrzscale.exe` -Usage ------ +### With Nix: - `xbrztool scale_factor input_image output_image` +single run: +```bash +nix run github:atheros/xbrzscale -- scale_factor input_image output_image +``` -* `scale_factor` - Controls how much your image should be scaled. It should be an integer between 2 and 5 (inclusive). -* `input_image` - Input image is the filename of the image you want to scale. Image format can be anything that SDL_image supports. -* `output_image` - Filename where the scaled image should be saved. The only supported format is PNG! - -Please note I only tested the scaling on 32bit RGBA PNGs, I have no idea if this will work with 8bit indexed images. +enter shell with xbrzscale available +```bash +nix shell github:atheros/xbrzscale +``` +## Usage +```bash +xbrzscale scale_factor input_image output_image +``` +* `scale_factor` - Controls how much your image should be scaled. It should be an integer between 2 and 6 (inclusive). +* `input_image` - Input image is the filename of the image you want to scale. Image format can be anything that SDL_image supports. +* `output_image` - Filename where the scaled image should be saved. The only supported format is PNG! +Please note I only tested the scaling on 32bit RGBA PNGs, I have no idea if this will work with 8bit indexed images. diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..64213ac --- /dev/null +++ b/flake.lock @@ -0,0 +1,61 @@ +{ + "nodes": { + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1756770412, + "narHash": "sha256-+uWLQZccFHwqpGqr2Yt5VsW/PbeJVTn9Dk6SHWhNRPw=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "4524271976b625a4a605beefd893f270620fd751", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1758277210, + "narHash": "sha256-iCGWf/LTy+aY0zFu8q12lK8KuZp7yvdhStehhyX1v8w=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "8eaee110344796db060382e15d3af0a9fc396e0e", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-lib": { + "locked": { + "lastModified": 1754788789, + "narHash": "sha256-x2rJ+Ovzq0sCMpgfgGaaqgBSwY+LST+WbZ6TytnT9Rk=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "a73b9c743612e4244d865a2fdee11865283c04e6", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-parts": "flake-parts", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..b767047 --- /dev/null +++ b/flake.nix @@ -0,0 +1,43 @@ +{ + inputs = { + flake-parts.url = "github:hercules-ci/flake-parts"; + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + }; + + outputs = + inputs@{ flake-parts, ... }: + flake-parts.lib.mkFlake { inherit inputs; } { + systems = [ + "x86_64-linux" + "aarch64-linux" + "aarch64-darwin" + "x86_64-darwin" + ]; + perSystem = + { + config, + self', + inputs', + pkgs, + system, + ... + }: + { + packages.default = pkgs.stdenv.mkDerivation { + pname = "xbrzscale"; + version = "1.8"; + src = ./.; + + buildInputs = with pkgs; [ + SDL2 + SDL2_image + ]; + + installPhase = '' + mkdir -p $out/bin + cp xbrzscale $out/bin/xbrzscale + ''; + }; + }; + }; +}