Results 1 to 1 of 1
- 03-20-2011, 08:33 AM #1
Member
- Join Date
- Mar 2011
- Location
- Bulacan, Philippines
- Posts
- 23
- Rep Power
- 0
Help me Converting jar to jpg and jpg to jar
hello to everyone
im making this simple app that will convert jar file to jpeg picture and jpeg to jar file. i already created all necessary method but i do have problem with jpeg to jar.
this my method to create a single pixel color of one character
and this is for converting rgb to char codeJava Code:private Color createPixel(int x) { Color c = null; int r = 0, g = 0, b = 0; int t = x / 255; if (t > 255) { b = 255; g = ((t % 255) * 255) + x % 255; if (g > 255) { r = g % 255; g = g / 255; } else { } } else { if (t < 255) { r = x % 255; g = x/255; } } return new Color(r, g, b); }
but when i run my app. the character on the original is not equal to the converted characterJava Code:for (int y = 0; y < image.getHeight(); y++) { for (int x = 0; x < image.getWidth(); x++) { total = 0; int c = image.getRGB(x, y); r = (c & 0x00ff0000) >> 16; g = (c & 0x0000ff00) >> 8; b = c & 0x000000ff; if (r == 255 && g == 255 && b == 255) { System.out.println("end"); y = image.getHeight(); break; } else { if (r > 0) { total += r; } if (g > 0) { total += g * 255; } if (b == 255) { total += 255 * 255; } else { total += b; }
example is : þÊ is become ??
the only problem is when the char code is greather than 60000 other char code are correct.
hope someone can help me..Last edited by nap_patague; 03-20-2011 at 09:07 AM.
Similar Threads
-
converting hex to dec -
By Symbiot in forum New To JavaReplies: 3Last Post: 05-27-2010, 01:56 PM -
need help converting
By sr20guy in forum New To JavaReplies: 16Last Post: 04-02-2010, 01:07 PM -
Converting to String
By darek9576 in forum New To JavaReplies: 1Last Post: 03-13-2010, 10:07 PM -
Converting URL to URI
By Java Tip in forum Java TipReplies: 0Last Post: 12-26-2007, 10:15 AM -
help with converting to JApplet
By Simmy in forum AWT / SwingReplies: 2Last Post: 08-09-2007, 08:45 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks