diff options
author | pommicket <pommicket@gmail.com> | 2025-02-19 18:43:35 -0500 |
---|---|---|
committer | pommicket <pommicket@gmail.com> | 2025-02-19 18:43:35 -0500 |
commit | 0b2293a1b44748e494d9db2ae72c72a16b693a9d (patch) | |
tree | c3c887ca80398682f4760f9c7f8e8692e2baaa89 /camera.c | |
parent | 99ffd21ef873cc30ac37c901ddd374fb26d41939 (diff) |
configure image format
Diffstat (limited to 'camera.c')
-rw-r--r-- | camera.c | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -298,12 +298,18 @@ static uint8_t *camera_curr_frame(Camera *camera) { assert(camera->userp_frames[camera->curr_frame_idx]); return camera->userp_frames[camera->curr_frame_idx]; } -void camera_write_jpg(Camera *camera, const char *name, int quality) { +void camera_save_jpg(Camera *camera, const char *name, int quality) { uint8_t *frame = camera_curr_frame(camera); if (frame) { stbi_write_jpg(name, camera_frame_width(camera), camera_frame_height(camera), 3, frame, quality); } } +void camera_save_png(Camera *camera, const char *name) { + uint8_t *frame = camera_curr_frame(camera); + if (frame) { + stbi_write_png(name, camera_frame_width(camera), camera_frame_height(camera), 3, frame, camera_frame_width(camera) * 3); + } +} bool camera_next_frame(Camera *camera) { struct pollfd pollfd = {.fd = camera->fd, .events = POLLIN}; // check whether there is any data available from camera |