Results 1 to 5 of 5

Thread: QImagerWriter::setText and QImageReader::text() -- Do they work in 4.8 using a jpeg?

  1. #1
    Join Date
    Jun 2012
    Posts
    219
    Thanks
    28
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default QImagerWriter::setText and QImageReader::text() -- Do they work in 4.8 using a jpeg?

    QImageWriter has a method for adding text to an image file:

    http://doc.qt.io/qt-4.8/qimagewriter.html#setText

    And QImageReader has a method to read the text, given a key and another method to print all the key names:

    http://doc.qt.io/qt-4.8/qimagereader.html#text

    I've tried using QImageWriter::setText(const QString & key, const QString & text) both with a key string and using and empty string for the key. No error results, but when I use QImageReader to read the text I get and empty string. When I use QImageReader::textKeys() I get "()".

    Do these work for writing/reading text to a jpeg file? I'm assuming the text goes in the file header?

    If so, is there a "trick" to get it to work?

    Thanks.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QImagerWriter::setText and QImageReader::text() -- Do they work in 4.8 using a jp

    I don't think you can store custom textual data in a jpeg. Try the same with PNG and see if it works.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


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

    davethomaspilot (31st August 2015)

  4. #3
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QImagerWriter::setText and QImageReader::text() -- Do they work in 4.8 using a jp

    Maybe you can find the QImageIOHandler for the format somehow, it could then be asked if it supports the Description option:
    http://doc.qt.io/qt-4.8/qimageiohand...supportsOption

    Cheers,
    _

  5. #4
    Join Date
    Jun 2012
    Posts
    219
    Thanks
    28
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QImagerWriter::setText and QImageReader::text() -- Do they work in 4.8 using a jp

    Quote Originally Posted by wysota View Post
    I don't think you can store custom textual data in a jpeg. Try the same with PNG and see if it works.
    Ok, out of town and can't get to it until late this week. I'll give it a try then

  6. #5
    Join Date
    Jun 2012
    Posts
    219
    Thanks
    28
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QImagerWriter::setText and QImageReader::text() -- Do they work in 4.8 using a jp

    Yes, it works fine with .png.

    Is there a list somewhere that documents what image file formats work with the QImageWriter::text()? Is it just .png?

Similar Threads

  1. multithreaded QImageReader
    By dcole in forum Qt Programming
    Replies: 7
    Last Post: 23rd June 2011, 22:16
  2. Qwt Tex Text Doesnt work for me
    By gbmtoday in forum Qwt
    Replies: 1
    Last Post: 21st November 2010, 19:48
  3. QLable::setText(text) is not showing the Text
    By ranna in forum Qt Programming
    Replies: 4
    Last Post: 14th November 2008, 09:39
  4. Replies: 2
    Last Post: 7th November 2006, 12:49
  5. QImageReader with Qt::FastTransformation???
    By sepp in forum Qt Programming
    Replies: 1
    Last Post: 21st March 2006, 13:56

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
  •  
Qt is a trademark of The Qt Company.