mtiman / image_editor Goto Github PK
View Code? Open in Web Editor NEWC Image Editor for Netpbm files
C Image Editor for Netpbm files
## Copyright Mantu Matei 312CA 2022-2023 # README tema03: Image Editor ## Description This program written in C loads Portable GrayMap (PGM) and Portable PixMap (PPM) files and can select portions of the photos, rotate, crop, equalize, apply filters, print a histogram and save the results in either an ascii format or a binary format. ## Usage + How it works For making this program, I have made an `image` struct that contains the size of the image along the coordinates of the points that define the selected portion of the picture, the type of the image and the max value of the pixels. At first, the program awaits a Netpbm format picture to be loaded from locat files. It is done by using the command `LOAD <filename>`. Then, several comands can be executed: 1. `LOAD <filename>` - deletes the previously loaded picture and loads a new one from `<filename>`. If the picture is saved in binary form, it is read byte by byte using an `unsigned char` variable (because unsigned char has a range of 0-255 - exactly the range of one byte). All lines containing `#` in the file are ignored as they are considered to be comments. 2. `SELECT <x1> <x2> <y1> <y2>` - selects a portion of the picture loaded, swaps the coordinates if they are in the wrong order. 3. `SELECT ALL` - selects the whole picture loaded. 4. `EQUALIZE` - if the loaded picture is a grayscale one, it equalizes it using the formula provided in the PDF. 5. `CROP` - crops the picture; done by making a copy of the selection, freeing the old photo and replacing its address with the selection's. 6. `APPLY <FILTER>` - applies one of the 4 filters: EDGE, SHARPEN, BLUR, GAUSSIAN BLUR. Implemented by using 3x3 Kernel matrices; only works for PixMap files. 7. `HISTOGRAM <x> <y>` - prints a histogram of the picture loaded, provided that it is a grayscale one. The histogram is made of `y` bins, while `x` is the max value of a bin. 8. `SAVE <filename> [ascii]` - saves the loaded picture into <filename>. The `ascii` parameter is optional, saving the picture in ASCII format. Otherwise, the picture is saved in binary format. 9. `ROTATE <angle>` - [BONUS] - Only works if the angle is a multiple of 90. The selection has to either be a square one or be the whole picture. The rotations are made by a combination of transposing the matrix and reversing the columns and the rows of the matrix. The functions for reversing the rows and columns are pretty straight forward, swapping the elements one by one. The transposing function works differently depending on whether the submatrix selected is square or not: in the case of a square matrix, the elements above the main diagonal of the selection are swapped with those under the diagonal. In the case of a rectangular matrix, a new matrix is allocated and the transposed values are copied from the old one. The old matrix is then freed and its address is changed to the new one.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.