Skip to content
  • 0 Votes
    8 Posts
    5k Views
    M
    @joeQ As per your suggesttion i'll make changes in the code on my own.Once again thanks for your help.
  • Rendering a QImage on openGL

    Unsolved General and Desktop opengl qopengltexture qimage
    1
    0 Votes
    1 Posts
    2k Views
    No one has replied
  • 0 Votes
    1 Posts
    1k Views
    No one has replied
  • QPixmap::fromImage(img) sometime crash.

    Unsolved General and Desktop qpixmap qimage
    6
    0 Votes
    6 Posts
    5k Views
    SGaistS
    Hi, Can you show how your create the image that you pass to the function ? Also, can you provide a stack trace of your application crash ?
  • Modifying Images

    Moved Unsolved Game Development qimage qpixmap qgraphicspixmap qgraphicsscene qgraphicsview
    9
    0 Votes
    9 Posts
    6k Views
    A
    What do you think about this? int length = this->boundingRect().width(); length = (int)(((double)length * (double)value) / 100.0); QPixmap pix(this->boundingRect().width() - length, this->boundingRect().height()); pix.fill(Qt::transparent); QPainter p; p.begin(&pix); p.fillRect(pix.rect(), QColor(0, 0, 0, 120)); p.end(); gauge->setPixmap(pix); gauge->setPos(pos().x()+length, pos().y()); It works fine and the effect is the same as on example pixtures above.
  • Rotating a QLabel

    General and Desktop qimage qwidget rotation scale qgraphicsitem
    3
    0 Votes
    3 Posts
    4k Views
    ?
    You can add a widget to the scene using QGraphicsProxyWidget *QGraphicsScene::addWidget(QWidget *widget, Qt::WindowFlags wFlags = Qt::WindowFlags()).
  • 0 Votes
    3 Posts
    2k Views
    m.sueM
    Hi, you should be able to do so by overriding the QRectF boundingRect() const function. Just call the base function to get the current rect., and return rect.adjusted(2,2,2,2). -Michael.
  • Save QImage to Base64 String

    Unsolved General and Desktop qimage qbytearray qbuffer base64
    11
    0 Votes
    11 Posts
    17k Views
    M
    This works QBuffer buffer; buffer.open(QIODevice::WriteOnly); QImage qp(fileName()); qp.save(&buffer, "PNG"); QString base64 = buffer.data().toBase64(); https://stackoverflow.com/questions/69165252/how-to-convert-png-image-into-base-64-format-in-qt
  • 0 Votes
    6 Posts
    9k Views
    D
    @Ajith_P_V , maybe, you need not RGB, but BGR model. I didn't work with graphics in qt, but in OpenCV all work was gone in BGR.
  • 0 Votes
    2 Posts
    2k Views
    A
    Hi, QPainter can draw a QImage. So you can for example create a new Widget, subclass for QLabel for example if you want and reimplement paintEvent. Like this you work all the time with your QImage without creating another one. And better you can only update the region that changed, no need to refresh everything. I did not try it but it should work. Sincerely
  • 0 Votes
    10 Posts
    5k Views
    SGaistS
    Haaaaaa… I missed that… You didn't pass the pointer to the QImage data...
  • Convert QImage into binary Matrix

    Unsolved General and Desktop qimage matrix convert
    11
    0 Votes
    11 Posts
    7k Views
    VRoninV
    slightly more refined solution using the fact that QImage uses "a matrix" internally QDataStream outStream(&outputFile); outStream << image.height()<< image.width(); /* You need this to recover the image size, if not needed remove*/ QImage testImage= image.convertToFormat(QImage::Format_Mono,Qt::MonoOnly); /* 1 bit= 1 pixel*/ testImage.invertPixels(); /* black is 1 and white is 0 normally, you need the opposite so invert*/ const int bytesInWidth = testImage.width()/8 + (testImage.width()%8>0 ? 1:0); /*This is image.width()/8 rounded up */ for(int i=0;i<testImage.height();++i) outStream.writeRawData((const char*)(testImage.constScanLine(i)),bytesInWidth);
  • QImage size after save

    Unsolved General and Desktop qimage save size
    2
    0 Votes
    2 Posts
    1k Views
    raven-worxR
    @sabativi unless it's not a bug in the image writer plugin on OS X i would suspect that your QImage/QPixmap is already invalid. Please show the code where you create and paint into the image.
  • Synchronous QImage saving

    Unsolved General and Desktop qimage save synchronous
    4
    0 Votes
    4 Posts
    2k Views
    sabativiS
    Hello @raven-worx, Yes you are damn right. Saving is synchronous. The problem i was facing is that i checked just after save if the image was written. Apparently it takes some times for the image to be written on disk. I use QTRY_VERIFY_WITH_TIMEOUTand it solved my problem. Thanks again
  • Use QPainter with QPixmap contain QImage

    Solved General and Desktop qpainter qpixmap qimage
    6
    0 Votes
    6 Posts
    9k Views
    ?
    @kevin32 Great :)
  • Insert image on other QImage in QLabel

    Solved General and Desktop qlabel qimage
    8
    0 Votes
    8 Posts
    12k Views
    SGaistS
    Hi, You have two memory leaks now. There's no need to allocate pixmap nor painter on the heap. i.e: QPixmap pixmap(ui->label->width(), ui->label->height()); QPainter painter=(&pixmap); painter.drawPixmap(100, 0, 50, 50, QPixmap("C:/Users/user/Pictures/a.png")); painter.drawPixmap(0, 0, 100, 100, QPixmap("C:/Users/user/Pictures/1.png")); painter.end(); ui->label->setPixmap(pixmap);
  • Get value of pixel from black and white image

    Solved General and Desktop qimage
    2
    0 Votes
    2 Posts
    2k Views
    slettaS
    @helenebro QImage::Format_Mono or QImage::Format_MonoLSB will both do the job. You can then read/write 0/1 with QImage::pixel() / QImage::setPixel(). For faster access to the pixel data, if that is needed, you should use the direct accessors with scanline() / constScanline() or bits() / constBits(), but then you need to take care of the bit offsets for each 32-byte block of pixel values.
  • 0 Votes
    9 Posts
    7k Views
    S
    i am facing same problem how to resolve this
  • QImage linux integration is lacking

    Brainstorm qimage linux
    3
    0 Votes
    3 Posts
    2k Views
    JKSHJ
    Hi @I-d-na, To clarify @SGaist's point: QImage is not an image format. It is a C++ class that lets C++ programmers manipulate images. A QImage cannot be downloaded over the internet. A QImage can only exist in a program that's written with Qt. File names like "main-qimg-salad" are not related to QImage. (Yes, I know the both start with a 'Q' and end with "image/"img", but really: they are not related at all.) Now that we've cleared that up, let's get to the root of your problem. If you download a file and it's called "main-qimg-salad", it simply means that the server gave it a filename that starts with "main-qimg", but the server neglected to include the .filetype extension at the end. Therefore, we can't tell what type of image it is. See https://www.quora.com/Why-do-we-get-main-qimg-e7b0b4951d663c737e5bbf2722d23612-jpg-types-of-saving-titles-when-we-download-images-from-the-Internet for a discussion of this naming system. If you search https://www.google.com/search?q="main-qimg" you will find that most of these images are actually JPEG files. So, try renaming your file from "main-qimg-salad" to "main-qimg-salad.jpg" and see what happens.
  • 0 Votes
    7 Posts
    6k Views
    kshegunovK
    @Donn There's no way to loselessly convert 16 bit integers into 8 bit integers, so you can't use QImage to display your image without dropping some of the information. I advise to follow @SGaist's advice and research what OpenGL provides and if that will suit your needs. PS. Please don't post multiple times the same question! I see tree distinct instances of you asking the same thing over and over again in a few hours period. http://forum.qt.io/topic/64650/display-2d-array-of-type-uint16-as-grayscale-image http://forum.qt.io/topic/64657/display-uint16-image