Solved

How to load data from QImage into QByteArray ?

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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SMB share across internet 15 67
Free tool to filter out human audio from music 3 28
CentOS 7 Linux for HP DL380 G4 32Bits 7 49
find Speed using GPS latitude & longitude 4 47
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
Viewers will learn the basics of creating custom device Racks in Ableton Live. Place instrument(s) and effects onto a track, and select them all by holding the Shift key and clicking on the device title bars: Group them by typing Command-G (Ctrl-G…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

821 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