Starting from:

$30

COMP2560-   Assignment 1 Solved

Write a C program to merge two given binary-based ppm files (P6). The names of the two given image files and the name of the combined image file are given as command line arguments. The combined image is obtained by putting the second image to the top-right corner of the first image. The sizes of the given image files are not fixed. If the width or the height of the first image is less than that of the second, your program should report error.

All these image files can be opened with image viewer tools that can work with ppm file format.

For simplicity, the following restrictions are added to the file format of the input: 

•       no comment line after the file type specification

•       width (number of columns) and height (number of rows) formatted as ASCII decimal in the second line

•       maximal value of color components given in the third line

 

This is a practice on using System Call I/O. You are not allowed to use standard I/O library functions or other graphics related libraries. 

Sample input (firework.ppm and 150.ppm):

 

 

 

60-256 System Programming                                                                                                            Dr. Chen

 

 

 

 

 

Corresponding output:

 

 

 

More products