Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (107)
games submitted by our members
Games in WIP (535)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Resizing sprite (x2)  (Read 2839 times)
0 Members and 1 Guest are viewing this topic.
Offline Bonbon-Chan

JGO Coder


Medals: 12



« Posted 2008-05-28 09:08:43 »

Hi,

I want to resize sprite (size x2). Right now, the aim is the quality over the speed.

A linear algorithme give a poor quality result, so I do some search and it seems that HQ2x is a good choise. I made a java version of HQ2x (darn what a big source  Shocked) but it was not mean to be use with alpha value. I did some modification but I still have problems. Another problem is that HQ2x create new colors.

If you have an idea of an algorithme that I can use.
Online kevglass

JGO Kernel


Medals: 120
Projects: 23
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #1 - Posted 2008-05-28 09:11:15 »

If you're working with game type sprites rather than images then Scale2X/3X has been pretty good to me in the past:

http://www.cokeandcode.com/scale2x/

Kev

Offline Bonbon-Chan

JGO Coder


Medals: 12



« Reply #2 - Posted 2008-05-28 16:26:33 »

Thanks for the link.

There's the result with the 4 methods :



Scale 2x is quite nice for me. May be there is a "more complet " method ? I will try to find out.

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline darkprophet

Senior Member




Go Go Gadget Arms


« Reply #3 - Posted 2008-05-28 19:48:18 »

I think HQ2x is more authentic to the original. Look at the knee caps of Scale2x and HQ2x...HQ2x has a nice gradient which is what the original picture is trying to show (as opposed to the white bit of the tail which is meant to be cartoony) whereas Scale2x has a cartoony knee cap...

Just my 2 pence Smiley

DP

Friends don't let friends make MMORPGs.

Blog | Volatile-Engine
Offline Bonbon-Chan

JGO Coder


Medals: 12



« Reply #4 - Posted 2008-05-29 09:02:30 »

I think that HQ2x is nicer too. But it has several disavantages to Scale2x :
- HQ2x may not have transparency (interpolation on alpha values)
- HQ2x generate color that are not in the original sprite (may be a probleme for indexed palette)

HQ2x is  under the  GNU Lesser General Public License by MaxSt. I really not use to licences... What should i do, if i want to provide the source code ? Only copying the header from the original source code ?
Offline CommanderKeith
« Reply #5 - Posted 2008-05-29 14:51:28 »

I have a set of sprites which need 2x scaling right now and I'd liek to use these tools but Scale2x doesn't work witrh alpha values - it makes them black pixels, and I don't know how to run HQ2x, the random exe I find doesn't start a GUI or anything.

It surprises me that java2d doesn't have a good filter for this kind of scaling - Bilinear looks so cloudy and and raw is too pixelated. I downloaded Paint.NET and its scaling only uses raw or bilinear which sux.

May I ask how you used Kev's Scale2x with alphas, like in the sample image you showed?

Cheers,
Keith

Offline Bonbon-Chan

JGO Coder


Medals: 12



« Reply #6 - Posted 2008-05-29 15:38:04 »

I didn't encounter any problem with Scale2x and alpha value.

For the image, it is take from my sprite sheet editor with one of my plugins  (Here's the source of the plugin for 2x scaling. It contains HQ2x and Scale2x. Both method need 2 TYPE_INT_ARGB BufferedImage as parameters)
Offline darkprophet

Senior Member




Go Go Gadget Arms


« Reply #7 - Posted 2008-05-30 19:04:39 »

The code is under GPL, but AFAIK, you cannot patent/put under license an algorithm. So if they have released the inner workings of the algorithm, then simply make your own...

DP Smiley

Friends don't let friends make MMORPGs.

Blog | Volatile-Engine
Offline CommanderKeith
« Reply #8 - Posted 2008-06-03 10:57:15 »

I didn't encounter any problem with Scale2x and alpha value.

For the image, it is take from my sprite sheet editor with one of my plugins  (Here's the source of the plugin for 2x scaling. It contains HQ2x and Scale2x. Both method need 2 TYPE_INT_ARGB BufferedImage as parameters)

Thanks heaps for that code, I used the scaling methods in a little app that popped a filechooser which allowed me to choose a directory and scale-up a whole directory full of images.

You're right about the scaling working on translucent images, it seems that it just doesn't work when you try to save the image as a gif using ImageIO (it works fine when you save it as a PNG).

Thanks again  Smiley
Keith


Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

pw (37 views)
2014-07-24 01:59:36

Riven (38 views)
2014-07-23 21:16:32

Riven (26 views)
2014-07-23 21:07:15

Riven (28 views)
2014-07-23 20:56:16

ctomni231 (58 views)
2014-07-18 06:55:21

Zero Volt (49 views)
2014-07-17 23:47:54

danieldean (41 views)
2014-07-17 23:41:23

MustardPeter (43 views)
2014-07-16 23:30:00

Cero (59 views)
2014-07-16 00:42:17

Riven (56 views)
2014-07-14 18:02:53
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!