Giter VIP home page Giter VIP logo

gimp-plugin-pixel-art-scalers's Introduction

Gimp Pixel Art Scalers Plugin

GIMP plugin for rescaling images using Pixel Art Scalers

These scalers are able to resize graphics in a way that avoids both bluring and pixelation, while also preserving the look and feel of the image. They are commonly used for upscaling pixel art from console games when run in an emulator. They can be useful in other realms too.

Download compiled executables here:

See instructions below for where to install the binary

Supported image scalers:

  • HQX (hq2x, hq3x, hq4x)
  • XBR (xbr2x, xbr3x, xbr4x)
  • ScaleX (scale2x, scale3x, scale4x)

GIMP Image Editor using Pixel Art Scalers Plugin

Options:

  • Force semi-transparent pixels to fully opaque / transparent (edge aliasing)
  • Suppress colors from alpha-hidden pixels (can sometimes cause discoloration at the edges)
  • Tiled and transparent temporary border options to improve scaling in special cases

Hints:

  • The plugin is located in : Menu -> Filter -> Render -> Pixel Art Scalers
  • You can resize the plugin dialog for a larger preview window
  • Currently it only operates on RGB and RGBA images

Acknowledgement:


Install folder & path locations

Copy the "plugin-pixel-art-scalers"(.exe) binary to your GIMP plugin folder. The location will depend on your GIMP version and Operating System.

Plug-in folder locations: 
(where 2.x is your gimp version. example: ~/.gimp-2.8/plug-ins)

  * Linux: ~/.gimp-2.x/plug-ins
  * Windows: %APPDATA%\GIMP\2.x\plug-ins  or  C:\Program Files\GIMP 2\lib\gimp\2.0\plug-ins
  * macOS / OSX: $HOME/Library/Application Support/GIMP/2.x/plug-ins

Build instructions

Native compile on Linux:

If GIMP & build tools not yet installed:
(example for debian/ubuntu/mint)
 * sudo apt install gimp
 * sudo apt install build-essential
 * sudo apt install libgimp2.0-dev

Then:
* cd gimp-plugin-pixel-art-scalers
* make

Install on macOS using homebrew

(Formula courtesy of @ryan-robeson.)

1. Run: brew install ryan-robeson/gimp/pixel-art-scalers
2. Then add the new plugin folder to GIMP's settings

gimp-plugin-pixel-art-scalers's People

Contributors

bbbbbr 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gimp-plugin-pixel-art-scalers's Issues

xBRZ

Could you please implement the xBRZ filter? It is produces slightly more refined outputs and would be very helpful.

Feature Request: Better handling of Image Boundaries and Seamless Tiling

Originally posted by @nightmaredream in #2 (comment)

About "seamless" processing...

And about "pixels stuck to sides" on semi-transparent images...

I'll show you an example of side stuck upscale pixels.
witherwart

The left mushroom thing's topmost part is squared, that's because the upscale process bounces to borders...

It would be difficult to difference different jobs, so separating seamless batch from no-repeat batch would allow to do, in one batch, save borders.. And in the other batch... Emulate seamlessness with copies of the tiles in every directions and then reduce back to original size.

But yeah, for the moment, a tolerance slider... Then making every tolerated pixels fully opaque!

Seamlessness examples

coarse_dirt_silty

image

seamlessresult

While it's still a very nice result, seamlessness is broken.

Another example: (Very good, but broken seamlessness)
image

Unwanted contour line

Hi, when i upscale any image, any mode, that has an alpha channel and transparency in it, it makes a contour line of glitched colors from pink to white and so on. I really need a solid line, and i'm batch doing files so i can't just go around and remove these contour lines one by one, it's a skull-scratching issue. Pixel art should Never have glitched contour lines, ever. I can't understand why this plugins isn't pre-fixed about that. IT'S obvious that upscaled sprites needs solid edges.

Batch-jobbing with Gimp is already a hassle (Using tinytask, doing eveything manually, automated, it's time-expensive)... Adding supplementary tasks such as "create layer mask, posterize mask, go filter, generic, erode, then saving, for every files with an alpha channel, consumes a lot of time... hence, your plugin should do solid edges.

Method ScaleNX.

Hi @bbbbbr .

See stbiscalenx: Stb Image Scale Near X.

This method is very similar to ScaleX. This method does not add new colors, only uses those that already exist. Replacing equal with near makes color selection more flexible, allowing pixel scaling techniques to be applied even to full-color images. I use this to scale scanned material containing a lot of glyphs and contours.

origin x2 x3
orig x2 x3

scalers[SCALER_...].scaler_function = &...;?

scalers[SCALER_2X_HQX].scaler_function = &hq2x_32;

scalers[SCALER_3X_HQX].scaler_function = &hq3x_32;

scalers[SCALER_4X_HQX].scaler_function = &hq4x_32;

scalers[SCALER_2X_XBR].scaler_function = &xbr_filter_xbr2x;

scalers[SCALER_3X_XBR].scaler_function = &xbr_filter_xbr3x;

scalers[SCALER_4X_XBR].scaler_function = &xbr_filter_xbr4x;

scalers[SCALER_2X_SCALEX].scaler_function = &scaler_scalex_2x;

scalers[SCALER_3X_SCALEX].scaler_function = &scaler_scalex_3x;

scalers[SCALER_4X_SCALEX].scaler_function = &scaler_scalex_4x;

scalers[SCALER_2X_NEAREST].scaler_function = &scaler_nearest_2x;

scalers[SCALER_3X_NEAREST].scaler_function = &scaler_nearest_3x;

scalers[SCALER_4X_NEAREST].scaler_function = &scaler_nearest_4x;

❓ It may be worth replacing this awkward and inconvenient function reference with a wrapper of the form:

void scalers_select(uint32_t * sp, uint32_t * dp, int Xres, int Yres, int factor, int numalg){...}

Not?

dialog?

// Attach the label and combo to the table and show them all
gtk_table_attach_defaults (GTK_TABLE (settings_table), settings_scaler_label, 2, 3, 0, 1); // Middle of table
gtk_table_attach_defaults (GTK_TABLE (settings_table), settings_scaler_combo, 3, 4, 0, 1); // Right side of table
gtk_table_attach_defaults (GTK_TABLE (settings_table), settings_semi_transparency_checkbutton, 0, 1, 0, 1); // Left side of table
gtk_table_attach_defaults (GTK_TABLE (settings_table), settings_semi_transparency_spinbutton, 1, 2, 0, 1); // Left side of table
gtk_table_attach_defaults (GTK_TABLE (settings_table), settings_hidden_colors_checkbutton, 0, 1, 1, 2); // Left side of table
gtk_table_attach_defaults (GTK_TABLE (settings_table), settings_hidden_colors_spinbutton, 1, 2, 1, 2); // Left side of table

You dialog

Maybe?:

    // Attach the label and combo to the table and show them all
    gtk_table_attach_defaults (GTK_TABLE (settings_table), settings_scaler_label, 0, 1, 0, 1); // Left side of table
    gtk_table_attach_defaults (GTK_TABLE (settings_table), settings_scaler_combo, 1, 2, 0, 1); // Left side of table

    gtk_table_attach_defaults (GTK_TABLE (settings_table), settings_semi_transparency_checkbutton, 0, 1, 1, 2); // Left side of table
    gtk_table_attach_defaults (GTK_TABLE (settings_table), settings_semi_transparency_spinbutton, 1, 2, 1, 2); // Left side of table

    gtk_table_attach_defaults (GTK_TABLE (settings_table), settings_hidden_colors_checkbutton, 0, 1, 2, 3);     // Left side of table
    gtk_table_attach_defaults (GTK_TABLE (settings_table), settings_hidden_colors_spinbutton, 1, 2, 2, 3);     // Left side of table

Fixed dialog

Running in BIMP

Hi, I'm trying to batch a large number of images with your plugin in BIMP and I'm having some issues. I can't seem to control the resolution or much of anything really. These are the options I see:

Screenshot 2022-03-23 003650

The end result of the image also results in 3/4ths of the image being cut out, leaving only the upper left corner:

463b0b7e_02aa325d_64_64_0

if you could please advise, I have a very large amount of images to process and I would greatly appreciate the help

MacOS + homebrew Build instructions

Apparently, macports is also an option, but I use homebrew and i didn't want to mix the two package managers.

Luckily, @ryan-robeson set up a tap which includes libgimp (for https://github.com/bootchk/resynthesizer), and installing it allowed make to work. https://gist.github.com/ryan-robeson/5841f712ff23c910bbbfac793c16bfad#3---install-dependencies

And the default directory to install the plugin is ~/Library/Application\ Support/GIMP/2.10/plug-ins

And it works!

I can submit a simple PR to update the readme.

Unable to install on Win 64 bit

First error message is:
image
The second is the same
the third is:
image
Fourth is:
image

And then it closes. It is not telling me where it is looking, or lets me try somewhere else

Thanks for this.

Thank you very much for doing this, bbbbbr. It should have been in main GIMP for decades.

On my devuan ceres linux, building with libgtk2.0-dev Version: 2.24.33-2 fails with:

gcc -c src/filter_dialog.c -o obj/filter_dialog.o -pthread -I/usr/local/include/libpng17 -I/usr/include/gtk-2.0 -I/usr/lib/aarch64-linux-gnu/gtk-2.0/include -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng16 -I/usr/include/aarch64-linux-gnu -I/usr/include/pango-1.0 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/fribidi -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib/aarch64-linux-gnu/glib-2.0/include -I/usr/include/uuid -I/usr/include/freetype2 -pthread -I/usr/local/include/libpng17 -I/usr/include/gimp-2.0 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng16 -I/usr/include/aarch64-linux-gnu -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/gegl-0.4 -I/usr/include/gio-unix-2.0 -I/usr/include/json-glib-1.0 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/glib-2.0 -I/usr/lib/aarch64-linux-gnu/glib-2.0/include -I/usr/include/babl-0.1
In file included from /usr/include/gtk-2.0/gdk/gdkevents.h:34,
                 from /usr/include/gtk-2.0/gdk/gdkdisplay.h:32,
                 from /usr/include/gtk-2.0/gdk/gdkscreen.h:33,
                 from /usr/include/gtk-2.0/gdk/gdkapplaunchcontext.h:31,
                 from /usr/include/gtk-2.0/gdk/gdk.h:32,
                 from /usr/include/gtk-2.0/gtk/gtk.h:32,
                 from /usr/include/gimp-2.0/libgimp/gimpui.h:22,
                 from src/filter_dialog.c:19:
/usr/include/gtk-2.0/gdk/gdkcolor.h:74:3: warning: parameter names (without types) in function declaration
   74 |   gint      GSEAL (size);
      |   ^~~~
/usr/include/gtk-2.0/gdk/gdkcolor.h:74:13: error: field ‘GSEAL’ declared as a function
   74 |   gint      GSEAL (size);

The only possibly relevant discussion to GSEAL which I have found (with the now almost completely broken-for-FOSS web search engines) is here.
https://stackoverflow.com/questions/15569756/how-do-i-get-access-to-gsealed-values-from-gtk-widget-modify-gtkwidgets.
[Not able to insert a link because the new github owners have broken the comment editor for my browser.]

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.