diff --git a/RayTracer/sampling/Image.cpp b/RayTracer/sampling/Image.cpp
index 7f839df3616001c419041e3e7579131bc0f511fd..bb2ff0b93dead59ae47e38fc38b69d558f41952c 100644
--- a/RayTracer/sampling/Image.cpp
+++ b/RayTracer/sampling/Image.cpp
@@ -5,6 +5,8 @@
 
 #include "../tools/Threadpool.h"
 #include "StratifiedSampler.h"
+#define STB_IMAGE_IMPLEMENTATION
+#include "../tools/stb_image.h"
 
 namespace util {
 Image::Image(int width, int height) : width(width), height(height) {
@@ -150,4 +152,23 @@ void writeBmp(const char* filename, Image img) {
 
 	ofile.close();
 }
+
+Image readImage(const char* filename) {
+	int width, height, channels;
+	unsigned char* img = stbi_load(filename, &width, &height, &channels, 0);
+	Image result(width, height);
+	if (channels != 3)
+		std::cout << "Careful! Loaded image has " << channels << " channels"
+		          << std::endl;
+	size_t img_size = width * height * channels;
+	int i = 0;
+	for (unsigned char* p = img; p != img + img_size; p += channels) {
+		float x = (float)*(p + 0) / 255;
+		float y = (float)*(p + 1) / 255;
+		float z = (float)*(p + 2) / 255;
+		result[{i, 0}] = Vec3(x, y, z);
+		i++;
+	}
+	return result;
+}
 }  // namespace util
\ No newline at end of file
diff --git a/RayTracer/sampling/Image.h b/RayTracer/sampling/Image.h
index 902dca6078651cd7976fa4352de06756033f856d..be2138a25711fdbd94a6acf3e267425b218df2d9 100644
--- a/RayTracer/sampling/Image.h
+++ b/RayTracer/sampling/Image.h
@@ -30,5 +30,6 @@ class Image {
 Image raytrace(size_t threadcount, const cam::CamObs& cam,
                const std::shared_ptr<Sampler>& sampler, size_t n);
 void writeBmp(const char* filename, Image img);
+Image readImage(const char* filename);
 
 }  // namespace util
\ No newline at end of file