diff --git a/src/plugins/imageformats/webp/qwebphandler.cpp b/src/plugins/imageformats/webp/qwebphandler.cpp
index ce90158a173f741609985ad3128bab3b606091e4..f47040a26bfb4da2f4ef0241f51a385941b2ee98 100644
--- a/src/plugins/imageformats/webp/qwebphandler.cpp
+++ b/src/plugins/imageformats/webp/qwebphandler.cpp
@@ -177,7 +177,7 @@ bool QWebpHandler::read(QImage *image)
 
     QImage frame(m_iter.width, m_iter.height, QImage::Format_ARGB32);
     uint8_t *output = frame.bits();
-    size_t output_size = frame.byteCount();
+    size_t output_size = frame.sizeInBytes();
 #if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
     if (!WebPDecodeBGRAInto(
         reinterpret_cast<const uint8_t*>(m_iter.fragment.bytes), m_iter.fragment.size,