I just recently started a project that involves a small amount of image handling, but, I am relatively new to programming (about 2 years). This project is for my senior project in college, so I'd rather not use a premade library for this, my goal is to learn as much as possible. So, what I'm looking for is some pointers to books/websites on how to learn image handling. Most of the sources I looked up assume some already pre-existing knowledge of image reading/handling, which didn't really work out too well, as I don't. And besides, they're more like *plunk* "Here's an image class, that's how it works." Which isn't really helpful to me. I just really need to learn it from scratch and build my own code.
So, any help I can possibly get would be wonderful!
Thanks. I'll look that over. I've been looking at a couple pages similar to it, though. The file formats that I'm most interested are bmp, tiff, and jpg (not so much this one, since the data needs to not be compressed). What I'm mainly concerned with is that they be lossless, and widely used, which is why I'd rather ignore jpg's. Right now, I suppose the part I'm having the most trouble with is how to actually read an image. I've tried the read() system call, and have also tried stream operators. However, each attempt has resulted in a lot of garbage being spat out (there's the possibility that I used read() wrong, but it had pretty much the exact same result as the streams)..
Why not do something original? If you don't want to use premade libs, than don't recreate them. Just make an sfml program that reads pixels and you define a saving format. Then have your program display and save those images in your format. And others if you so desire.
To read a file image use the standard fstream. When you read it in be sure to use the ios::binary flag.
Thank you for the help! The binary flag did improve things, but I think I'm still missing a couple of particular steps. I'm reading in the image as strings, and it's still spewing out garbage, but I am getting the initial characters "BM", and I can see where the header, and the image begin and end, but it's all represented as ridiculous characters. I've also tried to read it in as int's but it will just spew out all zeroes.
And the sfml is pretty much what I'm going for, I had just never heard the term before.
When you say you get garbage, you're just getting the ascii representation of that value. Simply output the actual value (cast to an int or ushort or whatever you want)