Solved

How to load data from QImage into QByteArray ?

Posted on 2011-03-21
2
3,363 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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

If you have a server on collocation with the super-fast CPU, that doesn't mean that you get it running at full power. Here is a preamble. When doing inventory of Linux servers, that I'm administering, I've found that some of them are running on l…
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.
Viewers will learn how to turn a Live Set into a compressed Live Pack file, and how to install Live Packs. Make: File > Collect All And Save: File > Manage Files: Click Manage Project: Click Create Pack: Select save location: Install: Doub…

708 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now