Max00358 / PNG_Finding_and_Concatentation

ECE 252 Lab 1: This program takes in a directory and find all PNG strips using recursion and verify their validity. Then the PNGs are concatenated to form a full, recognizable image.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PNG_Finding_and_Concatentation

A directory encompassing both PNG and non-PNG files is provided, including nested sub-directories. Valid PNG images within this directory are horizontal strips of a larger composite image, sharing a common width but varying heights. The PNG images adhere to the naming convention *_N.png, where N represents the sequence number (N=0, 1, 2, ...). However, files with .png or .PNG extensions may not necessarily be genuine PNG image files. The task involves identifying and extracting all authentic PNG image files within the given directory. Subsequently, these images are concatenated in sequential order based on the sequence number in the file name, reconstructing the original complete image. The sequence number dictates the vertical concatenation order, with lower numbers corresponding to the upper position. For instance, img_1.png is the initial horizontal strip, followed by img_2.png, and the pixel data in img_1.png is directly succeeded by that in img_2.png during concatenation. Figure 1.1 provides a visual representation of this concatenation order. To address this challenge, a tool named findpng is created to search the directory hierarchy for authentic PNG files. Additionally, a concatenation tool named catpng is developed to merge pixel data from a set of PNG files into a single PNG image file, with the constraint that all PNG images must share the same width dimension.

PNG Concatentation:

The cat_png function will concatentate the PNG strips sequentially into one fully image.
Five strips of images that will be fed into the program are shown below:

pic_cropped_0
pic_cropped_1
pic_cropped_2
pic_cropped_3
pic_cropped_4

After feeding the five images into the program with the command in terminal: ./a.out img1.png img2.png img3.png img4.png img5.png
The following image will be generated as "all.png" as shown:

WEEF_1

PNG find:

The find_png function will go down the provided directory provided by the user and find all the valid, uncorrupted .png files and display the path of the file.

About

ECE 252 Lab 1: This program takes in a directory and find all PNG strips using recursion and verify their validity. Then the PNGs are concatenated to form a full, recognizable image.


Languages

Language:C 100.0%