Skip to content

helloleonguan/comp2300-ass1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Assignnment 1

  • Name : Liyang(Leon) Guan

  • Uni ID : u5684206

Summary of program's functionalities

  • Display the help message
  • Print out the width and height of an image
  • Apply a threshold filter
  • Crop the image

How to compile or run

1. Compile

  • $ gcc -Wall -o bmpedit bmpedit.c
    OR
  • $ make bmpedit (if there is a Makefile in the same directory)

2. Run

(The order of the list corresponds to the summary of functionalities)

  • $ ./bmpedit -h
  • $ ./bmpedit [file]
    e.g. $ ./bmpedit cup.bmp
  • $ ./bmpedit -t [thredhold value] -o [output_file]
    e.g. $ ./bmpedit -t 0.5 -o cupth.bmp OR $ ./bmpedit -t 0.5 (by default output file is out.bmp)
  • $ ./bmpedit -c [originX] [originY] [width] [height] -o [output_file]
    e.g. $ ./bmpedit -c 100 100 100 100 -o crop.bmp OR $ ./bmpedit -c 100 100 100 100 (by default output file is out.bmp)

Testing

1. help message

Help msg

2. print out width and height

size1

__It is the actual size of ["water.bmp"](img/water.bmp).__

size2

__It is the actual size of ["cup.bmp"](cup.bmp).__

3. apply a threshold

4. crop the image

What makes my extensions deserve a higher mark

  • The extension part is neat and clean.
  • I took a straightforward approach with an adequate amount of comments.
  • It worked for different padding sizes.
  • It throws error message if the input values are illegal.

Limitations and Improvements

  • I used an int indicator to go through the image file. If the image file is bigger than the MAXIMUM value of an int, then my program might not work properly. Maybe I can dynamically allocate another int variable if the current one has reached its limit next time.
  • I used high level abstractive functions like fwrite() and fopen(). Next time, I will try to use low level system calls like open() and write() to make the program more unix-based when handling files.
  • I did not handle most of the user input errors in this program. I will definitely improve the error handling issue next time.

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors