qimage

Using QImage With QQuickImageProvider

♀尐吖头ヾ 提交于 2019-12-11 03:31:47
问题 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 , which has been deifned in QML from ContextProperty and want to use the id variable as an index values to retrieve QImage from a List. Here is the main function code: int main(int argc, char *argv[]) { QApplication app(argc, argv); ImageProvider

How to check if file is/isn't an image without loading full file? Is there an image header-reading library?

烈酒焚心 提交于 2019-12-11 01:14:58
问题 edit: Sorry, I guess my question was vague. I'd like to have a way to check if a file is not an image without wasting time loading the whole image, because then I can do the rest of the loading later. I don't want to just check the file extension. The application just views the images. By 'checking the validity', I meant 'detecting and skipping the non-image files' also in the directory. If the pixel data is corrupt, I'd like to still treat it as an image. I assign page numbers and pair up

QImage from HBITMAP

☆樱花仙子☆ 提交于 2019-12-10 15:09:06
问题 In my windows-only program, I use a third-party library, which returns a HBITMAP . Is there a way to initialize a QImage from its contents, i.e. to convert it to a QImage ? 回答1: This is the way to do it for Qt 4 (QtGui): QImage image(QPixmap::fromWinHBITMAP(hBitmap).toImage()); This is the way to do it for Qt 5 (QtWinExtras): QPixmap pixmap = QtWin::fromHBITMAP(hBitmap); QImage image = pixmap.toImage(); // or QtWin::imageFromHBITMAP(hdc, hBitmap, width, height) 回答2: OK, this seems to work for

Dividing QImage to smaller pieces

馋奶兔 提交于 2019-12-10 14:21:46
问题 I have an image, and I want to divide this image to n pieces. So what I'm wondering is that how can I do this with QImage? Or is there a better(performance wise) Qt class for this task? For example imagine I have an image consist of 1920x1080 pixels, and I want to divide it to 100 pieces which means each piece will consist of 192x108 pixels. Note that I don't want to create same piece scaled to 192x108. Each piece is a distinct piece of the main picture. I have attached an Image to make my

How to make a QImage or QPixmap semi-transparent - or why is setAlphaChannel obsolete?

微笑、不失礼 提交于 2019-12-10 04:19:17
问题 4.7 and like to overlay two images on a qgraphicsview. The image on top shall be semi-transparent to allow to see through it. Initially both images are fully opaque. I expected some function for setting a global alpha-value for each pixel to exist, but it seems like there is no such function. The closest thing to it is QPixmap::setAlphaChannel(const QPixmap & alphaChannel), which, however, is marked as obsolete since Qt-4.6. Instead the manual refers to the CompositionModes of QPainter, but I

Reproduce Python 2 PyQt4 QImage constructor behavior in Python 3

你。 提交于 2019-12-08 09:00:33
I have written a small GUI using PyQt4 that displays an image and gets point coordinates that the user clicks on. I need to display a 2D numpy array as a grayscale, so I am creating a QImage from the array, then from that creating a QPixmap. In Python 2 it works fine. When I moved to Python 3, however, it can't decide on a constructor for QImage - it gives me the following error: TypeError: arguments did not match any overloaded call: QImage(): too many arguments QImage(QSize, QImage.Format): argument 1 has unexpected type 'numpy.ndarray' QImage(int, int, QImage.Format): argument 1 has

QImage into QML

[亡魂溺海] 提交于 2019-12-08 05:42:25
问题 My application receives a live-stream of JPEGs over network (16 frames per second). The live-stream should be displayed using QML. The receiving part is written in C++, all the UI is written using QML. How do I get the image data into the QML window? I have looked around how to get a QImage displayed, but I did not find a solution yet. Implementing QDeclarativeImageProvider and refreshing the source of the image over and over again using a different name seems to be the only solution, see

Painting Issue on QWidget outsite GUI thread

我怕爱的太早我们不能终老 提交于 2019-12-07 12:21:09
问题 I am developing an appliation in which I want to continuously receive images from remote host and display them on my screen. for this I am following the given strategy 1) I have a main QWidget object which contains the QImage on it (works fine) 2) Images received from remote host are painted on QImage object, this work is done in a worker thread using QPainter. (works fine) 3) but the problem is that the image is not updated on QWidget, unless I resize the widget, because the repaint event is

Constructing QImage from unsigned char* data

落爺英雄遲暮 提交于 2019-12-07 07:27:11
问题 I encountered a problem with passing Image object (captured with Point Grej FlyCapture2 SDK) to QImage object. I am getting a pointer associated with Image data by function: virtual unsigned char* FlyCapture2::GetData ( ) and then loading the data by: QImage::QImage ( uchar * data, int width, int height, int bytesPerLine, Format format ) Formats of data of both Image objects are 8-bit monocolor. BytesPerLine parameter should be equal to width of the Image (I've already checked it by saving

how to merge two images into one using QImage and QPainter in qt? [closed]

二次信任 提交于 2019-12-07 04:18:58
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . Hi I am developing a blackberry10 app. Inside the app I have two images and I just need to merge these two images into a single image. There is no function in Cascades to combine them. When I posted this in the blackberry developer forum I was advised to use QImage and QPainter functions in qt to combine two