Skip to content

Instantly share code, notes, and snippets.

@egonny
Created June 3, 2016 16:08
Show Gist options
  • Save egonny/c6929045ba40aa3595cb08cbeba1aa71 to your computer and use it in GitHub Desktop.
Save egonny/c6929045ba40aa3595cb08cbeba1aa71 to your computer and use it in GitHub Desktop.
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
public class FPIconParser {
public static void main(String[] args) throws IOException {
String decompressed = LZString.decompressFromUTF16("埐\u037Fᒌ偔瞊㐭࠹៸ⓑ䭆އ䶗ⵆ咨桺ଇ\u1289᷃濅䟷媋矹\u061Dᾜ栀\u1CA2ᑸဠ ");
char[] pixels = decompressed.toCharArray();
BufferedImage image = new BufferedImage(16, 16, BufferedImage.TYPE_INT_RGB);
for (int x = 0; x < 16; x++) {
for (int y = 0; y < 16; y++) {
image.setRGB(x, y, charToRGB(pixels[y * 16 + x]));
}
}
ImageIO.write(image, "png", new File("test.png"));
}
public static int charToRGB(char c) {
int r, g, b;
int rgb = ((int) c) - 1;
r = (int) Math.round(rgb % 10 * 25.6);
g = (int) Math.round((rgb / 10) % 10 * 25.6);
b = (int) Math.round((rgb / 100) % 10 * 25.6);
return r << 16 | g << 8 | b;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment