8000 GitHub - charlesdong/tiny-image: A tiny C/C++ image loading and saving library for graphics APIs.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

charlesdong/tiny-image

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 

Repository files navigation

TinyImage

A tiny C/C++ image loading and saving library for graphics APIs.

Before using

Directly download this repository to your computer.

Create or open a project in your C/C++ compiler, and add tinyimage.cpp to your project.

Note that if you're using C, please rename tinyimage.cpp to tinyimage.c.

How to use

TinyImage provides both C and C++ interfaces for users, so there are some differences between the two interfaces. But it's OK to use the C interface even though you're using C++.

Image loading

C

Use the tinyimg_load() function to load an image from disk, for example:

int width, height;
unsigned char * image = tinyimg_load("image.bmp", &width, &height, TINYIMG_LOAD_RGB);

When the image is no more being used, you should call the tinyimg_free() function to free the image data:

tinyimg_free(image);

C++

Use the load() function in the namespace tinyimg to load an image from disk, for example:

int width, height;
unsigned char * image = tinyimg::load("image.bmp", width, height, TINYIMG_LOAD_RGB);

You can also use a vector to store the image data, and call load_vec() to load the image:

#include <vector>
...
int width, height;
vector<unsigned char> image = tinyimg::load_vec("image.bmp", width, height, TINYIMG_LOAD_RGB);

When the image is no more being used, you should call the free() function to free the image data, if the image data is stored in an unsigned char array (instead of vector):

tinyimg::free(image);

About

A tiny C/C++ image loading and saving library for graphics APIs.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages 33C3

No packages published

Languages

0