Opened 13 years ago

Closed 13 years ago

#7130 closed enhancement (fixed)

scale2x scaling of 64x64 BeOS icons in Tracker

Reported by: jscipione Owned by: stippi
Priority: normal Milestone: R1
Component: Applications/Tracker Version: R1/Development
Keywords: Cc:
Blocked By: Blocking:
Platform: All

Description

I used the scale2x algorithm described here:

http://scale2x.sourceforge.net

to scale old BeOS icons from 32x32 to 64x64 pixels at a higher quality than the default bilinear scaling that is currently being employed. This only works for 64x64 icons right now. The scale2x scaling makes the icons look less fuzzy. If bitmap down-scaling were implemented than other sizes could also benefit from this new algorithm. Screenshot and patch attached. The code I used is derived from the public domain SDL version of the algorithm by since the C version is licensed GPL which is incompatible with the MIT license.

Attachments (7)

scale2x 64x64 BeOS icons.png (92.5 KB ) - added by jscipione 13 years ago.
scale2x scaling of BeOS icons
bilinear 64x64 BeOS icons.png (221.5 KB ) - added by jscipione 13 years ago.
bilinear scaling of BeOS icons
scale2x icon scaling.diff (4.3 KB ) - added by jscipione 13 years ago.
scale2x BeOS icon scaling patch
scale2x icon scaling 2.diff (4.3 KB ) - added by jscipione 13 years ago.
patch with variables declared inline, fixed a style issue
scale2x icon scaling 3.diff (3.1 KB ) - added by jscipione 13 years ago.
Assume both src and dst have 4 BPP, remove the case statement. Tiny style fix
scaled_icon.png (46.6 KB ) - added by diver 13 years ago.
scalers.png (3.8 KB ) - added by mr.Noisy 13 years ago.
Comparsion for scale2x and hqx.

Download all attachments as: .zip

Change History (19)

by jscipione, 13 years ago

scale2x scaling of BeOS icons

by jscipione, 13 years ago

bilinear scaling of BeOS icons

by jscipione, 13 years ago

Attachment: scale2x icon scaling.diff added

scale2x BeOS icon scaling patch

comment:1 by jscipione, 13 years ago

patch: 01

comment:2 by stippi, 13 years ago

Somehow it does look better, fully agreed. The patch is already pretty good, I would further C++-ify it (declare variables where they appear first, at least the loop variables, but maybe also the others after measuring the time and confirming the compiler doesn't screw things up). And the variables should be lowercased as well.

Thanks for the work and research you've put into this!

comment:3 by jscipione, 13 years ago

'scale2x icon scaling 2.diff' lowercases the variables and declares them inline C++ style.

comment:4 by stippi, 13 years ago

That looks good now, thanks! Just to confirm, have you checked the speed before and after moving the variable declarations into the loop?

comment:5 by jscipione, 13 years ago

No I have not checked the speed other than doing a cursory test to see if the speed was "good enough". There are many optimizations that could be made to the code, but since icon sizing only happens infrequently in response to a user action, and the speed is pretty good already, I don't see the need for any more optimization. How would you recommend I measure the speed difference?

by jscipione, 13 years ago

Attachment: scale2x icon scaling 2.diff added

patch with variables declared inline, fixed a style issue

by jscipione, 13 years ago

Attachment: scale2x icon scaling 3.diff added

Assume both src and dst have 4 BPP, remove the case statement. Tiny style fix

comment:6 by stippi, 13 years ago

Owner: changed from axeld to stippi
Status: newin-progress

by diver, 13 years ago

Attachment: scaled_icon.png added

comment:7 by stippi, 13 years ago

This is unfortunately expected. The scale2x algorithm works only for exactly 2x scales. Since this is cosmetical all the way, I wouldn't consider it a high priority problem.

comment:8 by diver, 13 years ago

Ahh, thanks.

by mr.Noisy, 13 years ago

Attachment: scalers.png added

Comparsion for scale2x and hqx.

comment:9 by stippi, 13 years ago

That HQX is better was already known, in fact it was used in the original patch IIRC. But we can't use it for licensing reasons. The preferred way is to create vector icons for everything, including 3rd party apps. And there are lots of icon packs aroundd which accomplish this to a great extend.

comment:10 by jscipione, 13 years ago

Licensing was not the issue, the HQX library is LGPL which would have worked. However, I actually implemented the HQX library first but I found that the anti-aliasing made some of the icons too cartoony. The scale2x library, while it doesn't smooth the edges as much as HQX gives a more faithful reproduction of the icon while making it look sharper. I may be able to find a screenshot of the HQX scaling I did somewhere. The other problem I had with HQX is that it didn't work with transparency. Although I believe that that issue could probably be gotten around somehow, the cartoony-ness of the icons could not.

comment:11 by jscipione, 13 years ago

I tried my hardest and I cannot find the screen shots of BeOS icons using the HQX algorithm but let me assure you that if I had found them they would not be very impressive. Transparency didn't work and the icons were cartoonist because of the anti-aliasing. Scale2x was the right choice. The patch has been applied, can we close this ticket?

comment:12 by stippi, 13 years ago

Resolution: fixed
Status: in-progressclosed

Yes.

Note: See TracTickets for help on using tickets.