Solved

How to load data from QImage into QByteArray ?

Posted on 2011-03-21
2
3,507 Views
Last Modified: 2012-05-11
Hi experts,

How do I load data from a QImage into a QByteArray ? I need only the raw data of the image in the array. For example, if I have a PNG, I only need to read the raw data of the image.

Thanks,
Peter
0
Comment
Question by:PeterVarain
2 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 500 total points
ID: 35184533
You can use 'QImage::bits()' (http://doc.qt.nokia.com/latest/qimage.html#bits-2) for that, e.g.
QImage img;

//...

QByteArray arr((char*)img.bits(),img.byteCount());

Open in new window

0
 

Author Closing Comment

by:PeterVarain
ID: 35184767
Thanks !
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
Keep your audience engaged and get the most out of your next presentation with these quick Prezi tips.
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question