1

我的手机中有一个代码,它可以拍照并将其保存到存储单元中。

我想添加功能以保存图片中包含拍摄日期的图像。

            byte[] capturedImageData = videoControl.getSnapshot("encoding=jpeg&width=2000&height=1500");
            String dirPhotos = "file:///e:/";

            m_suministro = TxtSuministro.getString();
            NombreFoto = m_suministro + "-" + ContadorFotos + ".jpg";

            String fileName = dirPhotos + NombreFoto;

            file = (FileConnection) Connector.open(fileName, Connector.READ_WRITE);
            // If there is no file then create it
            if (file.exists() == false) {
                file.create();
                ContadorFotos++;
            }
            // Write data received from camera while making snapshot to file
            outStream = file.openOutputStream();
            outStream.write(capturedImageData);

带有日期 在此处输入图像描述 tnx的示例图像

4

1 回答 1

1
//Using LWUIT lib, sames as native

//read image file into Image object
Image image = Image.creatImage(fileName);

//get Graphic object from your image
Graphic gImg = image.getGraphic();

//set color, or font, font size...etc
gImg.setColor(0xffffff);
...
//u can replace with other strings
int x = 0;
int y = image.getHeight() - g.getFont().getHeight();
gImg.drawString("07/02/2014 13:01", x, y);

//save your image into file, you need implenment save method
Image.saveImage(image);
于 2014-02-10T11:23:42.770 回答