Questions tagged [qimage]

A QImage is a class from the Qt toolkit which provides a hardware-independent image representation that allows direct access to the pixel data, and can be used as a paint device.

Qt provides four classes for handling image data: QImage, QPixmap, QBitmap and QPicture. QImage is designed and optimized for I/O, and for direct pixel access and manipulation.

Because QImage is a QPaintDevice subclass, QPainter can be used to draw directly onto images. When using QPainter on a QImage, the painting can be performed in another thread than the current GUI thread.

The QImage class supports several image formats, including monochrome, 8-bit, 32-bit and alpha-blended images.

QImage provides a collection of functions that can be used to obtain a variety of information about the image. There are also several functions that enable transformation of the image.

QImage objects can be passed around by value since the QImage class uses implicit data sharing. QImage objects can also be streamed and compared.

The official Qt documentation can be found here for Qt 4.8 and here for Qt 5.

549 questions
3
votes
1 answer

Convert OpenCV 3 (iplImage) to PyQt5 QImage/QPixmap in Python

Before this question is dismissed as a duplicate, please note: Using OpenCV version 3 (not version 2) Using Python 3 (not C++) Using PyQt 5 (not PyQt4) Goal: Trying to stream OpenCV webcam video frames in a PyQt5 GUI window # For testing, I'm…
Connor
  • 670
  • 3
  • 9
  • 29
3
votes
1 answer

Very big QImage and Memory Mapped Files in QT

I want bind QImage to the MMF file to manipulate the image without the cost of memory directly on the disc. Unfortunately, my code creates a copy in memory. QFile file("Boston City Flow.jpg"); if(!file.open(QIODevice::ReadOnly)) …
Yury
  • 1,169
  • 2
  • 16
  • 29
3
votes
1 answer

Constantly generating QPixmap* fails after a number of iterations

I am using the following code in order to generate QPixmap* pointers and then insert them into QHash (I will show only the pointers generation code since this is the one that fails). QPixmap* MyClass::loadImg(QString fileName) { …
Soc
  • 283
  • 3
  • 17
3
votes
1 answer

Using QPainter with QImage in a loop not in a main thread

With this simple loop: for(int i=0;i
user2449761
  • 1,169
  • 13
  • 25
3
votes
2 answers

How to flip a QImage

What is the right way to flip/mirror a QImage? The following snippet does not work. //allocate buffer BYTE* pRgb32Buffer = new BYTE[width*height* 4]; //create paint device QImage img = QImage(pRgb32Buffer , width, height, getStride(width,…
maxw
  • 123
  • 1
  • 8
3
votes
1 answer

Qt QImage to QPixmap Conversion loses Color Information for UI

I am trying to update a QPixmap on a QLabel in my main Qt UI. The following slot is called to do this with the "newImage" variable QImage ( because it's from a different thread ). The QImage is converted to someImage with convertFromImage ( I've…
PhilBot
  • 748
  • 18
  • 85
  • 173
3
votes
1 answer

Compress QImage or QPixmap

I am working in a QT project (5.1.1). The main window shows a large image as a QLabel object which includes a QPixmap (which contains a QImage). My question is simple.... Are there some way to compress the image? UPDATE: How large is the image?…
carlos.baez
  • 1,063
  • 2
  • 11
  • 31
3
votes
1 answer

How to convert a cv::Mat to QImage or QPixmap?

I've tried to look around and tried everything I've found, but haven't found a solution for this problem. I'm trying to update an image in a QT application by button click. In the constructor I've managed to show a image: cv::Mat temp =…
Øystein W.
  • 517
  • 3
  • 16
3
votes
1 answer

Determine which pixels of QImage were changed while painting on it with QPainter

I have class Paintable that is able to paint itself with QPainter provided as an argument: class Paintable { public: virtual void paint(QPainter*) = 0; }; Instances of this class are being painted on a single QImage: QImage paint(const…
Oleg Andriyanov
  • 5,069
  • 1
  • 22
  • 36
3
votes
1 answer

Change color of transparent image in Qt

I have a transparent image (QImage) overlayed over a video in Qt. I want to change the color of the transparent image only on clicks of button. Can some one tell me how to do this? Thank You.
Sid411
  • 703
  • 2
  • 9
  • 25
3
votes
1 answer

QImage dithering quality

We are currently using a commercial library for image rendering with Windows. When displaying monochrome images in sizes smaller than the images original size, this library gray scales images so that still most of them can be recognized: Now i…
RED SOFT ADAIR
  • 12,032
  • 10
  • 54
  • 92
3
votes
3 answers

What is the fastest way to render a jpeg file on to a QWidget?

My current code follows this: Disk > bytearray > QImage (or QPixmap) > Painter // Step 1: disk to qbytearray QFile file("/path/to/file"); file.open(QIODevice::ReadOnly); QByteArray blob = file.readAll(); file.close(); // Step 2: bytearray to…
S B
  • 8,134
  • 10
  • 54
  • 108
3
votes
1 answer

cv::Mat to QImage convertion not working properly

I'm working with opencv and I have to integrate it to a Qt Gui, but I have some issue for showing the image in Qt ... Here is the code that I'm using #include #include #include #include…
rednaks
  • 1,982
  • 1
  • 17
  • 23
3
votes
1 answer

set alpha channel per pixel in QImage

I am using a QImage of the format _ARGB32. I have to set some of the pixels as transparent and some as opaque. So, I used this line: Image.setPixel(x,y,QColor(r,g,b,0).rgba()); to set the pixel as transparent. I have even tried…
kenzo450D
  • 51
  • 3
  • 5
3
votes
1 answer

Qt: Empty transparent QImage has noise

I'm trying to do some offscreen rendering onto a QImage (nothing special, just a few composited thumbnails) and am running into an issue where even new and supposedly blank QImages have some pretty serious noise: The code to reproduce is fairly…
timothyb89
  • 220
  • 1
  • 10