Results 1 to 5 of 5

Thread: Save Image in XML file

  1. #1
    Join Date
    Jan 2016
    Posts
    81
    Thanks
    31
    Qt products
    Qt5
    Platforms
    Windows

    Default Save Image in XML file

    Hi,
    I want to get image from camera and save to XML file.
    I pass "photoPreview.source (== image://camera/preview_1)" as URL of captured image to c++ class.
    I have this error:
    "Open error"

    I use this code for save image in XML file:
    Qt Code:
    1. QFile fileImg(url_image); // == > photoPreview.source (== image://camera/preview_1)
    2. fileImg.open(QIODevice::ReadOnly);
    3. QByteArray imageData = fileImg.readAll();
    4. QByteArray imageData_Base64 = imageData.toBase64();
    5. xmlWriter.writeAttribute("image",imageData_Base64);
    To copy to clipboard, switch view to plain text mode 

  2. #2
    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: Save Image in XML file

    url_image is an URL, not a name of a file on disk. QFile works with those.

    Cheers,
    _

  3. #3
    Join Date
    Jan 2016
    Posts
    81
    Thanks
    31
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Save Image in XML file

    Thank you,
    Yes I know, but How can I get URL of captured image by camera? (URL of photoPreview.source)
    Last edited by neda; 5th March 2016 at 12:36.

  4. #4
    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: Save Image in XML file

    What type is photoPreview?

    Cheers,
    _

  5. #5
    Join Date
    Jan 2016
    Posts
    81
    Thanks
    31
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Save Image in XML file

    Thank you.
    I used the capturedImagePath to get the file corresponding to my captured image.
    My problem is solved.

Similar Threads

  1. Replies: 15
    Last Post: 24th July 2015, 23:33
  2. Replies: 4
    Last Post: 30th May 2012, 00:37
  3. how to save a image file ( say png ) into mysql database?
    By AviMittal in forum Qt Programming
    Replies: 12
    Last Post: 21st July 2011, 13:49
  4. Save Image of QGLWidget to file
    By ToddAtWSU in forum Qt Programming
    Replies: 5
    Last Post: 3rd March 2010, 17:36
  5. How to save an image (png) into a xml file
    By richardander in forum Qt Programming
    Replies: 8
    Last Post: 9th October 2009, 10:57

Tags for this Thread

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.