Question
Hello I'm having trouble with an assignment that requires me to parse a .bmp file into a fixed packet size and then send the packets
Hello I'm having trouble with an assignment that requires me to parse a .bmp file into a fixed packet size and then send the packets to a server to be reassembled into the same .bmp in order to analyze packet loss. I don't need help with the actual networking portion of this assignment but i am confused as to how to reassemble the image into a .bmp again once i have a list of byte elements (all being the same size). I was instructed to write them to a file but an unable to find resources that do this to a bmp as i know how to do it to a text file but the point of the assignment is to examine the picture to see if pixels changed. I will put a snip of my code below and explain my thought process briefly.
This is the for loop i'm using the parse the file. I found the amount of iterations the loop would have to go through by taking the file size in bytes and dividing it by the size of the packets in bytes and then rounding it up to the nearest whole number due to the file size not being divisible by the packet size. the bytes should be in order as they are appended into the list l one after another.
What needs to be done:
Take the list l and reassemble it into a .bmp file that can be viewed as an image without using modules unless absolutely necessary. You can use any .bmp file even a tiny one just so i can understand the concept of how to do this process. Will upvote immediately if solution works. Thank you
foriinrange(0,iterations):file.seek(i1024)l.append(file.read(1024))Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started