最近写了一个关于j2me调用手机摄像头拍照的程序,开始在网上找了一段调用拍照的代码,其实就一个函数的事,getSnapshot(java.lang.String imageType)关于里面的参数,都一般是写null 文档上的解释是,null的话默认拍下来来的图片为png格式的,我测试过用流保存之后,把后缀改成.jpg的话,保存之后,在电脑上打开也是用png的方式打开的。要想转换成jpg的格式,就要从imageType这个参数下手了,但是网上关于imageType的参数不多,文档上也有一些解释,在模拟器上测试时,设置imageType="width=800&height=600",测试时,发现出错,改为null后测试出在模拟器(sun自带的wtk)上拍出的照片大小为160*120,那到n97上测试时,当imageType为null时,拍出的图片大小为640*480,那到5700上测试时,拍出的图片大小又不一样,是320*240,在n97上测试imageType="width=800&height=600"这个参数时没报错,可以拍出这大小的照片,根据一下列出的一些参数,还可以拍出其他的不同信息的图片,也可以加上参数imageType="encoding=jpeg&width=800&height=600",则可以拍出JPEG格式的图片,大家可以多试试其他的参数
video_encodings = video_enc_param *( "&" video_param )
video_enc_param = "encoding=" video_enc
video_enc = "gray8" / "rgb888" / "bgr888" /
"rgb565" / "rgb555" / "yuv444" /
"yuv422" / "yuv420" / "jpeg" / "png" /
content_type
video_param = "width=" width /
"height=" height /
"fps=" fps /
"colors=" colors /
"progressive=" progressive /
"interlaced=" interlaced /
"type=" video_type
width = pos_integer
height = pos_integer
fps = pos_number
quality = pos_integer
colors = "p" colors_in_palette /
= "rgb" r_bits g_bits b_bits /
= "gray" gray_bits
colors_in_palette = pos_integer
r_bits = pos_integer
g_bits = pos_integer
b_bits = pos_integer
gray_bits = pos_integer
progressive = boolean
video_type = jfif / exif / other_type
other_type = alphanumeric
interlaced = boolean
pos_number = 1*DIGIT [ "." 1*DIGIT ]
boolean = "true" / "false"
video_encodings = video_enc_param *( "&" video_param )
video_enc_param = "encoding=" video_enc
video_enc = "gray8" / "rgb888" / "bgr888" /
"rgb565" / "rgb555" / "yuv444" /
"yuv422" / "yuv420" / "jpeg" / "png" /
content_type
video_param = "width=" width /
"height=" height /
"fps=" fps /
"colors=" colors /
"progressive=" progressive /
"interlaced=" interlaced /
"type=" video_type
width = pos_integer
height = pos_integer
fps = pos_number
quality = pos_integer
colors = "p" colors_in_palette /
= "rgb" r_bits g_bits b_bits /
= "gray" gray_bits
colors_in_palette = pos_integer
r_bits = pos_integer
g_bits = pos_integer
b_bits = pos_integer
gray_bits = pos_integer
progressive = boolean
video_type = jfif / exif / other_type
other_type = alphanumeric
interlaced = boolean
pos_number = 1*DIGIT [ "." 1*DIGIT ]
boolean = "true" / "false"