Solved

How to load data from QImage into QByteArray ?

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers will learn the basics of using Ableton Live's advanced sampler instrument, Sampler. Load new Sampler into an empty MIDI track: Select a sample and drop it into sample window in Sampler: Adjust pitch if necessary with Root Key setting: …
Viewers will learn how to include realistic velocity sensitivity to their Sampler instruments. Set the Vol<Vel parameter in the Filter/Global tab to your desired setting: Gather samples of hits of various intensity, and drag/drop into Velocity zon…

943 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

11 Experts available now in Live!

Get 1:1 Help Now