Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 24 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
xBRZ upscaling commandline tool
===============================
# xBRZ upscaling commandline tool

Copyright (c) 2020 Przemysław Grzywacz <nexather@gmail.com>

Expand All @@ -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 <http://www.gnu.org/licenses/>.



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:

Expand All @@ -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.
61 changes: 61 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

43 changes: 43 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -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
'';
};
};
};
}