Results 1 to 2 of 2

Thread: Image processing with using QByteArray

  1. #1
    Join Date
    Jan 2015
    Posts
    3
    Thanks
    3
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Image processing with using QByteArray

    Hi all.
    i have to process image in Qt, and i want do it with using qbytearray. I know how to convert QPixmap to QByteArray. For example:
    QPixmap pixmap = OriginalImg.copy(0,0,x,y);
    QByteArray ba;
    QBuffer buffer(&ba);
    buffer.open(QIODevice::WriteOnly);
    pixmap.save(&buffer, "PNG");

    PNG is a compressed format, so if the size of pixmap is 860x860, the size of ba is only 128518 (not 860*860*4). And i don't know how to change the color of pixel(i,j) on image using qbytearray ba. Can anyone teach me how to achieve it.
    thanks
    Last edited by loading...; 19th January 2015 at 08:56.

  2. #2
    Join Date
    Oct 2009
    Posts
    483
    Thanked 97 Times in 94 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Image processing with using QByteArray

    You have seen for yourself that it is impractical to manipulate an image via through a serialized representation (here, PNG). Then why did you chose this route? Qt provides the QImage class to conveniently access pixels invidually, or even the plain binary data (QImage::​bits()). You can load a file into a QImage directly or, if all you have is a QPixmap, call QPixmap::​toImage().

  3. The following user says thank you to yeye_olive for this useful post:

    loading... (21st January 2015)

Similar Threads

  1. image processing with qtopengl
    By sisilet in forum Qt Programming
    Replies: 1
    Last Post: 10th June 2010, 21:42
  2. image processing
    By IRON_MAN in forum Qt Programming
    Replies: 4
    Last Post: 18th November 2009, 13:37
  3. QByteArray processing (seeking equivalent QT code)
    By pdoria in forum Qt Programming
    Replies: 2
    Last Post: 13th July 2009, 09:40
  4. Image processing
    By NicNac in forum Newbie
    Replies: 25
    Last Post: 2nd November 2008, 10:05
  5. Image Processing using Qt
    By danielperaza in forum Qt Programming
    Replies: 2
    Last Post: 9th March 2008, 18:15

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.