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
0 answers

Loading QImage from memory using OpenimageIO

I'm trying to load QImage from memory. PyOpenimageIO gives me pixels in python array: array('f',[r1,g1,b1,r2,g2,b2]). Using this function: img = QtGui.QImage(pixels,spec.width, spec.height, QtGui.QImage.Format_RGB888) or img =…
2
votes
1 answer

Qt - Loading image with wrong extension

I'm currently working on a Qt program that works with images that are supplied by the users. One problem I've run into is that a lot of images are saved with the wrong extension - e.g. an image is saved in JPG format but has a PNG extension. Qt…
Sean Goodwin
  • 303
  • 4
  • 12
2
votes
1 answer

Use one QPainter to paint multiple outputs at once: SVG and QImage

My Qt application uses a QPainter to draw a vector graphic. I need this graphic output twice, once as a vector output in SVG format, where I'm using QSvgGenerator, and once as a pixel format, where I'm using QImage. According to what I've found in…
Philipp
  • 957
  • 1
  • 6
  • 20
2
votes
1 answer

Save a QImage in Qt

Is it possible to export images generated in Qt creator? The qimage which is a built in data type in Qt. We modify it using setpixel() function. I want to save that image for further use.
Animesh Karnewar
  • 416
  • 1
  • 8
  • 17
2
votes
1 answer

Why is there bit shifting when converting to an image from an array?

I'm trying to create a QPixmap from a numpy array. The numpy array image is going to be 2D (ie no color info just grayscale). I'm trying to adapt this answer to my needs however I don't quite understand this line: b = (255 << 24 | a[:,:,0] << 16 |…
evan54
  • 3,585
  • 5
  • 34
  • 61
2
votes
2 answers

Qt QImageReader won't loop, uncontrollable

really quick problem here I'm trying to use QImageReader to read the frames of a Gif, but when the animation finishes, it won't loop. I can't even control which frame is loaded, as using either the ImageReader's read() function to return a QImage OR…
Yattabyte
  • 1,280
  • 14
  • 28
2
votes
1 answer

Create a QByteArray from a QImage and vice-versa

I need to encode an already-created QImage into a QByteArray to send to a socket, and decode it on the another side. On the server side, I'm trying to do something like: // The vector is mandatory. The class that creates the image line expects…
Etore Marcari Jr.
  • 572
  • 2
  • 10
  • 19
2
votes
2 answers

Visual Studio 2010 debugger visualizer for Qt image types?

Is there a VS 2010 debugger visualizer for Qt's image types (QImage, QPixmap, etc), similar to this one for System.Drawing.Image? I glanced through this article detailing the steps required to write such a visualizer, but I can't figure out if it's…
Vicky Chijwani
  • 10,191
  • 6
  • 56
  • 79
2
votes
1 answer

Displaying live camera image in Qt GUI

Im trying to make an application that takes live image recorded by camera and shows it on screen using Qt GUI. The camera driver and api provides me with functionality that refreshes the memory block showed by pointer. The problem is my image won't…
Marcin K.
  • 683
  • 1
  • 9
  • 20
2
votes
1 answer

Optimizing QPainter drawing & Converting QVideoFrame straight to QPixMap

Some background info about my issue. My goal is to optimize drawing of images coming from webcam, the images come as QVideoFrame and are currently loaded in to QImage and drawn from there. This solution works fine, but drawing QImage is very slow on…
2
votes
1 answer

How to work with QGraphicsScene::addPixmap when it only accepts const QPixmap?

I'd like to display some QImage through QGraphicsScene, my code's very straightforward: mainwindow.h QImage *sourceImage; QGraphicsView *imageView; QGraphicsScene *imageScene; mainwindow.cpp imageScene = new QGraphicsScene; imageView = new…
timfeirg
  • 1,426
  • 18
  • 37
2
votes
4 answers

Qt image format plugins

Can somebody point me to sites with not supported by Qt image format plugins (reading/writing). XCF and PSD for example.
Ross
  • 2,079
  • 2
  • 22
  • 26
2
votes
2 answers

Assigning an image to an object of a class that inherits from Qimage

I have created a class BWImage that inherits from Qimage. Objects of the class are thus of the type Qimage. After creating an object with: BWImage image1; How Do I now assign an actual image (already in the resource structure) to this object? I've…
user3064874
  • 125
  • 1
  • 11
2
votes
1 answer

Storing binary data in a PNG file using QImage::setText()

I need to read/store binary data in the metadata of a PNG image. Specifically, it will be gzipped data which has been serialized by Google's protobuf library. I'm using the QImage library of Qt5 to load and store the images, so it would be extremely…
Elliott
  • 1,336
  • 1
  • 13
  • 26
2
votes
1 answer

Qt 5 dds support to save memory and improve rendering

I would like to load dds files into Qt 5.1 and have the benefit of saving memory and improve rendering performance as dds files in many cases are less in size (due to data destroying compression) than their png equivalent and also are stored in more…