i'm buiding an image class, but i need some information...
the C\C++ teach how read binary\text files... but not how the files are build like JPEG, PNG, GIF and others :(
i can't find a page for give me the file struture and when i found it, i only see hexadecimal values and it's confused for me :(
can anyone advice me?

Recommended Answers

All 6 Replies

Reading binary image files and getting the data from them is not simple. For some formats, like JPG, it's really not simple. Unless you're doing this because you really want to know baout how the information is stored in the file formats, just use an image library. It's what everyone except the person who writes the image library does.

so how can i read some images files with C\C++ using IDE diferent from Visual Studio?

It's got nothing to do with your IDE. Your IDE is just a way to use the tools.

You need an image library.

Many image libraries will come with header files that you must #include, and a compiled library that you must link against. That's how to do it.

Pick a library, download it, #include the right headers, link against the library.

If this is the first time you have used a library, I suggest you start simple. There is one image library (CImg) that doesn't even use a compiled binary library. It is just a single header file that you must #include, and that's it.

yah.. i even can't use the boost library :)
thanks for all... maybe i can 'install' the CImg on pc ;)
thanks for all

You need an image library.

You don't need one, but it's strongly recommended given that image processing is rather complex. ;)

A good and simple image loading / saving library is FreeImage. For more complex tasks, you can use libraries like ImageMagick, or even OpenCV. There are also some limited amount of built-in support from OS API functions, like Win32 API for BMP images, but that is usually too limited to be useful. And if you are using some GUI library, they usually come with some image loading / saving / drawing capabilities too.

how the files are build like JPEG, PNG, GIF and others :(

Those files are special file formats that are specified in standard documents or other similar documents. Writing code to read or write such file formats is a very tedious process because you have to follow those specifications to the letter and handle every detail of the file, as well as implementing whatever compression or encoding the file format uses, which is not trivial. If looking at one of those specification documents has confused you, it's totally normal, these are documents that are tedious and hard to understand, because every detail has to be precisely defined, byte for byte.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.