Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^2: Tk not recognising GD image

by davies (Prior)
on May 07, 2022 at 21:31 UTC ( [id://11143655]=note: print w/replies, xml ) Need Help??


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

Your solution works perfectly. Thank you. Reading "The string can contain base64 encoded data or binary data", I could not see what was wrong with my binary data. But I have more interesting things to investigate, now you have helped me.

Regards,

John Davies

Replies are listed 'Best First'.
Re^3: Tk not recognising GD image
by syphilis (Archbishop) on May 08, 2022 at 01:17 UTC
    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
      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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11143655]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (None)
    As of 2024-04-25 01:41 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found