From the course: Exploring C Libraries

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Reading and writing JPEG images

Reading and writing JPEG images - C Tutorial

From the course: Exploring C Libraries

Start my 1-month free trial

Reading and writing JPEG images

- [Instructor] Even with a lib jpeg library available, reading and writing a jpeg image is a complex task involving lots of variables, configuration, and process. So it helps to break everything down into steps. This code reads the sample jpeg file 05-02-image.1, which is specified at line seven. It decompresses the image data and then stores it in memory. Now the seven steps to reading a jpeg file are: Number one, open the input file at line 16, which is just standard C code. Number two at line 26 is to configure the dcinfo structure for decompression. Number three at line 35 is to decompress the file, which is done by the jpeg_start_decompress function. Next at line 38, some information about the image is gathered and output. At line 46, a data structure is created to hold the raw image data read from the decompressed image file. At line 58, the raw data is read and stored in the while loop. At this point you can…

Contents