开发者

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

开发者 https://www.devze.com 2023-03-03 02:52 出处:网络
This question already has answers here: 开发者_运维百科Closed 11 years ago. Possible Duplicate: how to convert image to byte array in java?
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

精彩评论

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