ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> tcl-core
tcl-core
[TCLCORE] base64 in the core?
by suchenwi other posts by this author
Apr 26 2008 1:25AM messages near this date
Re: [TCLCORE] Status of TIP 195, 288 and 313 | [TCLCORE] problem with image create photo
I expect it isn't much code, basically repackaging 8-bit bytes in 6-bit chars. Biggest q is 
probably the API - one cutesy idea is 
encoding convert{from,to} base64
:^)


Best regards, Richard Suchenwirth-Bauersachs  http://wiki.tcl.tk/RS


-----Urspr�ngliche Nachricht-----
Datum: Sat, 26 Apr 2008 09:04h
Von: "Donal K. Fellows" <donal.k.fellows@[...].uk> 
An: lluisgomez@[...].org
Kopie: tcl-core@[...].net
Betreff: Re: [TCLCORE] problem with image create photo


lluisgomez@[...].org wrote:
>  sorry if this is not the plae for this question, I don't found a  
>  tcl/tk users mailing list ... and i need hep with a strange problem ::

Strictly this isn't the right place; general user questions are best
directed to the newsgroup comp.lang.tcl (that's why you didn't find a
mailing list!) but it's an interesting one with some policy side pieces
to my answer which *are* on topic here. :-)

>  I'm using this command in my aplication
>     COLORGRID_SYS_VGUI3("image create photo img1223 -data {%s}\n",fdata);
>  where fdata is a const char* with a base64 encoded PNM image,

Not the most favoured way of doing it.

>  tk says:
>    "couldn't recognize image data"
>  If I do it with a base64 encoded GIF it works

That's because the GIF reader was specially hacked to support base64
encoded images. Fairly ugly, but made sense at the time! These days,
we'd not do that at all and instead direct people to the base64 decoder
available in tcllib.

>  hasn't tk built-in support for PNM images?

Yes, but only ones described as raw data. (In fact, I suspect we only
support the P6 and P5 subformats.) Alas, you can't include such raw data
just like that; we need a little more magic. See below...

>  any tips?

Apply what I said about base64 in tcllib and you get this:
   COLORGRID_SYS_VGUI3("package require base64;"
         "image create photo img1223 -data [base64::decode {%s}]\n",
         fdata);

Now the policy question for people on this list: should we generalize
the base64 reader so that all format readers (including those provided
by Img) pick up base64 support transparently?

Donal.

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Tcl-Core mailing list
Tcl-Core@[...].net
https://lists.sourceforge.net/lists/listinfo/tcl-core



Privacy Policy | Email Opt-out | Feedback | Syndication
© 2004 ActiveState, a division of Sophos All rights reserved