Author Topic: Downscaling-Algorithm of Icons  (Read 2504 times)

0 Members and 1 Guest are viewing this topic.

Offline Leartin

Downscaling-Algorithm of Icons
« on: May 06, 2014, 09:09:29 PM »
I noticed that with the themes, icons get scaled to 32x32, whatever their actual size is, which means creating 64x64 Icons (just in case someone uses a big-button-theme) seems plausible.
If the downscaling algorithm is simple enough that each pixel of the 32²-size-icon is only determined by the four equivalent pixels in the 64²-size-icon, in a way a human can understand (like, maybe it's simply always the upper left pixel of the four... something like that) it should be possible to create 64² icons which look exactly the same at 32²-size as they do now. (Creating just any 64²-size icon wont do, as most players will probably still play with 32² buttons, so those are the more important ones)

I'd be glad if there is a answer to this simple enough that I can understand.

Offline An_dz

  • Web Admin
  • Administrator
  • *
  • Posts: 2532
  • Total likes: 271
  • Helpful: 89
  • D'oh
    • by An_dz
  • Languages: PT, EN, (it, de)
Re: Downscaling-Algorithm of Icons
« Reply #1 on: May 06, 2014, 10:06:20 PM »
The code probably uses Bicubic algorithm for reduction. What you explained is like Nearest Neighbor, it's used when enlarging the graphics.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 8685
  • Total likes: 294
  • Helpful: 228
  • Languages: De,EN,JP
Re: Downscaling-Algorithm of Icons
« Reply #2 on: May 07, 2014, 10:09:43 AM »
For scaling from 64 to 32 (or vice versa) the code uses no interpolation, just leaves away every second pixel. It only uses interpolation for other scaling factors.

But indeed, supplying 64  x64 icons might be a good idea, because in the future with all those high res and tablets around, larger icons (als well as GUI and fonts ... ) seem very likely.

Offline Leartin

Re: Downscaling-Algorithm of Icons
« Reply #3 on: May 07, 2014, 12:10:22 PM »
For scaling from 64 to 32 (or vice versa) the code uses no interpolation, just leaves away every second pixel.

So, it's indeed the upper left pixel of the bunch? (every second pixel +every second row gets discarded)?
In that case, the idea might work :) I'll have to test that.

Offline An_dz

  • Web Admin
  • Administrator
  • *
  • Posts: 2532
  • Total likes: 271
  • Helpful: 89
  • D'oh
    • by An_dz
  • Languages: PT, EN, (it, de)
Re: Downscaling-Algorithm of Icons
« Reply #4 on: May 07, 2014, 01:11:46 PM »
For scaling from 64 to 32 (or vice versa) the code uses no interpolation, just leaves away every second pixel. It only uses interpolation for other scaling factors.
My test doesn't output this. Attached an image showing my result from 32 to 16 with 500% zoom.

If that is not an interpolate image then I have no idea what interpolation is. And btw, this looks like bilinear.

Offline Leartin

Re: Downscaling-Algorithm of Icons
« Reply #5 on: May 07, 2014, 02:13:52 PM »
True, I tried it myself...

First row: Old Icons
Second row: New Icons, 64x64 scaled down to 32²
Third row: New Icons, original size
Fourth row: Old Icons, 48² (as is used in big standard theme)
Fifth row: New Icons, 48²

Now they don't look too bad, even with interpolation, it might pay to just let them scale.

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4142
  • Total likes: 137
  • Helpful: 147
  • Languages: EN, DE, AT
Re: Downscaling-Algorithm of Icons
« Reply #6 on: May 07, 2014, 05:07:31 PM »
My test doesn't output this. Attached an image showing my result from 32 to 16 with 500% zoom.

If that is not an interpolate image then I have no idea what interpolation is. And btw, this looks like bilinear.
The downscaling is doing interpolation. With special treatment of special colors.
Parsley, sage, rosemary, and maggikraut.

Offline Leartin

Re: Downscaling-Algorithm of Icons
« Reply #7 on: May 07, 2014, 06:42:48 PM »
Is there any chance we might get the option to define multiple Icons in different sizes for each object, so that the fitting one is picked (32², 48², 64²), but if not available, created by scaling the biggest available button? That would be a much cleaner option...

Offline Flemmbrav

Re: Downscaling-Algorithm of Icons
« Reply #8 on: May 07, 2014, 07:27:53 PM »
thanks leartin, that would be really nice!
the downscaled icons are unlookable for me => small headaches - I'm sorry about that.

Offline An_dz

  • Web Admin
  • Administrator
  • *
  • Posts: 2532
  • Total likes: 271
  • Helpful: 89
  • D'oh
    • by An_dz
  • Languages: PT, EN, (it, de)
Re: Downscaling-Algorithm of Icons
« Reply #9 on: May 08, 2014, 01:40:11 AM »
Use nearest-neighbour when enlarging is an option as well.

Offline Leartin

Re: Downscaling-Algorithm of Icons
« Reply #10 on: May 08, 2014, 10:38:48 AM »
Use nearest-neighbour when enlarging is an option as well.
Not really.

In the attachment, the first row are the normal icons, enlarged to 48² with nearest neighbour. And it looks terrible. :(