辅导data编程、讲解Python,c++,Java程序 辅导留学生 Statistics统计、回归、迭代|讲解Database

- 首页 >> C/C++编程
Version 1.00
Assignment 01
GIF Image Viewer
Deadline: 4 PM on Friday 19 February 2021
Submission procedure: Submit only one file labelled a1.cpp on blackboard (via TurnItIn)
Description
The Graphics Interchange Format (GIF) image file is widely used to store, send, and display
images on a computer. It is known for compressing files into a smaller size without losing any
image quality. We call this lossless compression.
In this assignment, we ask that you open a GIF file and display its contents onto the console.
The official GIF documentation is on blackboard (spec-gif89a.txt) or at
https://www.w3.org/Graphics/GIF/spec-gif87.txt. More information and guidelines may be
found on different websites. This is a real-world assignment, meaning that you are working on a
practical problem. We expect that all students will use the internet and textbook resources to
learn concepts needed for this assignment, which may have not been tested in the drills.
Code your program to display GIF IMAGE VIEWER at the start of the program. Then ask the
user to Enter file name:. You should then open the file using the fstream data type.
Using the fstream data type, read each section of the file, including the header, logical screen
descriptor, global color table, image descriptor, table-based image data, and trailer. You do not
need to implement the comment extension, plain text extension, or application extension
sections; if they are present in a file, skip them.
Each section of the GIF file must be decoded according to the GIF documentation. Based on
the described format, read the file and display its contents in an organised manner (see Example
Program Output). As you enter each section of the GIF file, display that you have identified the
section (e.g., ">> read header") and then proceed with reading its specific contents and
displaying it on the console.
When you reach the Table Based Image data, you will need to extract the image from the LZW
data compression format, which has been slightly modified for use in GIF. The algorithm is well
described on different websites:
https://www.w3.org/Graphics/GIF/spec-gif89a.txt
https://en.wikipedia.org/wiki/GIF
http://giflib.sourceforge.net/whatsinagif/index.html
Once you have extracted the image data, display its indices; and then its red, green, and blue
pixel values. Your objective is to reproduce the Program Output shown on the next page.
Comments on marking
We award marks for understanding different aspects of coding. So, even if your code does not
compile or you have not proceeded far into the assignment, you may still get good marks. So,
submit what you have done by the deadline.
When discussing programming with others, never send or receive code from another person if it
is specifically designed for this assignment. Instead, discuss syntax, mechanics, and how to
approach the problem.
Version 1.00
Program Output
GIF IMAGE VIEWER
Enter file name:
squares.gif
>> read header
Header:
signature: GIF
version: 87a
>> read logical screen descriptor
Logical Screen Descriptor:
width: 10
height: 10
global ct flag: 1
color res: 2
sort flag: 0
global ct size: 1
background color i: 0
aspect ratio: 0
>> read global color table
Global Color Table:
#0 255 255 255
#1 255 0 0
#2 0 0 255
#3 0 255 0
>> read image descriptor
Image Data - Red Channel
255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 0 0 0 0 255
255 255 255 255 255 0 0 0 0 255
255 255 255 255 255 0 0 0 0 255
255 255 255 255 255 0 0 0 0 255
255 0 0 0 0 255 255 255 255 255
255 0 0 0 0 255 255 255 255 255
255 0 0 0 0 255 255 255 255 255
255 0 0 0 0 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255
Image Data - Green Channel
255 255 255 255 255 255 255 255 255 255
255 0 0 0 0 0 0 0 0 255
255 0 0 0 0 0 0 0 0 255
255 0 0 0 0 0 0 0 0 255
255 0 0 0 0 0 0 0 0 255
255 255 255 255 255 0 0 0 0 255
255 255 255 255 255 0 0 0 0 255
255 255 255 255 255 0 0 0 0 255
255 255 255 255 255 0 0 0 0 255
255 255 255 255 255 255 255 255 255 255
Image Data - Blue Channel
255 255 255 255 255 255 255 255 255 255
255 0 0 0 0 255 255 255 255 255
255 0 0 0 0 255 255 255 255 255
255 0 0 0 0 255 255 255 255 255
255 0 0 0 0 255 255 255 255 255
255 0 0 0 0 0 0 0 0 255
255 0 0 0 0 0 0 0 0 255
Version 1.00
255 0 0 0 0 0 0 0 0 255
255 0 0 0 0 0 0 0 0 255
255 255 255 255 255 255 255 255 255 255
>> read trailer
>> program ended

站长地图