Giter Site home page Giter Site logo

xbrzscale's Introduction

xBRZ upscaling commandline tool

Copyright (c) 2020 Przemysław Grzywacz [email protected]

This file is part of xbrzscale.

xbrzscale is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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

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

The following external code is included in this repository:

Dependencies

The following dependencies are needed to compile xbrzscale:

  • libsdl2-dev
  • libsdl2-image-dev

On Windows said dependencies can be installed by doing the following:

Under OSX they can be installed using macports

  • port install libsdl2_image
  • port install libsdl2

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

For Mac and Linux:

run make and you should end up with a binary called xbrzscale.

For Windows:

run mingw32-make -f Makefile-win and you should end up with a binary called xbrzscale.exe

Usage

`xbrztool 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.

xbrzscale's People

Contributors

aquariuspower avatar atheros avatar codef53 avatar panchokoster avatar pejic avatar tpimh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

xbrzscale's Issues

No releases published ....

For packaging in Linux distributions it would be useful to have a formal release tarball for the source code.
Maybe name it xbrzscale-1.8.1.tar.gz, being the first 'scale version of library 1.8.
Or whatever. Anything would be better than "No releases published".

Error on compile

I'm not a coder, sorry if this seems self-evident. This is the output of make:

g++ -std=c++0x -c -o xbrzscale.o xbrzscale.cpp sdl-config --cflags
xbrzscale.cpp: In function ‘int main(int, char*)’:
xbrzscale.cpp:193:57: error: too few arguments to function ‘void xbrz::scale(size_t, const uint32_t
, uint32_t_, int, int, xbrz::ColorFormat, const xbrz::ScalerCfg&, int, int)’
xbrz::scale(scale, in_data, dest, src_width, src_height);
^
In file included from xbrzscale.cpp:26:0:
xbrz/xbrz.h:57:6: note: declared here
void scale(size_t factor, //valid range: 2 - 5
^
make: *_* [xbrzscale.o] Error 1

Error when compiling on Mac OS X: no member named 'sqrt' in namespace 'std'

With SDL2 installed, this is what I get when I try to compile on Mac OS X

$ make
g++ -std=c++11 -c -o xbrzscale.o xbrzscale.cpp `sdl2-config --cflags`
g++ -std=c++11 -c -o xbrz/xbrz.o xbrz/xbrz.cpp -DNDEBUG
xbrz/xbrz.cpp:174:12: error: no member named 'sqrt' in namespace 'std'; did you mean 'sbrk'?
    return std::sqrt(square(r_diff) + square(g_diff) + square(b_diff));
           ^~~~~~~~~
           sbrk
/usr/include/unistd.h:582:7: note: 'sbrk' declared here
void    *sbrk(int);
         ^
xbrz/xbrz.cpp:201:12: error: no member named 'sqrt' in namespace 'std'; did you mean 'sbrk'?
    return std::sqrt(square(lumaWeight * y) + square(c_b) + square(c_r));
           ^~~~~~~~~
           sbrk
/usr/include/unistd.h:582:7: note: 'sbrk' declared here
void    *sbrk(int);
         ^
xbrz/xbrz.cpp:237:49: error: no member named 'sqrt' in namespace 'std'
            buffer[i] = static_cast<float>(std::sqrt(square(y) + square(c_b) + square(c_r)));
                                           ~~~~~^
3 errors generated.
make: *** [xbrz/xbrz.o] Error 1

updating xBRZ to latest?

As I read, this seems to be the differences from the work here:

xBRZ 1.6 [2018-02-27]
---------------------
Added bilinear scaling
Updated license info
Option to skip color buffer creation


xBRZ 1.5 [2017-08-07]
---------------------
Added RGB conversion routines

It doesnt look as having had a performance improvement (probably here we have with the cache), I will take a look at the code tho.

May be that 'bilinear scaling' has something interesting. I tried reading some of the code, not used to it tho, my guess the result will be not the same quality of the main scaling, not sure tho.

The goal in Ivan is just to UP scale, and it seems performance may be better if the code only does that?

anyway, do you believe it is worth updating here with 1.6?

Windows Binary Please!

Hi, Atheros.
I'm a Windows 32 bit user who doesn't have idea how to compiling software from source code. I don't know what is it, where to get it, and how to use compiler.

If there are pre-compiled binary for Windows, it will be very goog.

Overflow (C26451)

Uint8 *p = (Uint8 *)surface->pixels + y * surface->pitch + x * bpp;
-to-
Uint8 *p = (Uint8 *)surface->pixels + static_cast<__int64>(y) * surface->pitch + static_cast<__int64>(x) * bpp;

ETC...

error: use of undeclared identifier 'Z_BEST_COMPRESSION'

When trying to compile on OS X I get

g++ -std=c++0x -c -o xbrzscale.o xbrzscale.cpp `sdl-config --cflags`
g++ -c -o SDL_imagesave/IMG_savepng.o SDL_imagesave/IMG_savepng.c `sdl-config --cflags` -ISDL_imagesave
clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated
SDL_imagesave/IMG_savepng.c:293:22: error: use of undeclared identifier 'Z_BEST_COMPRESSION'
    if(compression > Z_BEST_COMPRESSION) compression = Z_BEST_COMPRESSION;
                     ^
SDL_imagesave/IMG_savepng.c:293:56: error: use of undeclared identifier 'Z_BEST_COMPRESSION'
    if(compression > Z_BEST_COMPRESSION) compression = Z_BEST_COMPRESSION;
                                                       ^
SDL_imagesave/IMG_savepng.c:350:23: error: use of undeclared identifier 'Z_NO_COMPRESSION'
    if(compression == Z_NO_COMPRESSION) {
                      ^
SDL_imagesave/IMG_savepng.c:352:44: error: use of undeclared identifier 'Z_NO_COMPRESSION'
        png_set_compression_level(png_ptr, Z_NO_COMPRESSION);
                                           ^
4 errors generated.
make: *** [SDL_imagesave/IMG_savepng.o] Error 1

LGPL

As it is now a library, I wonder if there is some restriction that could prevent this project from being re-licenced as LGPL? But this is just a suggestion anyway :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.