diff --git a/include/libcamera/internal/formats.h b/include/libcamera/internal/formats.h
index 3c7440a..af0f1ac 100644
--- a/include/libcamera/internal/formats.h
+++ b/include/libcamera/internal/formats.h
@@ -46,6 +46,9 @@ public:
 	static const PixelFormatInfo &info(const PixelFormat &format);
 	static const PixelFormatInfo &info(const V4L2PixelFormat &format);
 
+	unsigned int bytesPerLine(unsigned int width) const;
+	unsigned int imageSize(const Size &size) const;
+
 	const char *name;
 	PixelFormat format;
 	V4L2PixelFormat v4l2Format;
diff --git a/src/libcamera/formats.cpp b/src/libcamera/formats.cpp
index 4d18825..698c905 100644
--- a/src/libcamera/formats.cpp
+++ b/src/libcamera/formats.cpp
@@ -693,4 +693,31 @@ const PixelFormatInfo &PixelFormatInfo::info(const V4L2PixelFormat &format)
 	return info->second;
 }
 
+/**
+ * \brief Compute the bytes per line
+ * \param[in] width The width of the line, in pixels
+ * \return The number of bytes necessary to store the line, or 0 if the
+ * PixelFormatInfo instance not valid
+ */
+unsigned int PixelFormatInfo::bytesPerLine(unsigned int width) const
+{
+	if (!isValid())
+		return 0;
+
+	/* ceil(width / pixelsPerGroup) * bytesPerGroup */
+	return ((width + pixelsPerGroup - 1) / pixelsPerGroup) * bytesPerGroup;
+
+}
+
+/**
+ * \brief Compute the bytes necessary to store the frame
+ * \param[in] size The size of the frame, in pixels
+ * \return The number of bytes necessary to store the frame, or 0 if the
+ * PixelFormatInfo instance is not valid
+ */
+unsigned int PixelFormatInfo::imageSize(const Size &size) const
+{
+	return size.height * bytesPerLine(size.width);
+}
+
 } /* namespace libcamera */
