By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,798 Members | 1,343 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,798 IT Pros & Developers. It's quick & easy.


P: 1
Hi all.
I have a PGM file.
I am supposed to read in this file and find the pixel value for each pixel in the picture.

Currently, i am reading UNSIGNED bytes.

I got this function to covert it to integer.

public static int unsignedByteToInt(byte b) {
return (int) b & 0xFF;

Problem now is.
I am supposed to write to a new file with INTEGER values.
Same extension ( PGM )
Thus, am i supposed to write UNSIGNED bytes to it?
If so, is there anyway i can convert my INT to unsigned bytes?

Please advice.
Nov 18 '06 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.