Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QML-Change data in Image Details tab properties



  • Hi,
    I use Qt version 5.6.0 with qml from windows 8.1.
    I want to set metadata for captured images in QML.
    I've tried the following code, the program runs on desktop takes the picture and saves it.
    After I open it up with Preview and check the metadata... and nothing special there (no Author key).

    Camera {
                                    id: camera
                                    metaData.author: "neda"
    


  • I don't see an "author" property listed in "metaData" here: http://doc.qt.io/qt-5/qml-qtmultimedia-camera.html



  • I've never actually done this, so I'm not sure, but I think this might work after reading the documentation.

    Camera { id: cam }
    
    Button {
        onClicked: {
            cam.imageCapture.setMetadata("Author", "neda");
            cam.imageCapture.capture();
       } 
    } 
    


  • @Wieland

    Thank you.
    I see this link

    I use this code but it does not work.

    Camera {
                                    id: camera
                                    metaData.cameraModel: "lenovo"
    


  • @JordanHarris

    Thank you.

    I use this code but It does not work.

     imageCapture {
         onImageMetadataAvailable:{
            setMetadata(key,value)
            console.log("Image Metadata Callback : "+key+" = "+value)
            setMetadata("Title","neda")
        }
    
    
    
    onClicked: {
    camera.imageCapture.setMetadata(camera.metaData.author, "neda")
    //or this code:
    camera.imageCapture.setMetadata("Author", "neda")
    //or this code:
    camera.metaData.author="neda"
    
    camera.imageCapture.capture()
    
    

    Update: I also tried to do that using QImageWriter as follows:

    QImage image("c:/1.jpg");
    QImageWriter writer("c:/11.png", "png");
    writer.setText("Author", "neda");
    writer.write(image);    
    

    But, none of my tries gave me any success (change data in Image Details tab properties). Any idea?


Log in to reply