in reply to Re^2: Tk not recognising GD image
in thread [Solved] Tk not recognising GD image

But I have more interesting things to investigate

The error arises in pTk/mTk/generic/tkImgPhoto.c:
if (formatPtr == NULL) { ... code that might avoid the error by break()ing from the enclosing for() loop } if (formatPtr == NULL) { if ((formatObj != NULL) && !matched) { Tcl_AppendResult(interp, "image format \"", formatString, "\" is not supported", (char *) NULL); } else { Tcl_AppendResult(interp, "couldn't recognize image data", (char *) NULL); } return TCL_ERROR; }
So ... there are cases where (formatPtr == NULL) is not necessarily an error.
Perhaps yours should be one such case, but it's currently being undetected ? (I've no idea.)

Anyway .... just a starting point for you once the "more interesting things" have been investigated ;-)

Cheers,
Rob

Replies are listed 'Best First'.
Re^4: Tk not recognising GD image -- further doubts
by Discipulus (Canon) on May 09, 2022 at 08:52 UTC
    Hello,

    a doubt still remains: I confirm this behaviour (and it sounds strange):

    > This code works when used on a file smaller than the screen. On a larger file, it fails ..

    Why it works for smaller files and need to be encoded for larger ones?

    L*

    There are no rules, there are no thumbs..
    Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
      $imtk = $mw->Photo(-data => $imgd->jpeg(), -format => 'jpeg'); } else { $imtk = $mw->Photo(-file => $file, -format => 'jpeg');

      The command is different, using the file directly via the file option rather than data. Larger files have to be resized to fit. I was thinking of using a temporary file as a workaround.

      Regards,

      John Davies

        AH!

        I'm smarter sathurday night than monday in the morning :)

        L*

        There are no rules, there are no thumbs..
        Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.