<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[How to encode an image to base64?]]></title><description><![CDATA[<p dir="auto">Hello everyone :)</p>
<p dir="auto">How is it possible to capture an image in qml and then encode it to base64?</p>
]]></description><link>https://forum.qt.io/topic/144218/how-to-encode-an-image-to-base64</link><generator>RSS for Node</generator><lastBuildDate>Fri, 06 Nov 2026 10:35:57 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/144218.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 07 Apr 2023 11:04:31 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to How to encode an image to base64? on Fri, 14 Apr 2023 17:03:02 GMT]]></title><description><![CDATA[<p dir="auto">Thanks,<br />
I also tried this but doesn't work:</p>
<pre><code>QFile file("/home/user/cat.png");
if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
        return QImage();

QByteArray content = file.readAll();

QImage::fromData(content.toBase64(QByteArray::Base64Encoding), "PNG");
</code></pre>
]]></description><link>https://forum.qt.io/post/754766</link><guid isPermaLink="true">https://forum.qt.io/post/754766</guid><dc:creator><![CDATA[Mohammad Sherafat]]></dc:creator><pubDate>Fri, 14 Apr 2023 17:03:02 GMT</pubDate></item></channel></rss>