>> QString encodedString = QString::fromLatin1(finalJpg.toBase64());

Thanks for general comments, hints and especially this working solution ! It 
does the job very well and besides single images it also works for 25 fps video 
streams (what I did not expect).

Thanks again and
all the best

Alex

--
http://www.carot.de
Email : alexan...@carot.de
Tel.: +49 (0)177 5719797


> Gesendet: Freitag, 26. Januar 2024 um 16:17 Uhr
> Von: "Thiago Macieira" <thiago.macie...@intel.com>
> An: "qt qt" <interest@qt-project.org>
> Cc: "Alexander Carôt" <alexander_ca...@gmx.net>
> Betreff: Re: [Interest] displaying Qt-coded JPEG image in browser
>
> On Friday, 26 January 2024 04:55:59 PST Alexander Carôt via Interest wrote:
> > QString jpgBufferString( finalJpg.data() );
> 
> This here will corrupt the data, because you can't load arbitrary binary data 
> into QString like this: it's trying to decode as UTF-8 and failing.
> 
> > QString encodedString = jpgBufferString.toUtf8().toBase64();
> 
> You should encode to Base64 at the QByteArray level first, before going to 
> QString. So:
> 
>  QString encodedString = QString::fromLatin1(finalJpg.toBase64());
> 
> -- 
> Thiago Macieira - thiago.macieira (AT) intel.com
>   Cloud Software Architect - Intel DCAI Cloud Engineering
>
_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest

Reply via email to