Find Jobs
Hire Freelancers

Simple C program read a PPM image from a file, invert the color of each pixel,write the new image to PPM file

$10-15 USD

Cancelled
Posted about 12 years ago

$10-15 USD

Paid on delivery
Simple program only using functions, 2d arrays and referencing. Nothing advances please no struct or anything higher level just a simple program. Below is a description. The attachments contains some design, sample input and output files There must be 3 two ­dimensional arrays that store the red, green, and blue components, respectively, of each pixel in the image. You may assume that the image will be no larger than 180 rows by 320 columns. There must be a function read_ppm_image that passes back three (3) two­dimensional arrays that will store the red, green, and blue components, respectively, of each pixel in the image, and also passes back the width (number of columns), height (number of rows), and maximum color value of the image. This function should ask the user for the name of an input file in PPM format, open this file, read the header information, then read the pixel information into the three arrays. ? There must be a function invert_image that receives and passes back 3 two ­dimensional arrays that store the red, green, and blue components, respectively, of each pixel in the image, and receives the number of rows, the number of columns, and the maximum color value of the image. This function should invert the color of each pixel. The inverted value of a pixel component is simply the component value subtracted from the maximum color value. For example, a red pixel (255, 0, 0) inverts to a cyan pixel (0, 255, 255). ## Deliverables Check that the file open succeeded, but if it does not, simply display an error message and exit the program using exit(1). Also, if the read in magic string is not "P3", an error message should be displayed and the program should exit. Attached is further minor details and some sample input and output please check it out.
Project ID: 2724810

About the project

2 proposals
Remote project
Active 12 yrs ago

Looking to make some money?

Benefits of bidding on Freelancer

Set your budget and timeframe
Get paid for your work
Outline your proposal
It's free to sign up and bid on jobs
2 freelancers are bidding on average $11 USD for this job
User Avatar
See private message.
$12 USD in 1 day
4.9 (8 reviews)
2.4
2.4
User Avatar
See private message.
$10 USD in 1 day
5.0 (2 reviews)
1.9
1.9

About the client

Flag of UNITED STATES
United States
3.9
8
Member since Oct 12, 2010

Client Verification

Thanks! We’ve emailed you a link to claim your free credit.
Something went wrong while sending your email. Please try again.
Registered Users Total Jobs Posted
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Loading preview
Permission granted for Geolocation.
Your login session has expired and you have been logged out. Please log in again.