开发者

Need help converting a picture in byte in java [duplicate]

This question already has answers here: 开发者_运维百科Closed 11 years ago.

Possible Duplicate:

how to convert image to byte array in java?

Hi,

Can anybody help me convert a picture to byte array in java?

thank you


Point a File object to your picture location and then use a Scanner to read every byte. Something like:

int count=0; File f = File("path"); Scanner sc = new Scanner(f);

while(sc.hasNextByte()) { your_array[count] = sc.nextByte(); count++; }

I didnt test this so dont trust me on everything

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜