联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-23:00
  • 微信:codinghelp

您当前位置:首页 >> Java编程Java编程

日期:2021-02-20 11:04

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


版权所有:留学生编程辅导网 2020 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp