VVBVBVBB
VVBVBVBB
VVBVBVBB
1.2 Definitions
1
1.2.1 Definition: Image
2
1.2.3 Definition: BMP (File Format)
• The Windows DIB (device Independent Bitmap or BMP) format is the
most common file format used with Windows. DIB files may be
monochrome, color-mapped with 16or 256 colors or they may be of
24 bit true colored. They may also be stored in either an
uncompressed format or with run length encoded (RLE) format. They
are rarely supported by software on other Operating system. So they
are not suitable for porting image between platforms.
3
1.2.4 Definition: Compression and Decompression:
• Image compression is the process of reducing the size of image files
by methods such as abbreviating repeated information or eliminating
information which is difficult for the human eye to detect.
• Compressed images require low bandwidth and can be transferred
quickly hence they are convenient and economic.
• Compression Techniques are of two types:
1. Lossless Compression Techniques: It reduces the storage space
required for an image without the loss of data i.e. it abbreviates the
repeated information. If an image has undergone lossless compression
then it is possible to get back the original image by decompression.
Typically it reduces the storage space by 50%.
2. Lossy Compression Techniques: It reduces the storage space
required by an image by eliminating the information that is difficult
for the human eye to detect. If an image has undergone lossy
compression then it is not possible to get back the original image
though the change will be imperceptible to the human eye. It has a
better compression ratio than lossless compression.
• The opposite process of compression is decompression.
4
Different Types of Compression Techniques:
5
1.3.1 Steps Involved:
1. Problem Identification.
2. Feasibility Study.
3. Requirement Analysis and Specification.
4. Design.
5. Coding and Unit Testing.
6. Integration and System Testing.
7. Maintenance.
6
Chapter2
Problem Identification
One of the most difficult tasks of system analysis is identifying the real
problems of the proposed or of the existing system.
Problems:
1. Large storage space is required for storing images especially of
higher resolutions.
2. Large bandwidth is required for sending uncompressed images over
any network (like LANs, WANs and Internet).
Expected Solutions:
1. The large sized images can be compressed and stored thus effectively
and efficiently utilizing the memory of the computing system.
2. The compressed image when required can be decompressed and
viewed.
7
Chapter3
Feasibility Study
Feasibility study helps to determine the possibility and probability of either
improving the existing system or developing completely a new system
nonexistent before.
IMAGE PRO is a brand new system which is being developed and
implemented.
Recurring Cost:
Minimum will be incurred as recurring cost (for maintenance) as it can be
easily maintained by introducing the required changes in the user defined
header files.
8
Chapter4
Requirement Analysis and
Specification
The aim of requirement analysis and specification phase is to understand the
exact requirements of the customers and to document them properly.
IMAGE PRO is aimed to be used for the purpose of simple
compression and decompression of uncompressed BMP image. IMAGE
PRO will be used by end users on standalone PC. It must be able to
compress the uncompressed BMP images/primitive BMP images effectively
and efficiently for the purpose of storage and decompress them to get back
the original ones
9
4.2.1 System Requirement Specification (SRS):
4.2.1.1 Introduction:
• Scope: IMAGE PRO can be applied for the bitmap of 24 bits and
generated by paint applications but its jurisdiction can be extended by
adding new features. Thus IMAGE PRO is flexible.
Peripheral: (Optional)
• Printer (required, if the user wants to take the printout of
the image. This is fully optional).
10
• Removable Storage Device (for some disc-less computer,
or also for computers with the disc support, the user may
need to store the compressed as well as the decompressed
image in the removable drive, if the person wants to carry
the compressed data or the decompressed image with
self).
• Network (as mention earlier, the large image can be send
through the network by only sending the compressed
data, for the same, we need network connections).
People:
This s/w or the program package is developed with a simple
UI (Developed using C-graphics in most simply way) so
that, a novice with minimum knowledge to use the computer
can use this program, to compress and decompress image.
• Dependencies:
Minimum Hardware Requirements:
• Any Windows or MS DOS based Operating System
(Windows 98, Windows XP etc.).
• 16 bit processor (minimum).
• Minimum 8 MB RAM (Recommended 16 MB).
• Minimum 10MB free hard disk space.
• CD ROM Drive or Floppy Drive for installation of
IMAGE PRO.
• IMAGE PRO is portable and can be run from any
removable drive.
Software requirements:
• Language used: C.
• Compiler: Turbo C V3.0 with BGI graphics support.
• Input Image Format: bmp.
11
4.2.1.3 Functional Requirements:
Description: The COMPRESS function takes the input from the user as the
name of the original BMP image along with the appropriate path. It then
creates 2 empty files namely tmp_char.cpr and tmp_indx.cpr. It fetches the
ASCII values of each unrepeated pixel of the original BMP image and stores
them in the tmp_char.cpr file. It stores the position of a pixel and the
number of repetitions of a pixel in tmp_indx.cpr file.
R1.1: Compress:
Input: The name of the original BMP image with appropriate path.
Processing: It opens the file provide by the user as input and creating two
more empty files (tmp_char.cpr, tmp_indx.cpr).
R1.2: Rle:
Input: The reference of the 3 files (the original BMP image, tmp_char.cpr,
tmp_indx.cpr).
12
repetitions in the proper order in the final BMP image file, finl_img.bmp.
this is the decompressed image.
R2.1: Decompress:
R2.2: Rle_op:
Maintainability:
IMAGE PRO is easy to maintain as it can be easily updated by simply
updating the user-defined header files.
13
Portability:
IMAGE PRO is easily portable from one platform to another by changing
certain commands and hence it can be easily made platform independent.
Usability:
IMAGE PRO is extremely user-friendly, simple and easy to use.
Reliability:
IMAGE PRO is not very reliable as it is implemented using a procedural
language and very basic implementation techniques.
Accuracy of result:
System Implementation:
At Present it is meant to run under any Windows environment.
14
Chapter5
Design
The goal of the design phase is to transform the requirements specified in
the SRS document into a structure that is suitable for implementation in
some programming language.
Program code:
15
fprintf(fp2,"%ld %d\n",char_pt,count);
putc(temp,fp1);
char_pt++;
}
else
{
while((count--)>0)
{
putc(temp,fp1);
char_pt++;
}
}
Count=0;
}
}
}
Algorithm:
1 for i 0 to SIZE
2 if count = 0
3 temp A[i]
4 if temp = A[i] and i < SIZE
5 count count + 1
6 else
7 if i > SIZE
8 i i–1
16
9 if count > 3
10 Values of char_pt and count are inserted into file pointed by FP2
respectively leaving a space between them.
11 Value of temp is inserted into the file pointed by FP1.
12 char_pt char_pt + 1
13 else
14 while count > 0
15 count count – 1
16 Value of temp is inserted into the file pointed by FP1.
17 char_pt char_pt + 1
18 count 0
Algorithm:
1 i 1
2 while End of file pointed by FS2 is not reached.
3 Numerical value of long integer type is read from file pointed by
FS2 and stored in a structure variable “pt.pos”.
4 Numerical value of integer type is read from file pointed by FS2
and stored in a structure variable “pt.count”.
17
5 while i < pt.pos
6 A character a read from the file pointed by FS1 and inserted in
the file pointed by FD.
7 i i+1
8 A character is read from FS1 and stored in a variable tmp.
10 for j 0 to pt.count
11 Value of tmp is inserted into the file pointed by FD.
12 i i+1
Characters: ABBBBBCCCAAAAAAASSAAAAA
File: TMP_INDX.CPR:
Position Repetition
-------- ---------
2 5
6 7
8 5
We are not considering the characters which are repeated 3times or less
to calculate their count and we are directly copying them in TMP_
18
CHAR.CPR file. It takes 4bytes to point the repeated characters, and to save
3 consecutive characters in the TMP_CHAR.CPR it will take 3bytes.
In the actual RLE, the original file gets much more compressed than
in ours. Here we are not using any special character, instead we are using
two files, because, an image file uses all the 255 ASCII character as the
image information, so all the characters can appear as the image data, and it
will be difficult for us to distinguish the special characters from image data.
19