 |
|
 |
View previous topic :: View next topic |
Author |
Topic : "[img'ish] maybe a bit differenent then the rest of the imgs" |
sharpe junior member
Member # Joined: 28 Dec 2000 Posts: 21 Location: London, England
|
Posted: Tue Jan 02, 2001 5:55 pm |
|
 |
I made a little java app that converts any jpg / gif from its original format.. into a html table...
its useless but kind of fun
the table is a huge load and a nice job for your web-browser to render..
but its fun. i think anyways..
original pic
Html-table version
------------------
- on top of the inbetween |
|
Back to top |
|
arniemg member
Member # Joined: 25 Dec 2000 Posts: 107 Location: Pensacola, FL, USA
|
Posted: Tue Jan 02, 2001 6:13 pm |
|
 |
cool. |
|
Back to top |
|
Visigoth Guest
Member #
|
Posted: Tue Jan 02, 2001 6:19 pm |
|
 |
I'd have to say, that's the most unique "conversion" utility that I've ever seen... Good job man...But...What's it for...? hehe
------------------
Your car is a fiberglass penis extension. |
|
Back to top |
|
Plop member
Member # Joined: 13 May 2000 Posts: 275 Location: Nowhereville
|
Posted: Tue Jan 02, 2001 6:30 pm |
|
 |
I wanted to make one for ages!
That is awsome. |
|
Back to top |
|
sharpe junior member
Member # Joined: 28 Dec 2000 Posts: 21 Location: London, England
|
Posted: Tue Jan 02, 2001 7:02 pm |
|
 |
code if you want.. off topic sorry..
code:
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.awt.image.PixelGrabber;
class Pic2Table extends Frame {
int cellSize = 125;
public int xx,yy;
public Image image1;
public static void main(String[] args) {
File dir;
String Filename;
Filename = args[0];
dir = new File(".");
new Pic2Table(dir,Filename);
}
Pic2Table(File dir, String filename ) {
if (filename.toLowerCase().endsWith(".gif")
| | filename.toLowerCase().endsWith(".jpg"))
{
Component c = new ImageViewer(getToolkit().getImage(dir.getAbsolutePath() + File.separator + filename), filename);
c.setSize(300,300);
}
}
}
class ImageViewer extends Frame {
Image image;
int blue,red,green,alpha;
Integer myint;
String mystring;
char readme;
BufferedWriter out;
BufferedReader in;
ImageViewer(Image image, String name) {
super("Dette bildet blir konvertert");
this.image = image;
addWindowListener(new WindowEventHandler());
pack();
show();
}
public void handlesinglepixel(int x, int y, int pixel,int width) {
alpha = (pixel >> 24) & 0xff;
red = (pixel >> 16) & 0xff;
green = (pixel >> 8) & 0xff;
blue = (pixel ) & 0xff;
try
{
if (x==width-1){out.write("</tr>");}if (x==width-1){out.write("<tr height=4>");}
out.write("<td width = 4 style =\"background :#");
mystring = myint.toHexString(red);
if (mystring.length() ==1){mystring = "0" + mystring;}
out.write(mystring);
mystring = myint.toHexString(green);
if (mystring.length() ==1){mystring = "0" + mystring;}
out.write(mystring);
mystring = myint.toHexString(blue);
if (mystring.length() ==1){mystring = "0" + mystring;}
out.write(mystring);
// int temp = in.read();
// if (temp ==10 | temp == 13 | temp == 0){temp=45;}
// readme=(char)temp;
out.write(";\">.</td>");
}
catch (IOException e) {}
}
public void handlepixels(Image img, int x, int y, int w, int h) {
int[] pixels = new int[w * h];
PixelGrabber pg = new PixelGrabber(img, x, y, w, h, pixels, 0, w);
try
{
out = new BufferedWriter(new FileWriter("image.html"));
in = new BufferedReader(new FileReader("main2.java"));
out.write("<style>TABLE {letter-spacing:-0.4em;line-height: 30%; size:7;}</style><body><table cellpadding = 0 cellspacing =0>");
}
catch (IOException e) {}
try
{
pg.grabPixels();
}
catch (InterruptedException e) {}
for (int j = 0; j < h; j++)
{
for (int i = 0; i < w; i++)
{
handlesinglepixel(i, j, pixels[j * w + i],w);
}
}
try
{
out.write("</table></body>");
out.close();
in.close();
}
catch (IOException e) {}
}
public void paint(Graphics g)
{
g.drawImage(image, getInsets().left, getInsets().top, this);
}
class WindowEventHandler extends WindowAdapter
{
public void windowClosing(WindowEvent evt)
{
handlepixels(image, 0, 0, image.getWidth(null), image.getHeight(null));
dispose();
}
}
}
------------------
- on top of the inbetween |
|
Back to top |
|
OkkE member
Member # Joined: 04 Dec 2000 Posts: 87 Location: the Netherlands
|
Posted: Wed Jan 03, 2001 5:38 am |
|
 |
Heh, cool.. but, umm.. what if i want to convert a pic that's 1600x1200 (72dpi).. hehe, then the HTML version would realy be huge, no?
Ahh well, it's a funny java-thing!  |
|
Back to top |
|
sharpe junior member
Member # Joined: 28 Dec 2000 Posts: 21 Location: London, England
|
Posted: Wed Jan 03, 2001 5:58 am |
|
 |
hehe , jeh the converted image would be huuuge. ofcourse its possible to make the table cells just 1px in size. then it would be the same size image wize. but file size would be hilarious..
its really just a complete waste of time... ;>
just something i tossed up over at the caribbean..
------------------
- on top of the inbetween |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
Powered by phpBB © 2005 phpBB Group
|