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
2
votes
1 answer

Cannot load QImage from byte array in release mode

In my app I receive images in JPEG format from Android device over QTcpSocket as a byte array. When I run this app on my dev PC it works like a charm (both in debug and release modes). However, I'm not able to load QImage from byte array on another…
Umriyaev
  • 1,150
  • 11
  • 17
2
votes
1 answer

Pyqt5 Why does my image load as a PNG but not a JPG?

I'm using QPixmap to display an jpg image but it doesn't display. I converted the jpg image into a png and that works but I'd like to know the reason for it. pixmap =…
Jaitnium
  • 621
  • 1
  • 13
  • 27
2
votes
1 answer

How can I convert pixel data in QImage to another format?

I receive an instance of QImage with arbitrary QImage::Format. How can I create another instance of QImage with a particular QImage::Format of my choosing so that the actual image data is converted from the arbitrary format to my…
Mr. Developerdude
  • 9,118
  • 10
  • 57
  • 95
2
votes
2 answers

Superposing qimage with transparency

I try to superpose 3 QImage but I have some warnings, for example : QImage::pixelColor: coordinate (31,30) out of range And the result of the blending is a black image. Here my code : QBrush MainWindow::blendLayer(int x, int y){ QImage…
NegatIV
  • 47
  • 2
2
votes
2 answers

How to create a simple Image (QImage) with text and colors in QT and save it as file

I have to create some Images as placeholder for articles which have no own images / pictures. I already realized this in python, but i want to write the code in a qt app again. The python code is working and it looks like this: def…
Teddy2000
  • 21
  • 1
  • 2
2
votes
1 answer

Conversion from numpy array to QImage/QPixmap results in colored stripes

I have an RGB image 224x224x3 and an overlay 224x224. And I want to apply my overlay as red pixels on my RGB image, which I convert to grayscale. The overlay range from 0 to 255. Higher values should make a stronger red. I tried to use Stefan's…
N8_Coder
  • 713
  • 3
  • 10
  • 20
2
votes
1 answer

adding Image to tab

i have encountered another problem maybe you all could help with i cant seem to add a photo to any of my tabs could you help? here is my code import sys import webbrowser import random import time import os from PyQt4.QtGui import QApplication,…
Tyrell
  • 896
  • 7
  • 15
  • 26
2
votes
1 answer

QWidget draws distorted angled QImage

I'm working on a homework for my Digital Image Processing class, and I'm using OpenCV with QT Framework. I've created a class ImageDisplay, which is as sub class of the QWidget class. I've using OpenCV to manipulate a grayscale image, and then…
Alexandre Justino
  • 1,716
  • 1
  • 19
  • 28
2
votes
1 answer

Color tables of grayscale images

I have a grayscale image in PyQt and want to get the color of a specific pixel. Grayscale images use a color table with up to 256 entries. from PyQt4 import QtGui def test(): image = QtGui.QImage(100, 100, QtGui.QImage.Format_Indexed8) …
Michael Westwort
  • 914
  • 12
  • 24
2
votes
1 answer

Qt : Create a Stack of image

I'm new at Qt and I'm trying to design a simple application that draw lines for now. I managed to draw lines using QImage and the MouseEvent (the line starts at the mouse click and ends at the mouse release). Now I would like to create a "ghost"…
fo fu
  • 33
  • 7
2
votes
2 answers

Creating a QImage from an XBM

Creating a QBitmap from raw data stored in the XBM format, can easily be done like so QBitmap::fromData(width, height, data, QImage::Format_MonoLSB), with data being the raw data of the XBM file. Now, what if we want to create a QImage this time?…
gpalex
  • 826
  • 1
  • 11
  • 27
2
votes
0 answers

QImageReader memory leak

I created an application in which I use a lot of images. I use the class QImageReader and by checking with valgrind, I have memory leaks in functions that use QImageReader, and as I call those functions several times, the whole leak is very…
SteveTJS
  • 635
  • 17
  • 32
2
votes
1 answer

QT- QImage and multi-threading problem

Greetings all, Please refer to image at : http://i48.tinypic.com/316qb78.jpg We are developing an application to extract cell edges from MRC images from electron microscope. MRC file format stores volumetric pixel data…
Ashika Umanga Umagiliya
  • 8,988
  • 28
  • 102
  • 185
2
votes
1 answer

Resizable PyQt widget displaying an image with fixed aspect ratio

It is a common problem to display a QImage in a widget. While this can be done using QLabel.setPixmap, the resulting QLabel will have a fixed size equal to the size of the pixmap. It is possible to use setScaledContents to make QLabel scale the…
Andrzej Pronobis
  • 33,828
  • 17
  • 76
  • 92
2
votes
1 answer

Using QImage With QQuickImageProvider

I have created a class that inherits QQuickImageProvider Class, but i want to use the requestImage() function of QQuickImageProvider to set the QImage variable , but i dont know how to do that as i need that QImage variable from a class object ,…
Javeria
  • 101
  • 1
  • 1
  • 7