Fill in Order Details

  • Submit paper details for free using our simple order form

Make Payment Securely

  • Add funds to your account. There are no upfront payments. The writer will only be paid once you have approved your paper

Writing Process

  • The best qualified expert writer is assigned to work on your order
  • Your paper is written to standard and delivered as per your instructions

Download your paper

  • Download the completed paper from your online account or your email
  • You can request a plagiarism and quality report along with your paper

how to do this python project

Overview: In this project, you will be creating code to compress and decompress image files.

Goal: To gain experience with compression algorithms.

Requirements: You are going to implement a compression algorithm in Python 3.x. You have been

given a set of example images and your goal is to compress them as much as possible without losing any

perceptible information – upon decompression they should appear identical to the original images.

Images are essentially stored as a series of points of color, where each point is represented as a

combination of red, green and blue (rgb). Each component of the rgb value ranges between 0-255, so

for example: (100, 0, 200) would represent a shade of purple. Using a fixed length encoding, each

component of the rgb value requires 8 bits to encode (28 = 256) meaning that the entire rgb value

requires 24 bits to encode. You could use a compression algorithm like Huffman encoding to reduce the

number of bits needed for more common values and thereby reduce the total number of bits needed to

encode your image.

You can use the Pillow library of Python to read in image files and extract the rgb values of individual

points. To install the library in PyCharm, go to Project Settings -> Project Interpreter. To the right of the

list of packages will be a small + sign. Click on it to open up the window of available packages and search

for Pillow – since there are several similarly named libraries, you want the one written by Alex Clark and

its full name should be Python Imaging Library (Fork). Then click on Install Package. (It’s possible you

may get an error if you have an older version of pip installed – it would be listed on the prior page of

installed packages. If the error occurs, first install the latest version of pip, then install Pillow.)

Once you have Pillow installed, you can include the library into your project code with:

from PIL import Image

You can then open image files using, for example:

img = Image.open(“powercat.bmp”)

If you wanted to display the image in your standard image viewer, you could use:

img.show()

If you want to access the pixel values of points in an image, you’ll first need to call load() to create a

pixel access object and then you can access individual pixels using list notation:

width, height = img.size

px = img.load()

for x in range(width):

for y in range(height):

print(px[x,y])

Your code should read in an image file, compute how many bits are required for a fixed length encoding

and then apply a compression algorithm to create a smaller encoding – you need to implement the

compression, you cannot use a compression library. You should output how many bits are required to

store the image in your compressed format as well as the compression ratio achieved. When it comes

to saving your compressed image, you won’t be able to save it as a standard image format, since you will

have created your own encoding, but you can save the sequence of bits into a text or binary file.

Your code should also be able to prompt the user for the filename of a text file containing a compressed

sequence of bits and then decompress that file into the original image – you can assume that the file

uses the same compression format as the last file you compressed. So, for example, if you compressed

pacificat.bmp into a series of bits stored in pacificat.txt and then the user asked you to decompress

alt_pacificat.txt, you could assume that alt_pacificat.txt used the same compression data structure as

pacificat.txt (it might be a subset of the data from the original image, for example).

There are a number of libraries that can help you store formatted data into a file from Python. If you

research the options and find a way to store your compression data structure into a file, such that the

user can select both a bit file and a data structure file and use the data structure to decompress the bit

file, then you can earn an extra half point on the rubric.

Your code should compute the following statistics each time the compression code is called on a file:

ï‚· Runtime in milliseconds of the compression process, including any time needed to create the

data structures used to help with the compression process.

ï‚· Number of bits needed by your algorithm to encode the contents of the file.

ï‚· Number of bits needed by a fixed length encoding to encode the contents of the file.

ï‚· The compression ratio achieved.

For the decompression process, you only need to track the runtime in milliseconds.

Algorithm: In addition to your code, you need to turn in a well-formatted document containing the

pseudo-code for your core algorithm (written in the same format as the textbook uses for pseudo-code)

along with any proofs you decide to include about your algorithm – see grading section below.

WHAT OUR CURRENT CUSTOMERS SAY

  • Google
  • Sitejabber
  • Trustpilot
Zahraa S
Zahraa S
Absolutely spot on. I have had the best experience with Elite Academic Research and all my work have scored highly. Thank you for your professionalism and using expert writers with vast and outstanding knowledge in their fields. I highly recommend any day and time.
Stuart L
Stuart L
Thanks for keeping me sane for getting everything out of the way, I’ve been stuck working more than full time and balancing the rest but I’m glad you’ve been ensuring my school work is taken care of. I'll recommend Elite Academic Research to anyone who seeks quality academic help, thank you so much!
Mindi D
Mindi D
Brilliant writers and awesome support team. You can tell by the depth of research and the quality of work delivered that the writers care deeply about delivering that perfect grade.
Samuel Y
Samuel Y
I really appreciate the work all your amazing writers do to ensure that my papers are always delivered on time and always of the highest quality. I was at a crossroads last semester and I almost dropped out of school because of the many issues that were bombarding but I am glad a friend referred me to you guys. You came up big for me and continue to do so. I just wish I knew about your services earlier.
Cindy L
Cindy L
You can't fault the paper quality and speed of delivery. I have been using these guys for the past 3 years and I not even once have they ever failed me. They deliver properly researched papers way ahead of time. Each time I think I have had the best their professional writers surprise me with even better quality work. Elite Academic Research is a true Gem among essay writing companies.
Got an A and plagiarism percent was less than 10%! Thanks!

ORDER NOW


Consider Your Assignments Done

“All my friends and I are getting help from eliteacademicresearch. It’s every college student’s best kept secret!”

Jermaine Byrant
BSN

“I was apprehensive at first. But I must say it was a great experience and well worth the price. I got an A!”

Nicole Johnson
Finance & Economics

Our Top Experts

See Why Our Clients Hire Us Again And Again!


OVER

10.3k
Reviews

RATING
4.89/5
Average

YEARS
13
Mastery

Success Guarantee

When you order form the best, some of your greatest problems as a student are solved!

Reliable

Professional

Affordable

Quick

Using this writing service is legal and is not prohibited by any law, university or college policies. Services of Elite Academic Research are provided for research and study purposes only with the intent to help students improve their writing and academic experience. We do not condone or encourage cheating, academic dishonesty, or any form of plagiarism. Our original, plagiarism-free, zero-AI expert samples should only be used as references. It is your responsibility to cite any outside sources appropriately. This service will be useful for students looking for quick, reliable, and efficient online class-help on a variety of topics.