Skip to content

yeonzi/tlibmp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tlibmp - tiny libbmp

license build language platform

A tiny libary that can read/write/edit .BMP files from disk

View project homepage

Basic

It was a lib that can create bmp file, and print in it.

these is some demo with this lib:

Color print

color

Draw lines

lines

Draw triangles

lines

Image processing

it also contain some basic image processing functions.

I use a picture from pixiv by (ˉ﹃ˉ)EM1234 as following:

origin

I have transform it to a bmp file named test.bmp,

Use this lib, I have made the following images:

Gray

gray

Binary

binary

Channel R

channel R

Channel G

channel G

Channel B

channel B

Mosaic

mosaic

mosaic

Histogram graph

histogram_r

histogram_g

histogram_b

histogram

Convolution

In mathematics convolution is a mathematical operation on two functions to produce a third function.

As picture can treated as a function, we can run convolution operation on a picture, and this will produce magical effect

Firstly, let's try a Gaussian function, the Matrix(convolution core) is:

1.0 4.0 7.0 4.0 1.0
4.0 16.0 26.0 16.6 4.0
7.0 26.0 41.0 26,0 7.0
4.0 16.0 26.0 16.6 4.0
1.0 4.0 7.0 4.0 1.0

and this matrix produce this picture:

gaussian

and then, let's try a matrix like this:

-1.0 -1.0 0.0
-1.0 0.0 1.0
0.0 1.0 1.0

easily to find that this matrix will produce a gray picture, just like a sculpture:

gaussian

a matrix like this will stress the edge of the picture:

0.0 -1.0 0.0
-1.0 5.0 -1.0
0.0 -1.0 0.0

stress

To make a color inverse, you can use a matrix with the summary small than zero:

inverse