AuthorTopic: The chalenge to upscale pixel art  (Read 28235 times)

Offline Hyllian

  • 0001
  • *
  • Posts: 16
  • Karma: +0/-0
    • View Profile

The chalenge to upscale pixel art

on: January 08, 2012, 11:52:25 am
Yes, and this is hard as hell. I'm trying for almost a year.

Here's my upscaler which turn any png image file into a 2x, 3x or 4x upscaled version:

http://www.multiupload.com/GQFZDT9MAV

            Usage: xBR <input png> <output png> [<scale_factor>]
            scale_factor: 2x or 3x or 4x. (default: 4x)


I know this may be an heresy for you, but sometimes it can help someway. My purposes are print and play classic videogames on HDTVs.

I'm continuing researching about how to perfect this transformation.

Hope you enjoy!

I don't know if I can post pixel arts from other related sites upscaled here, so I won't until a confirmation.

Please, do not kill me!  :-*
« Last Edit: September 19, 2013, 11:14:15 pm by Hyllian »

Offline Hyllian

  • 0001
  • *
  • Posts: 16
  • Karma: +0/-0
    • View Profile

Re: See my algorithm to upscale pixel art

Reply #1 on: January 08, 2012, 01:17:20 pm
Let's put an example so that you understand what I'm talking.

I've got this random pixel art I found through google.

Original:


Nearest Neighbor:


Smooth resample from Graphics Gale software:


My algorithm (4xBR):



Nearest Neighbor has a checkerboard effect, I don't like it. That other filtering blurs too much. Then I developed this algorithm to upscale by smoothing jaggies without adding too much blur.

Offline robalan

  • 0010
  • *
  • Posts: 337
  • Karma: +0/-0
    • View Profile

Re: See my algorithm to upscale pixel art

Reply #2 on: January 08, 2012, 03:45:07 pm
That's a nice algorithm! Does it perform as well on smaller pieces?  There was a paper at this year's SIGGRAPH about this subject: http://research.microsoft.com/en-us/um/people/kopf/pixelart/index.html  Some of their results are better than others, and I'd be curious to see how your algorithm compares to theirs. Can you post some of the pictures they used run through your algorithm? I'd be especially curious to see the Yoshi, since that's one they didn't do a very good job at.
Always remember: a preposition is not something you should end a sentence with.

Offline Hyllian

  • 0001
  • *
  • Posts: 16
  • Karma: +0/-0
    • View Profile

Re: See my algorithm to upscale pixel art

Reply #3 on: January 08, 2012, 04:02:29 pm
Here you go:

Offline Argyle

  • 0010
  • *
  • Posts: 269
  • Karma: +1/-1
  • Futuristic beep boop.
    • argylebox
    • http://pixeljoint.com/p/13899.htm
    • valsaurus
    • View Profile
    • ArgyleBox | Designs by Valouria Saurus (VERY OUTDATED)

Re: See my algorithm to upscale pixel art

Reply #4 on: January 08, 2012, 11:43:07 pm
I've tried your program out on Windows 7 and it just opens a command prompt window that immediately closes. Am I using it wrong?  Interesting results for sure. I don't find it blasphemous to do this to pixel art, it could be a useful starting point for converting low res art into HD. Perhaps even for upscaling then downsizing to a slightly larger version than the original piece to be cleaned up at the pixel level from there.

Offline Hyllian

  • 0001
  • *
  • Posts: 16
  • Karma: +0/-0
    • View Profile

Re: See my algorithm to upscale pixel art

Reply #5 on: January 09, 2012, 12:34:25 am
I've tried your program out on Windows 7 and it just opens a command prompt window that immediately closes. Am I using it wrong?  Interesting results for sure. I don't find it blasphemous to do this to pixel art, it could be a useful starting point for converting low res art into HD. Perhaps even for upscaling then downsizing to a slightly larger version than the original piece to be cleaned up at the pixel level from there.
This is a command line program. To use:

Open a DOS-Prompt (command line window).

You have to go through the command line to the folder where the program is located. Then use this command:

4xBR <input png> <output png>

Offline Argyle

  • 0010
  • *
  • Posts: 269
  • Karma: +1/-1
  • Futuristic beep boop.
    • argylebox
    • http://pixeljoint.com/p/13899.htm
    • valsaurus
    • View Profile
    • ArgyleBox | Designs by Valouria Saurus (VERY OUTDATED)

Re: See my algorithm to upscale pixel art

Reply #6 on: January 09, 2012, 02:49:39 am
Tried it out on some varied types of images I had sitting around. I really liked the result on the afroducks and ogre foodstand in particular!





















And here's a sheet from Surt's random sprite generator, for sheer shape cluster processing's sake.





Then for one last test to toy with result comparisons, I processed an original picture and the upsized result from your tool with rotsprite (a tool someone made for resizing and rotating pixel art) to compare results of a 45degree rotation export of the sprite at double the size of its original resolution. So I had rotsprite double the size of the original and rotate it, and had it halve the size of 4xBR's version and rotate it. Here's how that result came out:


upscaled version of the original


downscaled version from 4xBR

Gotta say, I preferred the result that was achieved from downsizing your tool's export over that of upscaling the original.


And as far as rotating those at the original resolution, it was a mixed bag. The first image was the original sized file rotated, and the second file is the 4xBR version downsized to 25% then rotated.



Rotating the original better maintained fine details (like the eyeball shinies) but had more sharp noise to it, while yours lost some of that detail but had a smoother look to it. So usage for things like this are situationally beneficial I suppose.

Thanks for sharing the tool, and sorry for so many pictures!
« Last Edit: January 09, 2012, 02:59:30 am by Argyle »

Offline Hyllian

  • 0001
  • *
  • Posts: 16
  • Karma: +0/-0
    • View Profile

Re: See my algorithm to upscale pixel art

Reply #7 on: January 09, 2012, 07:31:43 am
Thanks for the tests! I haven't used rotsprite before. I like your avatar results too. It seems rotation is a hot topic here. Do you think a 2x and a 3x upscaler would be useful?

« Last Edit: January 09, 2012, 07:39:45 am by Hyllian »

Offline Argyle

  • 0010
  • *
  • Posts: 269
  • Karma: +1/-1
  • Futuristic beep boop.
    • argylebox
    • http://pixeljoint.com/p/13899.htm
    • valsaurus
    • View Profile
    • ArgyleBox | Designs by Valouria Saurus (VERY OUTDATED)

Re: See my algorithm to upscale pixel art

Reply #8 on: January 09, 2012, 07:46:59 am
It seems rotation is a hot topic here.

Sometimes it's something better off just being redrawn really quick by hand, and sometimes a quick in-editor rotate and cleanup is all you need, but when there are tools that can do it for you with less after-cleanup required, I make the most of them if the time saved outweighs the hassle of saving a file out and running it through another program then cleaning up and rejoining it with the workfile.  I'll sometimes draw a character and separate their body parts and some poses and just run a buttload of incremental rotation steps and save the ones that look fine in my ProMotion brush tray for easy grabbing and placing if needed when I get to animating. So I guess rotation is a hot commodity for my workflow, but every pixel artist does it differently :)

EDIT - Just saw that you added on to your post while I was replying :P

Quote
Do you think a 2x and a 3x upscaler would be useful?

Hey, if it's no big deal to add to your algorithm I don't see why it would hurt to have it, especially if somebody was using this for turning pixels into HD like you said you were, but the 4x version was more than needed for the target resolution.

Could just add one more statement to the command like "4xBR image.png imagehd.png 3" and maybe just have it default to 4x if they didn't add a number to the end of the command.

As far as what I see myself using this for is entirely unforseen. But I think the end results are kind of cool and interesting for some pieces and I can forsee using it and playing around, perhaps using the end result clusters as a reference to paint over top off in case I need to upsize a character portrait to double size but still maintain single-pixel detail.
« Last Edit: January 09, 2012, 08:02:26 am by Argyle »

Offline janiczek

  • 0001
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile

Re: See my algorithm to upscale pixel art

Reply #9 on: January 11, 2012, 07:31:37 pm
Hmm, "see my algorithm" says the subject. I'd very much like to! Would you care to post the source code or at least explained algorithm somewhere on the net? :) The results are very nice.

Offline Hyllian

  • 0001
  • *
  • Posts: 16
  • Karma: +0/-0
    • View Profile

Re: See my algorithm to upscale pixel art

Reply #10 on: January 11, 2012, 08:23:50 pm
Hmm, "see my algorithm" says the subject. I'd very much like to! Would you care to post the source code or at least explained algorithm somewhere on the net? :) The results are very nice.
Sorry, I forgot.

Here's a forum where I've posted some explanations: http://board.byuu.org/viewtopic.php?f=10&t=2248&sid=edaa0bc013fc818260120a23334b3ce8

Sources xBR in Paintwon game: http://paintown.svn.sourceforge.net/viewvc/paintown/trunk/src/util/sdl/xbr.cpp?revision=6823&view=markup

Sources of Kega plugin (genesis emulator): http://www.multiupload.com/69MJ0ZOPAD

Shader implementations (in Cg): http://www.multiupload.com/M2SUIU3J6H

Offline janiczek

  • 0001
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile

Re: See my algorithm to upscale pixel art

Reply #11 on: January 11, 2012, 08:30:12 pm
Thank you, Hyllian! The explanation on the forums is especially helpful.

Offline Hyllian

  • 0001
  • *
  • Posts: 16
  • Karma: +0/-0
    • View Profile

Re: See my algorithm to upscale pixel art

Reply #12 on: January 11, 2012, 09:17:12 pm
Thank you, Hyllian! The explanation on the forums is especially helpful.
There are some slightly differences between algorithm explanation and the implementation itself. It's because the tutorial was made early and I continue evolving it.

Offline Hyllian

  • 0001
  • *
  • Posts: 16
  • Karma: +0/-0
    • View Profile

Re: See my algorithm to upscale pixel art

Reply #13 on: January 13, 2012, 01:50:27 am
Could just add one more statement to the command like "4xBR image.png imagehd.png 3" and maybe just have it default to 4x if they didn't add a number to the end of the command.
Done!

Here the xBR app, now scales to 3x and 4x: http://www.multiupload.com/2JY2QM1AC3

            Usage: xBR <input png> <output png> [<scale_factor>]
            scale_factor: 3x or 4x. (default: 4x)


The 3x implementation is a bit different than the 4x. In 3x I didn't blend pixels, so the original palette is preserved, though the result is bit more jagged. Because of this, 3x scales very well to 9x, 27x and so on.

Here an example:

Original


3x


9x


27x (too big to post directly)
http://i.imgur.com/Pbd5m.png

Offline Argyle

  • 0010
  • *
  • Posts: 269
  • Karma: +1/-1
  • Futuristic beep boop.
    • argylebox
    • http://pixeljoint.com/p/13899.htm
    • valsaurus
    • View Profile
    • ArgyleBox | Designs by Valouria Saurus (VERY OUTDATED)

Re: See my algorithm to upscale pixel art

Reply #14 on: January 13, 2012, 12:12:55 pm
Haha! Cool stuff and not bad results! Gotta say, also, this feels like a less destructive way to prepare pixel art to bring into a vector editor at a better resolution for live trace (were there ever a need).  Going to have to print that out and scare my wife with it...

Offline Hyllian

  • 0001
  • *
  • Posts: 16
  • Karma: +0/-0
    • View Profile

Re: See my algorithm to upscale pixel art

Reply #15 on: January 13, 2012, 03:28:29 pm
Click to see the real size:
1x.......3x.............................9x..................................27x................................81x
http://bildr.no/thumb/1077155.jpeg http://bildr.no/thumb/1077158.jpeg http://bildr.no/thumb/1077159.jpeg  http://bildr.no/thumb/1077160.jpeg  http://bildr.no/thumb/1077161.jpeg
« Last Edit: January 13, 2012, 03:33:09 pm by Hyllian »

Offline Hyllian

  • 0001
  • *
  • Posts: 16
  • Karma: +0/-0
    • View Profile

Re: See my algorithm to upscale pixel art

Reply #16 on: January 13, 2012, 09:04:40 pm
2x done!

http://www.multiupload.com/GQFZDT9MAV

            Usage: xBR <input png> <output png> [<scale_factor>]
            scale_factor: 2x or 3x or 4x. (default: 4x)

Offline Pixelchaser

  • 0001
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile

Re: See my algorithm to upscale pixel art

Reply #17 on: January 14, 2012, 02:20:39 pm
cant seem to get x2 working with latest version ?

edit. working now. think i was trying with older version.

Great work btw !
« Last Edit: January 14, 2012, 02:24:06 pm by Pixelchaser »

Offline Hyllian

  • 0001
  • *
  • Posts: 16
  • Karma: +0/-0
    • View Profile

Re: See my algorithm to upscale pixel art

Reply #18 on: December 05, 2012, 12:37:47 pm
Ive improved a bit the algorithm for pixel arts that use many colors. It preserves dithering. It only scales by2, though.


Download here:  https://anonfiles.com/file/92e2ed25e7efaae5fe28f76608658be8


Example of this thread (click to see in full size):
http://bildr.no/view/1335316

Usage:

          Usage: 2xBRh <input png> <output png>
« Last Edit: December 05, 2012, 12:48:51 pm by Hyllian »

Offline Jigsaw

  • 0001
  • *
  • Posts: 26
  • Karma: +0/-0
  • お前はもう死んでいる。
    • View Profile
    • Josef Axner: Digital Art Portfolio

Re: See my algorithm to upscale pixel art

Reply #19 on: December 05, 2012, 05:57:37 pm
This looks really cool! The download links for the older versions (non-dither preserving, etc) seem to be broken though, could you provide a new link to the latest version of the 4x scaler? (assuming this new one hasn't replaced it entirely)

Offline Hyllian

  • 0001
  • *
  • Posts: 16
  • Karma: +0/-0
    • View Profile

Re: See my algorithm to upscale pixel art

Reply #20 on: December 05, 2012, 06:13:39 pm
This looks really cool! The download links for the older versions (non-dither preserving, etc) seem to be broken though, could you provide a new link to the latest version of the 4x scaler? (assuming this new one hasn't replaced it entirely)
Ok, it's here: https://anonfiles.com/file/f25320e84e03808903c48a30b77c2f6a

Beware that this old version is intended for pixel art with few colors. The new one is more specialized in more complex pixel arts.

Offline Jigsaw

  • 0001
  • *
  • Posts: 26
  • Karma: +0/-0
  • お前はもう死んでいる。
    • View Profile
    • Josef Axner: Digital Art Portfolio

Re: See my algorithm to upscale pixel art

Reply #21 on: December 05, 2012, 06:50:23 pm
Right - figured it would be ideal to have access to both depending on what's needed. :) Thanks!

Offline Hyllian

  • 0001
  • *
  • Posts: 16
  • Karma: +0/-0
    • View Profile

Re: See my algorithm to upscale pixel art

Reply #22 on: December 05, 2012, 10:14:01 pm
Original


2x Scaled



More screenshots here:  http://imgur.com/a/XAwx5

Offline Hyllian

  • 0001
  • *
  • Posts: 16
  • Karma: +0/-0
    • View Profile

Re: See my algorithm to upscale pixel art

Reply #23 on: September 19, 2013, 11:10:47 pm
Long time no see! I have news!

I made this 3xBRLV4 No Blend standalone app:
https://anonfiles.com/file/ca64833f5adb4bd6bb1a9aa6e8ddb62c

It is the best no blend edition I have ever made.

Original:


3x:

Offline Crow

  • 0011
  • **
  • Posts: 647
  • Karma: +0/-0
  • Technicanimal
    • View Profile

Re: The chalenge to upscale pixel art

Reply #24 on: September 20, 2013, 08:18:33 am
That looks really great! Thanks for sharing :)
Discord: Ennea#9999

Offline Mathias

  • 0100
  • ***
  • Posts: 1797
  • Karma: +2/-0
  • Goodbye.
    • http://pixeljoint.com/p/9542.htm
    • View Profile

Re: The chalenge to upscale pixel art

Reply #25 on: September 20, 2013, 08:40:04 am
I agree; nice work.

But why?

Scaled pixel art. How/where is it used?

Offline yrizoud

  • 0010
  • *
  • Posts: 330
  • Karma: +0/-0
    • View Profile

Re: The chalenge to upscale pixel art

Reply #26 on: September 20, 2013, 08:48:26 am
Well this dragon becomes t-shirt-ready.

Offline Hyllian

  • 0001
  • *
  • Posts: 16
  • Karma: +0/-0
    • View Profile

Re: The chalenge to upscale pixel art

Reply #27 on: September 20, 2013, 09:55:46 am
I agree; nice work.

But why?

Scaled pixel art. How/where is it used?
When I see a nice pixel art work, I have a fetish to see it bigger! :p

But, I know it has some applications, for example:

- use in emulators to upscale retro games to fill high definition displays;
- print in bigger sizes: for cards or t-shirts as the guy above said;
- or just for apreciation.
« Last Edit: September 20, 2013, 09:57:44 am by Hyllian »

Offline ptoing

  • 0101
  • ****
  • Posts: 3063
  • Karma: +0/-0
  • variegated quadrangle arranger
    • the_ptoing
    • http://pixeljoint.com/p/2191.htm
    • View Profile
    • Perpetually inactive website

Re: The chalenge to upscale pixel art

Reply #28 on: September 20, 2013, 10:06:58 am
- use in emulators to upscale retro games to fill high definition displays;

Looks ugly.

Quote
- print in bigger sizes: for cards or t-shirts as the guy above said;

Again, just use clean scale.

Quote
- or just for apreciation.

Do you suddenly appreciate the pixelart more when you are looking at upscaled, filtered versions which destroy the clusters layed down with intent by the artist? I am not seeing it.

IMO any form of filtering that distorts the shape of clusters a pixel image originally had is not a good way to treat pixel art.

That said, I can appreciate the programming behind this. I just don't think it has any useful application, personally. At least I can't think of any.
There are no ugly colours, only ugly combinations of colours.

Offline Hyllian

  • 0001
  • *
  • Posts: 16
  • Karma: +0/-0
    • View Profile

Re: The chalenge to upscale pixel art

Reply #29 on: September 20, 2013, 10:15:49 am
Looks ugly.
Well, so we disagre at 100% here.

Quote
Again, just use clean scale.
I apreciate using clean scale too. But sometimes I like having options other than that.


Quote
Do you suddenly appreciate the pixelart more when you are looking at upscaled, filtered versions which destroy the clusters layed down with intent by the artist? I am not seeing it.

IMO any form of filtering that distorts the shape of clusters a pixel image originally had is not a good way to treat pixel art.

That said, I can appreciate the programming behind this. I just don't think it has any useful application, personally. At least I can't think of any.
Not more or less than the original one. I just like to apreciate it in other "angles/ways/views".

But, I respect your opinion.

Offline Ai

  • 0100
  • ***
  • Posts: 1057
  • Karma: +2/-0
  • finti
    • http://pixeljoint.com/pixels/profile.asp?id=1996
    • finticemo
    • View Profile

Re: The chalenge to upscale pixel art

Reply #30 on: September 20, 2013, 10:37:00 am
I personally appreciate it as a prefilter for feeding into vectorization. Particularly for B/W / lineart. Being able to scale nicely up to any size and have something sharp to start painting on/under, is excellent. (I like to use GrafX2's contour fill to thumbnail designs in B/W, so I can get a lot of use out of strong vectorization. Inkscape with no prefiltering is mediocre at respecting ~pixel-sized details)

Here are some comparisons of vectorization results:

At 3x original-pixel-art scale:
The first item in the 'gallery' is the result of putting the dragon straight into Inkscape's Trace Bitmap function; The second is the result of putting the result of Hyllian's 3xbrLV4 filter into Trace Bitmap. It notably improves 'sharp' elements and anything that has a narrow line of pixels, preventing it from becoming unduly rounded.

http://imgur.com/yQvurII,F0weOQM#0


At 6x original-pixel-art scale:

http://i.imgur.com/b72bWZO.png (without 3xbrLV4 prefiltering)
http://i.imgur.com/vTL6mIq.png (with 3xbrLV4 prefiltering)

« Last Edit: September 20, 2013, 10:40:09 am by Ai »
If you insist on being pessimistic about your own abilities, consider also being pessimistic about the accuracy of that pessimistic judgement.

Offline Seiseki

  • 0011
  • **
  • Posts: 915
  • Karma: +1/-0
  • Starmancer
    • OminuxGames
    • http://pixeljoint.com/p/35207.htm
    • StarmancerGame
    • View Profile
    • Starmancer Patreon

Re: The chalenge to upscale pixel art

Reply #31 on: September 20, 2013, 10:59:57 am
Upscaling pixelart will always be a touchy subject here.
The Focus on scaling pixel art and making it less jaggy devalues pixel art, because the low resolution is being seen as undesirable.
Especially when it's even being applied to old classic games, which look "too chunky" in hd.
Where is the love for real pixels? If it's not being appreciated like it used to, then we're clinging to something people write algorithms to get rid of..
Why are we then making pixel art in the first place instead of going straight for vector art..
If everyone was using pixel art upscalers, modern and retro pixel art would be dead.

Yes, I'm being overly dramatic, but the thought is kinda worrying me.
That's why I can agree on the ptoings conservative stance on this..

Pixel art is created with the intention of being pixel art, not vector art.
If you upscale it you're saying "I'd rather want this in vector art.." and that it's not good enough as just pixel art.

@Hyllian, I hope you don't view this philosophical input as a personal attack or an attack on your work which is still very impressive.

Offline Ai

  • 0100
  • ***
  • Posts: 1057
  • Karma: +2/-0
  • finti
    • http://pixeljoint.com/pixels/profile.asp?id=1996
    • finticemo
    • View Profile

Re: The chalenge to upscale pixel art

Reply #32 on: September 20, 2013, 12:21:10 pm
There's no need to worry that upscalers will replace PA -- filtered-upscaled pixel art is worse artistically than pixel art, even if you are not judging by pixel-art's particular standards. The element of distortion and exaggeration in pixel art holds up much worse at larger scales (that is, it is often much better to simply reduce the distortion and exaggeration in order to do a more interesting rendering of details, when you have the pixels to do so.),  and there is a general scale problem (when you attain a higher resolution, your eye expects finer details (rather than merely refinement of existing details), which naturally are beyond the ability of the upscaler to produce, since they aren't present in the source material.

I think the only type of graphics upgrade that would not have these downsides would not depend on a real upscaling algo -- rather, it would use a database mapping original graphical blocks (8x8 or 16x16, according to the system) to manually redrawn versions for whatever scale was selected.
(this is fairly hairy video-bandwidth-wise, but we are getting towards having systems powerful enough that that kind of thing could be done in-emulator)

However, there is really such a thing as too chunky -- when each individual pixel gets too big, the overall image stops reading well, and really does look like a mere collection of blocks. On my 20" desktop screen, it's at about 5x for me when the illusion of a coherent image breaks down.
So I do understand the desire to recover something that's more visually coherent from that, even at the cost of some of the finer artistic detail. For sufficiently low-res art on large displays this is a genuine problem.
If you insist on being pessimistic about your own abilities, consider also being pessimistic about the accuracy of that pessimistic judgement.

Offline Mathias

  • 0100
  • ***
  • Posts: 1797
  • Karma: +2/-0
  • Goodbye.
    • http://pixeljoint.com/p/9542.htm
    • View Profile

Re: The chalenge to upscale pixel art

Reply #33 on: September 20, 2013, 02:41:46 pm
I'm gonna have to echo ptoing.

Yes, that 3X dragon looks cool. Know why? Because it's a cool design. At 1X it works great. Just as the artist intended. Pixel tech intact.
At 3X, it's still interesting to look at, but no longer works as well. The whole thing looks filtered. The way the pixels have been treated is very mechanical in appearance. There are numerous places I see in need of attention. Obviously, because a computer made choices in an attempt to interpolate 1 pixel into 9, essentially.

All that said, I do agree the dragon would look better to most people on a T-shirt as the 3X smoothy algo version rather than nearest neighbor, IF the wearer wasn't an appreciator of PA.

To each his own.

Offline ErekT

  • 0010
  • *
  • Posts: 330
  • Karma: +0/-0
  • fistful of pixels
    • View Profile

Re: The chalenge to upscale pixel art

Reply #34 on: September 20, 2013, 03:49:11 pm
I kinda appreciate the painterly look you get from these filters. But yeh, one of pixel art's main strengths is in minute control of detail. I think this is why I've always preferred it to 3D where the computer does half the rendering job for you.

As scaling filters go though, it's better than any of the others I've seen :)
« Last Edit: September 20, 2013, 03:55:00 pm by ErekT »

Offline rikfuzz

  • 0010
  • *
  • Posts: 427
  • Karma: +1/-0
    • View Profile
    • twitter @hot_pengu

Re: The chalenge to upscale pixel art

Reply #35 on: September 20, 2013, 04:44:16 pm
Scaling pixel art is difficult - I've often had to do jobs for multiple resolutions, and usually end up cleaning stuff up from nearest neighbour scales or trying out Rotsprite which has a halfway decent scaling algorithm. The alternative is redrawing everything 2 or 3 times so this kind of tool can actually be pretty useful, at least for a starting point.  Granted I usually scale down if I can help it, but occasionally I've had to scale up.  Normally something like 125% or something rather than 300%, but any advancements in this area are appreciated.   :) 

Would anyone tackle an arbitrary % scaling DOWN algorithm? Ideally something that weighs contrast higher than near-duplicates. 

Offline Ai

  • 0100
  • ***
  • Posts: 1057
  • Karma: +2/-0
  • finti
    • http://pixeljoint.com/pixels/profile.asp?id=1996
    • finticemo
    • View Profile

Re: The chalenge to upscale pixel art

Reply #36 on: September 20, 2013, 10:37:53 pm
^ I think you probably want an algorithm based on the principles found in Liquid Resize (http://liquidrescale.wikidot.com/)
If you insist on being pessimistic about your own abilities, consider also being pessimistic about the accuracy of that pessimistic judgement.

Offline surt

  • 0011
  • **
  • Posts: 570
  • Karma: +0/-0
  • Meat by-product
    • not_surt
    • http://pixeljoint.com/p/2254.htm
    • View Profile
    • Uninhabitant

Re: The chalenge to upscale pixel art

Reply #37 on: September 20, 2013, 11:13:41 pm
I've been meaning to try out a simple priority/mode-based down-scaler idea using a colour priority list (eg. transparency low priority so it doesn't dominate small protruding features, outlines high priority so they don't get broken up), taking the highest priority colour, next taking the mode of the set of contributing pixels, then failing that take the weighted mean of the contributing pixels and fit to the palette.

Offline rikfuzz

  • 0010
  • *
  • Posts: 427
  • Karma: +1/-0
    • View Profile
    • twitter @hot_pengu

Re: The chalenge to upscale pixel art

Reply #38 on: September 21, 2013, 01:45:33 am
^ I think you probably want an algorithm based on the principles found in Liquid Resize (http://liquidrescale.wikidot.com/)

That's like photoshop's content aware scaling - I think you need something much simpler for pixel art - probably give every pixel a score of the distance in R/G/B to all it's neighbours (and maybe next next neighbours), and just throw them away in reverse score order till you reach the desired size.  Doing that row by row might make straight lines go wibbly, so maybe there's a smarter way to perform the cull. 

A secondary ranking based on the pixel position, might help, but even the dumbest approach would probably still be a better starting point than nearest neighbour for most cases.  (In theory!) 

Offline Tourist

  • 0010
  • *
  • Posts: 376
  • Karma: +1/-0
    • View Profile

Re: The chalenge to upscale pixel art

Reply #39 on: September 21, 2013, 11:08:44 pm
Perhaps there needs to be an in-between step to identify the artist's intention. 

This color is used for lines, so scale it according to these rules.  This other color, which has the same RGB value, is just a material shade, so scale it using these rules.

These two colors are on a common ramp, so shape the boundary between them to preserve the larger path of the border, and maybe use a little AA.  These two colors are two different objects altogether that just happen to be adjacent or overlapping, so do .. something else.

You could probably do it with different palette entries, but only for small color counts.  Otherwise you need to store additional data with the pixels.  A custom TIFF file format, maybe.  Final output can have the extra data stripped and colors merged.

Offline rikfuzz

  • 0010
  • *
  • Posts: 427
  • Karma: +1/-0
    • View Profile
    • twitter @hot_pengu

Re: The chalenge to upscale pixel art

Reply #40 on: September 22, 2013, 03:22:50 pm
Outlines are likely to have high contrast score, since they're always touching two relatively distant colours, so they should be preserved without any special markings I think.