aboutsummaryrefslogtreecommitdiff
path: root/image.c
diff options
context:
space:
mode:
authorOnur Gündüz <ogunduz@gmail.com>2026-10-20 11:44:30 +0200
committerOnur Gündüz <ogunduz@gmail.com>2026-10-20 11:44:30 +0200
commit9b9005101e6170a226acb265428aac429be6edbf (patch)
treef89c76f4a5c2a00a72abe9b92468ac9f15083b94 /image.c
downloadfacedet-9b9005101e6170a226acb265428aac429be6edbf.tar.gz
facedet-9b9005101e6170a226acb265428aac429be6edbf.zip
Init
Diffstat (limited to 'image.c')
-rw-r--r--image.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/image.c b/image.c
new file mode 100644
index 0000000..d4f5181
--- /dev/null
+++ b/image.c
@@ -0,0 +1,21 @@
+#include "image.h"
+
+#define STB_IMAGE_IMPLEMENTATION
+#define STBI_ONLY_JPEG
+#define STBI_ONLY_PNG
+#define STBI_NO_LINEAR
+#define STBI_NO_HDR
+#define STBI_MAX_DIMENSIONS 4096
+#include "../third_party/stb/stb_image.h"
+
+unsigned char *image_read_rgb(const char *path, int *width, int *height) {
+ if (!path || !width || !height)
+ return NULL;
+ int w, h, channels;
+ unsigned char *rgb = stbi_load(path, &w, &h, &channels, 3);
+ if (!rgb)
+ return NULL;
+ *width = w;
+ *height = h;
+ return rgb;
+}