Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

image processing with jpeg in j2me

 
sankar ganesh
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
i'm displaying a jpeg image from the resoruce file.also i want to make it as a black and white or negative image after loading it into the form.simply saying i want to some image processing with that image.i display that image in canvas and trying to do this.can anyone help me to do the imageprocessing .i'am unclear to use the getRGB of method with that.if any one have sample code for imageprocessing in jpeg then please help me with that.and also tell me how to calculate scalength and offset for using getRGB method
thanx in advance
laxmi
 
Maddi Ranjan
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know what kind of image processing you required. If you wnat to draw some text on the image then first draw the image on the screen and then draw the string on same canvas on appropiate position, If u marge some tow or more image then u need to water mark process and I think it best to in use server side then display on canvas.

And getRGB method return the image RGB pixels array, u can also place ur pixcel but for this u need to some difficult calculation... using pixel matrix .The getRGB method only work for MIDP 2.0 device

You can also use setGrayScale(int) to draw an image in white or black
[ June 23, 2005: Message edited by: Maddi Ranjan ]
 
sankar ganesh
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank u friend,
if u don't mind can u give me a sample code to use setgrayscale method with image i have drawn in the canvas.here i attach my codings also

}//constructor
public void paint(Graphics g)
{
try {
// create an off screen image
g.setColor(255,255,255);
g.fillRect(0,0,getWidth(),getHeight());
Image offImg = Image.createImage(20, 20);
Graphics offGrap = offImg.getGraphics();
offGrap.setColor(0,0,0);
Image dukeImg = Image.createImage("/up.gif");
offGrap.drawImage(dukeImg, 0,0,0);
g.drawImage(offImg, getWidth()/2 +10,getHeight()/2 +10 ,Graphics.HCENTER | Graphics.TOP);


thanx in advance
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic