Mac Photoshop won't open .png file saved from QImage



  • I'm testing the QImage class and am saving out a simple 256x256 .png file using QImage. The image appears to be okay in the Mac finder. I can see the file, the preview shows what I expect. But photoshop (which is photoshop cc) gives me the message:

    @Could not complete your request because the file-fiormat module cannot parse the file.@

    Wonder if anyone could shed some light on this?



  • This is the code I'm using:

    @ QFile file(fullpath);
    if( file.exists())
    {
    image = new QImage(fullpath);
    if( image ) {
    QColor fillcolor;
    fillcolor.setRed(0);
    fillcolor.setGreen(255);
    fillcolor.setBlue(255);
    fillcolor.setAlpha(255);
    image->fill(fillcolor);
    image->save(saveP, "PNG");
    stat.note("texture: " + fullpath);
    stat.note2column("Width:", uw::asStr(image->width()),16);
    stat.note2column("Height:", uw::asStr(image->height()),16);
    stat.note2column("Depth:", uw::asStr(image->depth()),16);
    delete image;
    image = NULL;
    }
    @


  • Lifetime Qt Champion

    Hi,

    Maybe a silly question, but did you check that the image was saved successfully ?

    On a side note, there's no need to allocate it on the heap



  • The map did save successfully. I can view it in Mac's viewer. But photoshop refuses to load it.


  • Lifetime Qt Champion

    Do you have any precise error message from photoshop ?



  • Could not complete your request because the file-fiormat module cannot parse the file.


  • Lifetime Qt Champion

    And it doesn't give you any hint why it can parse it ?



  • No. There is another hint. I have a mac with Parallels. I have photoshop for PC in parallels and photoshop for mac. I cannot load any .png files from the pc partition from the Mac photoshop. But if I use a repository with Git and check in the .png file from the PC side and do a pull on the Mac side, the file will open.

    Now that's not a .png generated from QImage. That's just a .png file saved from photoshop. So who knows. Its not a big deal. I just thought there might be someone else out there that had seen this.


  • Lifetime Qt Champion

    What if you try to open your QImage generated png with your Windows Photoshop ?


  • Moderators

    Hi,

    This sounds like a Mac-Windows filesystem issue, not a Qt issue.

    I suspect that if you open the PNG in a Windows partition using Windows Photoshop, it will be fine. I also suspect that if you copy the file from your Windows partition into your Mac partition (no need Git), your Mac Photoshop will be able to open it too.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.