Tuesday, December 18, 2007

Displaying Images as a Thumbnails on wireless devices in J2ME

You can display your image as a thumbnail on your mobile device. The process is simple you just have to specify the width and height of your thumbnail and the code below will create a thumbnail of your image for you

public static Image getThumbnail (Image src, int dstW, int dstH)
{
int srcW = src.getWidth();
int srcH = src.getHeight();

Image tmp = Image.createImage(dstW, srcH);
Graphics g = tmp.getGraphics();

int delta = (srcW << pos =" delta/2;" x =" 0;">> 16), 0, Graphics.LEFT |
Graphics.TOP );
pos += delta;
}

Image dst = Image.createImage(dstW, dstH);
g = dst.getGraphics();

delta = (srcH << pos =" delta/2;" y =" 0;">> 16), Graphics.LEFT |
Graphics.TOP );
pos += delta;
}

return dst;
}

Anee queztyunzzz?


I went waaaaay back in the archives for this one (you can tell by the funky signature and lack of a border). I dedicate this to everyone out there who is trying to act normal while being really out of it, either because A. You took cold medicine or B. You didn't take cold medicine. Let's face it - modern life does not allow the common cold. There isn't time for it.
So here's to everybody out there who's just kind of making it through the day, doing whatever you're supposed to be doing, hearing the thud-thud of your feet hitting the ground from some echo chamber inside your head, ignoring the ringing in your ears, or hoping you brought enough tissue for the commute home. Hang in there.

Blog Archive