Error processing request

Parameters

CONTENT_LENGTH0
REQUEST_METHODGET
REQUEST_URI/revision/Img?V=97
QUERY_STRINGV=97
CONTENT_TYPE
DOCUMENT_URI/revision/Img
DOCUMENT_ROOT/var/www/nikit/nikit/nginx/../docroot
SCGI1
SERVER_PROTOCOLHTTP/1.1
HTTPSon
REMOTE_ADDR172.69.7.129
REMOTE_PORT30918
SERVER_PORT4443
SERVER_NAMEwiki.tcl-lang.org
HTTP_HOSTwiki.tcl-lang.org
HTTP_CONNECTIONKeep-Alive
HTTP_ACCEPT_ENCODINGgzip, br
HTTP_X_FORWARDED_FOR18.189.180.76
HTTP_CF_RAY876d02accc77615d-ORD
HTTP_X_FORWARDED_PROTOhttps
HTTP_CF_VISITOR{"scheme":"https"}
HTTP_ACCEPT*/*
HTTP_USER_AGENTMozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; [email protected])
HTTP_CF_CONNECTING_IP18.189.180.76
HTTP_CDN_LOOPcloudflare
HTTP_CF_IPCOUNTRYUS

Body


Error

Unknow state transition: LINE -> END

-code

1

-level

0

-errorstack

INNER {returnImm {Unknow state transition: LINE -> END} {}} CALL {my render_wikit Img The\ venerable\ Img\ \[package\]\ by\ \[Jan\ Nijtmans\]\ provides\ the\ handling\ of\ several\ image\ formats\ beyond\ the\ standard\ formats\ in\ \[Tk\].\n\n\[Img\]\ source\ code\ (latest\ version:\ '''1.4.2''')\ is\ available\ at\ \[SourceForge\]:\n\n\ \ \ *\ '''http://sourceforge.net/projects/tkimg/'''\n\nIn\ Debian\ (and\ related\ distros)\ it\ is\ packaged\ as\ '''libtk-img'''.\n\nThe\ original\ homepage,\ now\ of\ historical\ interest,\ was\ at:\ \ http://members1.chello.nl/~j.nijtmans/img.html\n\nThere\ are\ also\ \[starkit\]s\ running\ around.\ \ \[Steve\ Redler\],\ for\ example,\ has\ tentatively\ committed\ to\ provision\ a\ directory\nof\ '''tk.img'''s\ toward\ the\ end\ of\ October\ 2005,\ perhaps\ in\ the\ vicinity\ of\ http://server.linuxsys.net/files\ .\n\n\n**\ Synopsis\ **\n\n======\n%\ package\ require\ Tk\n%\ 8.6.3\n%\ image\ create\ photo\ -file\ wish.ico\nERROR:\ couldn't\ recognize\ data\ in\ image\ file\ \"wish.ico\"\n%\ package\ require\ Img\n1.4.2\n%\ image\ create\ photo\ im\ -file\ wish.ico\nimage1\n======\n\n\n**\ Description\ **\n\nImg\ is\ a\ Tk\ extension,\ adding\ support\ for\ many\ other\ Image\ format.\nThe\ list\ below\ includes\ ''many''\ of\ the\ supported\ formats,\ but\ is\ not\ formally\ kept\ in\ sync\ with\ the\ code:\n\n\ \ \ *\ \[bmp\]:\ Windows\ bitmap\ format.\ See\ img-bmp\ .\n\ \ \ *\ \[gif\]:\ The\ venerable\ graphics\ interchange\ format\ (with\ transparency,\ but\ without\ LZW.\ The\ latter\ due\ to\ patent\ issues).\ See\ img-gif\ .\n\ \ \ *\ \[ico\]:\ Windows\ icon\ files.\ See\ img-ico\ .\n\ \ \ *\ \[jpeg\]:\ The\ format\ for\ lossy\ compressed\ still\ pictures\ specified\ by\ the\ Joint\ Picture\ Experts\ Group.\ See\ img-jpeg\ .\n\ \ \ *\ pcx:\ Paintbrush\ image\ format.\ See\ img-pcx\ .\n\ \ \ *\ \[pixmap\]:\ While\ the\ other\ formats\ are\ handlers\ for\ the\ Tk\ photo\ image\ type\ this\ is\ a\ new\ image\ type\ for\ Tk.\ See\ img-pixmap\ .\n\ \ \ *\ \[png\]:\ Portable\ Network\ Graphics,\ successor\ to\ GIF.\ See\ img-png\ .\n\ \ \ *\ \[ppm\]:\ Portable\ Pixmaps.\ See\ img-ppm\ .\n\ \ \ *\ ps:\ \[Postscript\]\ and\ \[PDF\]\ (Portable\ document\ format).\ Requires\ an\ external\ application,\ ghostview,\ for\ its\ operation.\ See\ img-ps\ .\n\ \ \ *\ sgi:\ Native\ SGI\ format.\ See\ img-sgi\ .\n\ \ \ *\ sun:\ Sun\ raster\ images.\ See\ img-sun\ .\n\ \ \ *\ tga:\ Targa\ files.\ See\ img-tga\ .\n\ \ \ *\ \[tiff\]:\ Tagged\ Interchange\ File\ Format.\ See\ img-tiff\ .\n\ \ \ *\ window:\ ???\ (not\ a\ file\ but\ window\ snapshot)\ See\ img-window\ .\n\ \ \ *\ \[xbm\]:\ X\ Bitmaps.\ See\ img-xbm\ .\n\ \ \ *\ \[xpm\]:\ X\ Pixmaps.\ See\ img-xpm\ .\ \n\nVersion\ 1.4.x\ only\ works\ with\ Tcl/Tk\ 8.3\ or\ higher.\n\nVersion\ 1.3\ only\ works\ with\ Tcl/Tk\ 8.2\ or\ higher.\ \n\nIf\ you\ are\ using\ Tk\ 8.1\ or\ lower\ please\ stick\ with\ Img\ 1.2.4\ (which\ is\ still\ available).\ \n\nAnd\ if\ you\ are\ using\ Tk4.2\ or\ lower,\ please\ stick\ with\ Img\ 1.1.4\ (which\ is\ also\ still\ available).\ \n\n\n----\ \n\n**\ Discussion\ **\n\n\n***\ GIF\ and\ PNG\ Support\ ***\n\n\[Tk\]\ provides\ built-in\ support\ for\ \[GIF\],\ and\ \[TkPNG\]\ is\ a\ good\ alternative\ to\ Img\ for\ \[PNG\]\ support.\n\n\[AMG\]:\ Recent\ versions\ of\ \[Tk\]\ have\ built-in\ \[PNG\]\ support,\ which\ was\ derived\ from\ TkPNG.\n\n\[peterc\]\ 2009-09-01:\ Possibly\ worth\ noting\ that\ the\ Unisys\ GIF/LZW\ patents\ expired\ in\ mid\ 2004\ \[http://en.wikipedia.org/wiki/Graphics_Interchange_Format#Unisys_and_LZW_patent_enforcement\].\ PNG\ is\ generally\ preferred\ over\ GIF\ by\ most\ graphics\ people\ anyhow\ as\ it\ supports\ Alpha\ channel\ transparency.\ \n\n----\n\n***\ Example:\ \ converting\ graphics\ formats\ ***\n\nI\ often\ have\ a\ need\ to\ convert\ from\ one\ graphics\ format\ to\ another.\ \ \nAs\ long\ as\ I\ have\ ActiveTcl\ around,\ the\ chore\ is\ easy\;\ all\ I\ need\ is\ a\nscript\ on\ the\ order\ of\n\n\ \ \ \ package\ require\ Img\n\n\ \ \ \ cd\ /temp\n\n\ \ \ \ foreach\ file\ \[glob\ *.bmp\]\ \{\n\ \ \ \ \ \ \ \ set\ root\ \[file\ rootname\ \$file\]\n\ \ \ \ \ \ \ \ set\ image\ \[image\ create\ photo\ -file\ \$file\]\n\ \ \ \ \ \ \ \ foreach\ \{format\ suffix\}\ \{JPEG\ jpg\ GIF\ gif\ PNG\ png\}\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ \$image\ write\ \$root.\$suffix\ -format\ \$format\n\ \ \ \ \ \ \ \ \}\n\ \ \ \ \}\n\n----\n\n***\ Capturing\ a\ window\ (or\ canvas)\ to\ an\ image\ ***\n\n****\ Synopsis\ *****\n\n======\n#\ \$W\ is\ a\ Tk\ window\ ID\nimage\ create\ photo\ -format\ window\ -data\ \$W\n======\n\n\[tklib\]'s\ `canvas::snap`\ is\ based\ on\ \[George\ Petasis\]'\ version\ of\ `canvas2Photo`\ below.\n\n\ \ \ *\ \[Capture\ a\ window\ into\ an\ image\]\n\ \ \ *\ \[A\ little\ magnifying\ glass\]\n\n*****\ Discussion\ ******\n\n\n(posted\ by\ \[Mark\ G.\ Saye\]\ in\ \[comp.lang.tcl\]):\n\n======\nproc\ capture\ \{W\ format\ file\}\ \{\n\ \ \ \ set\ image\ \[image\ create\ photo\ -format\ window\ -data\ \$W\]\n\ \ \ \ \$image\ write\ -format\ \$format\ \$file\n\ \ \ \ puts\ \"capture\ ->\ '\$file'\ (\[file\ size\ \$file\]\ bytes)\"\n\ \ \ \ image\ delete\ \$image\n\}\n\npackage\ require\ -exact\ Img\ 1.2.4\n\nset\ top\ .t\ntoplevel\ \$top\nframe\ \$top.f\npack\ \ \$top.f\ -fill\ both\ -expand\ 1\n\nlabel\ \$top.f.hello\ -text\ \"Hello\ World\"\npack\ \ \$top.f.hello\ -s\ top\ -e\ 0\ -f\ none\ -padx\ 10\ -pady\ 10\nupdate\nbind\ \$top\ <Key-x>\ \[list\ capture\ \$top\ gif\ capture.gif\]\n======\n\n----\nSaves\ a\ white\ image\ only,\ however\ \;-(.\ \n\[Paul\ Obermeier\]\ has\ this:\n\n======\nproc\ canvas2Photo\ \{\ canvId\ \}\ \{\n\ \ \ \ #\ The\ following\ line\ grabs\ the\ contents\ of\ the\ canvas\ canvId\ into\ photo\ image\ ph.\n\ \ \ \ set\ retVal\ \[catch\ \{image\ create\ photo\ -format\ window\ -data\ \$canvId\}\ ph\]\n\ \ \ \ if\ \{\ \$retVal\ !=\ 0\ \}\ \{\n\ \ \ \ \ \ \ \ puts\ \"\\n\\tFATAL\ ERROR:\ Cannot\ create\ photo\ from\ canvas\ window\"\n\ \ \ \ \ \ \ \ exit\ 1\n\ \ \ \ \}\ \n\ \ \ \ return\ \$ph\n\}\n======\n\n\[RS\]:\ experimented\ with\ this\ and\ found\ that\ it\ can\ convert\ \[canvas\],\ \[text\]\ and\ \[listbox\]\ widgets,\ \nbut\ not\ a\ compound\ \[toplevel\].\ Hence,\ the\ name\ might\ better\ be\ ''widget2photo''...\ or,\ \nby\ using\ default\ error\ handlers,\ be\ simplified\ to\ an\ \[interp\]\ alias:\n\n======\ninterp\ alias\ \{\}\ capture\ \{\}\ image\ create\ photo\ -format\ window\ -data\n======\n\n----\n\[George\ Petasis\]\ 2004-10-24:\ \n\nI\ have\ written\ an\ improved\ version\ of\ the\ canvas2Photo\ procedure.\ \nThis\ one\ is\ able\ to\ capture\ *all*\ canvas\ items\ in\ the\ image,\ and\ not\ the\ visible\ part\ only...\n\n''NOTE'':\ this\ is\ now\ included\ in\ \[tklib\]\ as\ `canvas::snap`.\n\n======\nproc\ canvas2Photo\ \{canvas\ image\}\ \{\n\ \ \ \ ##\ Ensure\ that\ the\ window\ is\ on\ top\ of\ everything\ else,\ so\ as\ not\ to\ get\n\ \ \ \ ##\ white\ ranges\ in\ the\ image,\ due\ to\ overlapped\ portions\ of\ the\ window\ with\n\ \ \ \ ##\ other\ windows...\n\ \ \ \ raise\ \[winfo\ toplevel\ \$canvas\]\ \n\ \ \ \ update\n\ \ \ \ set\ border\ \[expr\ \{\[\$canvas\ cget\ -borderwidth\]\ +\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \[\$canvas\ cget\ -highlightthickness\]\}\]\n\ \ \ \ set\ view_height\ \[expr\ \{\[winfo\ height\ \$canvas\]-2*\$border\}\]\n\ \ \ \ set\ view_width\ \ \[expr\ \{\[winfo\ width\ \ \$canvas\]-2*\$border\}\]\n\ \ \ \ foreach\ \{x1\ y1\ x2\ y2\}\ \[\$canvas\ bbox\ all\]\ \{break\}\n\ \ \ \ set\ x1\ \[expr\ \{int(\$x1-10)\}\]\n\ \ \ \ set\ y1\ \[expr\ \{int(\$y1-10)\}\]\n\ \ \ \ set\ x2\ \[expr\ \{int(\$x2+10)\}\]\n\ \ \ \ set\ y2\ \[expr\ \{int(\$y2+10)\}\]\n\ \ \ \ set\ width\ \ \[expr\ \{\$x2-\$x1\}\]\n\ \ \ \ set\ height\ \[expr\ \{\$y2-\$y1\}\]\n\ \ \ \ image\ create\ photo\ \$image\ \\\n\ \ \ \ \ \ \ \ \ \ \ \ -height\ \$height\ -width\ \$width\n\ \ \ \ ##\ Arrange\ the\ scrollregion\ of\ the\ canvas\ to\ get\ the\ whole\ window\ visible,\n\ \ \ \ ##\ so\ as\ to\ grab\ it\ into\ an\ image...\n\ \ \ \ set\ scrollregion\ \[\$canvas\ cget\ -scrollregion\]\n\ \ \ \ set\ xscrollcommand\ \[\$canvas\ cget\ -xscrollcommand\]\n\ \ \ \ set\ yscrollcommand\ \[\$canvas\ cget\ -yscrollcommand\]\n\ \ \ \ \$canvas\ configure\ -xscrollcommand\ \{\}\n\ \ \ \ \$canvas\ configure\ -yscrollcommand\ \{\}\n\ \ \ \ set\ grabbed_x\ \$x1\n\ \ \ \ set\ grabbed_y\ \$y1\n\ \ \ \ set\ image_x\ 0\n\ \ \ \ set\ image_y\ 0\n\ \ \ \ while\ \{\$grabbed_y\ <\ \$y2\}\ \{\n\ \ \ \ \ \ \ \ while\ \{\$grabbed_x\ <\ \$x2\}\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ \$canvas\ configure\ -scrollregion\ \[\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ list\ \$grabbed_x\ \$grabbed_y\ \[\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ expr\ \{\$grabbed_x\ +\ \$view_width\}\]\ \[\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ expr\ \{\$grabbed_y\ +\ \$view_height\}\]\]\n\ \ \ \ \ \ \ \ \ \ \ \ update\n\ \ \ \ \ \ \ \ \ \ \ \ ##\ Take\ a\ screenshot\ of\ the\ visible\ canvas\ part...\n\ \ \ \ \ \ \ \ \ \ \ \ image\ create\ photo\ \$\{image\}_tmp\ \\\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ -format\ window\ -data\ \$canvas\n\ \ \ \ \ \ \ \ \ \ \ \ ##\ Copy\ the\ screenshot\ to\ the\ target\ image...\n\ \ \ \ \ \ \ \ \ \ \ \ \$image\ copy\ \$\{image\}_tmp\ \\\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ -to\ \$image_x\ \$image_y\ -from\ \$border\ \$border\n\ \ \ \ \ \ \ \ \ \ \ \ incr\ grabbed_x\ \$view_width\n\ \ \ \ \ \ \ \ \ \ \ \ incr\ image_x\ \ \ \$view_width\n\ \ \ \ \ \ \ \ \}\n\ \ \ \ \ \ \ \ set\ grabbed_x\ \$x1\n\ \ \ \ \ \ \ \ set\ image_x\ 0\n\ \ \ \ \ \ \ \ incr\ grabbed_y\ \$view_height\n\ \ \ \ \ \ \ \ incr\ image_y\ \ \ \$view_height\n\ \ \ \ \}\n\ \ \ \ \$canvas\ configure\ -scrollregion\ \$scrollregion\n\ \ \ \ \$canvas\ configure\ -xscrollcommand\ \$xscrollcommand\n\ \ \ \ \$canvas\ configure\ -yscrollcommand\ \$yscrollcommand\n\ \ \ \ return\ \$image\n\}\n======\n\n\n----\n\n***\ Uncategorised\ discussion\ ***\n\nCan\ anyone\ provide\ examples\ of\ how\ to\ use\ this\ package\ with\ Tk\ to\ display\nsome\ of\ the\ above\ image\ types?\ \ \ \n\n\[MG\]:\ Sure..\n\n======\npackage\ require\ Img\nimage\ create\ photo\ myJpeg\ -file\ \"image.jpeg\"\npack\ \[label\ .l\ -image\ myJpeg\]\ \;#\ to\ show\ it\ works\ ok\n======\n\nIt's\ as\ simple\ as\ that\ :)\ As\ for\ writing\ images\ (after\ you've\ executed\ the\ above\ code)...\n\n======\nmyJpeg\ write\ \"image.png\"\ -format\ PNG\n======\n\nWhere\ can\ one\ get\ freely\ distributable\ win32\ binaries?\n\n\[MG\]:\ Img\ is\ included\ in\ the\ \[ActiveTcl\]\ binaries.\ I\ don't\ know\ where\ you\ can\ find\ \na\ binary\ of\ Img\ on\ its\ own,\ though...\n\n\[\[Would\ be\ valuable\ to\ compare\ its\ capabilities\ with\ \[Xbit\]'s.\]\]\n\nA\ comparison\ with\ \[TclMagick\]\ would\ also\ be\ useful.\n\n----\n\n\[sheila\]\ 2004-10-18:\n\nWhat\ is\ the\ default\ format\ that\ is\ returned\ when\ one\ uses\ the\n\n======\n\$image_256.bmp\ data\n======\n\nas\ opposed\ to\ specifying\ ''-format\ bmp''?\ Looks\ like\ a\ list\ of\ lists,\ and\ the\ elements\ of\ the\ list\ are\ #rrggbb\ values.\ When\ I\ use\ ''-format\ bmp''\ I'm\ guessing\ I\ get\ base64\ encoded\ data.\ \nYou\ can\ go\ from\ this\ format\ to\ hex\ in\ order\ to\ manipulate\ bits\ in\ hex\ maybe\n\n======\npackage\ require\ base64\n=====\n\nthis\ is\ a\ row\ from\ the\ first\ line\ of\ a\ dump\ from\ \$image\ data\ -format\ bmp.\ \n(this\ is\ just\ a\ rendition,\ since\ the\ actual\ characters\ aren't\ printable\ to\ this\ screen)\n\n======none\n%\ set\ row\nQk322AEAAAAAADYEAAAoAAAAkAEAACwBAAABAAgAAAAAAMDUAQBtCwAAbQsAAAABAAAAAQAA\n\n%\ set\ d64\ \[base64::decode\ \$row\]\n\nM\ and\ binary\ formated\ data\n\n%\ binary\ scan\ \$d64\ H*\ hex\n1\n%\ set\ hex\n424df6d80100000000003604000028000000900100002c0100000100080000000000c0d401006d0b00006d0b00000001000000010000\n======\n\nThis\ example\ is\ a\ Windows\ BMP\ 24-bit\ format.\ After\ you\ get\ this,\ you\ can\ parse\ the\ file\ to\ access\ data\ of\ interest.\ I\ was\ curious\ about\ how\ to\ do\ a\ difference\ operation\ on\ two\ bitmaps,\ and\ wanted\ to\ xor\ the\ rgp\ data,\ so\ I\ was\ going\ to\ do\ a\ parser\ for\ the\ BMP\ file.\ I\ didn't\ do\ that\ after\ discovering\ the\ TclMagick\ extension\ for\ accessing\ the\ ImageMagick\ API\ (Hmm,\ I'd\ like\ to\ reduce\ the\ footprint\ of\ my\ ImageMagick\ install).\n\nI'm\ still\ curious\ though.\ Having\ the\ rgb\ data\ already\ conveniently\ returned\ in\ #rrggbb\ elements\ is\ nice.\ Is\ there\ a\ way\ to\ convert\ that\ back\ to\ a\ format\ that\ can\ be\ used\ to\ create\ new\ bmp\ images\ automatically,\ or\ would\ I\ have\ to\ write\ a\ generator\ for\ creating\ a\ new\ BMP\ file\ to\ pass\ to\ image\ create?\n\n\[AF\]:\ The\ \[tklib\]\ \[ico\]\ package\ will\ read\ and\ write\ BMPs\ to/from\ lists\ of\ rgb\ colors\ and\ tk\ images.\n\n----\n\n\[Serge\ Kazantzev\]:\ In\ order\ to\ compile\ tkimg1.3\ on\ MacOSX/Jaguar\ with\ Tcl/Tk\ 8.4,\ ''tiff/tiffjpeg.c''\ must\ be\ modified\ as\ follows:\ndelete\ line\ 228:\ #define\ CALLVJPEG(sp,\ op)\ CALLJPEG(sp,\ 0,\ ((op),1))\nand\ replace\ by:\ \ #define\ CALLVJPEG(sp,\ op)\ (SETJMP((sp)->exit_jmpbuf)\ ?\ (0)\ :\ ((op),1))\n\n----\n\n\[SZ\]:\ As\ of\ version\ 1.3,\ Img\ is\ '''very'''\ slow.\ I\ tried\ to\ use\ it\ to\ load\ images\ made\ by\ 3M+pixel\ digital\ camera\ and\ it\ loaded\ JPEG\ file\ in\ 75\ seconds!\ Same\ goes\ to\ loading\ of\ Targa\ images\ \n(I\ thought\ it\ was\ decoding\ routines\ that\ slow\ down\ process).\n\nI\ did\ a\ little\ investigation\ and\ found\ that\ Img\ uses\ Tk_PhotoPutBlock\ on\ every\ row\ it\ read,\ be\ it\ JPEG\ or\ Targa.\ My\ code\ (for\ Targa\ loading)\ that\ does\ Tk_PhotoPutBlock\ once\ complete\ image\ loaded\ works\ over\ 50\ times\ (yes,\ fifty\ times)\ faster\ than\ Img.\n\nThis\ design\ decision\ is\ spread\ thinly\ over\ all\ Img\ image\ format\ handlers,\ as\ far\ as\ I\ can\ tell.\ \nSo\ it\ is\ unreasonably\ to\ think\ that\ this\ Img\ inefficiency\ could\ be\ fixed\ quickly.\n\nOther\ route\ is\ to\ fix\ Tk_PhotoPutBlock.\ I\ haven't\ looked\ into\ it\ yet.\n\nTo\ do\ not\ let\ that\ stop\ anyone,\ I\ put\ some\ workaround\ (whole\ image\ loading\ for\ JPEG\ and\ Targa\ images)\ into\ the\ web:\ \[http://ubicon.biz/?p=16\].\ It's\ ready\ for\ Windows,\ but\ source\ code\ is\ there\ too.\n\n----\n\n\[Peter\ Newman\]\ 2005-06-07:\ That's\ interesting.\ I\ have\ 3\ GIF\ files\ which,\ when\ tiled\ onto\ a\ canvas,\ with\ ''Img'',\ take\ something\ like\ a\ MINUTE\ to\ render.\ Every\ other\ small\ GIF\ file\ will\ tile\ in\ less\ than\ a\ second.\ I\ was\ assuming\ that\ maybe\ these\ GIF\ files\ are\ corrupt.\ But\ I\ don't\ think\ so.\ \nSo\ the\ other\ alternative\ was\ that\ ''Img''\ has\ some\ bug\ in\ it.\ Which\ could\ perhaps\ be\ that\ ''Tk_PhotoPutBlock''\ thing\ you\ mention\ above.\ \n\n----\n\n\[NJG\]\ 2005-06-07:\ \n\nPerhaps\ this\ is\ the\ same\ problem\ as\ the\ one\ in\ the\ tk8.4.9\ bug\ report\ \[http://sourceforge.net/tracker/index.php?func=detail&aid=1081966&group_id=12997&atid=112997\]\ \nrelated\ to\ the\ changes\ in\ handling\ the\ transparency\ channel\ of\ photo\ images.\n\nSee\ also:\ \[Get\ the\ color\ of\ the\ pixel\ under\ the\ pointer\]\n\n----\n\[TV\]\ 2006-01-28:\ I\ was\ wondering\ whether\ someone\ has\ compiled\ Img\ on\ 64\ bit\ linux?\ (I\ want\ to\ use\ it\ fedora\ core\ 4,\ 64,\ and\ I\ think\ it\ wasn't\ just\ compilable,\ though\ it's\ been\ a\ while)\n\n----\n\n\[JA\]\ 2006-02-12:\ I\ tried\ to\ compile\ ''Img''\ with\ the\ Borland\ free\ compiler\ under\ Windows,\ not\ Mingw,\ but\ I'm\ not\ getting\ anywhere.\ \ Has\ anyone\ tried\ it\ and\ built\ it\ successfully\ with\ either\ the\ Borland\ and\ Microsoft\ free\ C/C++\ compilers?\n\n----\n\n\[PM\]\ 2006-03-02:\ I've\ submitted\ a\ patch\ on\ sourceforge\ Tkimg\ that\ fixes\nthe\ jpeg\ slowness\ problem\ giving\ about\ a\ 20x\ speedup,\ using\ the\ approach\nmentioned\ by\ \[SZ\]\ above.\ \ I\ note\ that\ PPM\ is\ also\ slow,\ but\ not\ by\ half\nas\ bad\ as\ jpeg.\ \ Other\ formats\ like\ gif\ and\ png\ seem\ ok\ as\ is.\n\n----\n\n\[LV\]:\ Has\ anyone\ written\ additional\ img\ format\ handlers?\ If\ so,\ have\ you\ submitted\ a\ feature\ request\ to\ the\ sf.net\ project\ asking\ for\ the\ new\ handler\ to\ be\ included?\n\n----\nImg\ -photo\ has\ problems\ under\ \[Mac\ OS\ X\]\;\ it\ renders\ everything\ as\na\ black\ image.\ \ \[\[Is\ there\ an\ entry\ in\ the\ \"bug\ database\"\ for\ this?\]\]\n\n----\n\nJohn\ 2008-4-11:\ How\ to\ configure\ for\ compiling/building\ with\ MS\ Visual\ C++\ v6\ -\ Running\ configure\ under\ bash/cygwin\ forces\ \"uname\ -s\"\ to\ generate\ a\ cygwin\ or\ mingw\ set\ of\ files\ -\ Help\ files\ for\ tkimg1.3\ indicate\ build\ with\ MS\ Visual\ C++\ v6\ platform\ is\ supported.\ -\ various\ google\ searches\ produce\ no\ clues,\ except\ for\ old\ (pre-1.2.4)\ Microsoft\ Windows\ builds\ -\ am\ trying\ to\ build\ against\ tcl/tk8.5.2\ core\n\n----\n\nMat\ 2008-06-05:\ I've\ found\ binaries\ (including\ win32)\ of\ this\ package\ at\ http://www.posoft.de/html/extTkImg.html\n\n\[PO\]:\ I\ upload\ binaries\ compiled\ from\ SVN\ head\ for\ Windows\ (32-bit),\ Linux\ (32-\ and\ 64-bit),\ Irix\ (n32)\ and\ Mac\ (Intel)\ to\ the\ above\ mentioned\ page\ on\ a\ regular\ basis.\ \n\n2011-12-04\ -\ Newest\ available\ binaries\ are\ for\ version\ 1.4\ (Revision\ 332).\n\n----\n\n\[stuart\]\ 2009-11-21\ 18:31:55:\n\nI\ am\ having\ trouble\ compiling\ IMG\ 1.3\ (source\ obtained\ from\ sourceforge)\ on\ my\ SunBlade\ 1000\ running\nSolaris\ 5.8.\ Its\ using\ an\ older,\ Forte\ 7\ compiler,\ but\ I\ don't\ think\nthe\ compiler\ itself\ is\ the\ issue.\ I\ get\ a\ number\ of\ errors\ like:\n\"sun.c\",\ line\ 576:\ undefined\ symbol:\ TK_PHOTO_COMPOSITE_OVERLAY\n\"sun.c\",\ line\ 576:\ prototype\ mismatch:\ 7\ args\ passed,\ 6\ expected\n\"sun.c\",\ line\ 685:\ undefined\ symbol:\ TK_PHOTO_COMPOSITE_OVERLAY\n\"sun.c\",\ line\ 685:\ prototype\ mismatch:\ 7\ args\ passed,\ 6\ expected\n\"sun.c\",\ line\ 784:\ undefined\ symbol:\n\nI\ can't\ find\ the\ string\ \ TK_PHOTO_COMPOSITE_OVERLAY\ any\ where\ in\ the\ndistribution.\n\nAny\ ideas?\n\n\[Duoas\]\ 2009-11-21\ 00:45\ Z:\n\nYour\ Tcl/Tk\ distribution\ must\ be\ 8.2\ or\ later\ to\ compile\ IMG\ 1.3\ (as\ indicated\ above).\ Download\ the\ latest\ Tcl/Tk\ sources\ and\ compile\ them.\ Good\ luck!\n\n\n**\ See\ Also\ **\n\n\ \ \ \[zlibtcl\]:\ \ \ \n\n\ \ \ \[tclimage\]:\ \ \ as\ far\ as\ I\ can\ tell,\ tclimage\ is\ a\ different\ code\ base\ than\ Img.\n----\n\n\{Steve\ Cohen\}\ 2012-04-30\ 15:35\n\nWould\ anyone\ have\ any\ ideas\ for\ speeding\ up\ the\ reading\ of\ interlaced\ JPEG\ files?\ \ When\ I\ have\ two\ files\ of\ almost\ identical\ resolution\ the\ interlaced\ version\ takes\ about\ ten\ times\ as\ long\ to\ read\ as\ the\ non-interlaced\ version...\ \ Curious.\n\n----\n\n\[AK\]\ 2012-05-01\ 17:42:14:\n\nThe\ img::jpeg\ type\ uses\ the\ official\ libjpeg\ (*)\ to\ perform\ reading,\ as\ such\ I\ would\ suspect\ that\ this\ is\ where\ the\ inefficiency\ lies.\n\n(Ad\ *)\ The\ version\ of\ the\ library\ in\ use\ is\ part\ of\ the\ Img\ sources\ and\ build\ into\ a\ package\ 'jpegtcl'\ which\ has\ no\ Tcl\ level\ commands,\ only\ a\ C-level\ stubs\ table\ the\ img::jpeg\ can\ call\ on.\n\n------\n\n\[uniquename\]\ 2014-01-08:\n\nI\ would\ like\ to\ refer\ readers\ of\ this\ page\ to\ my\ suggestion\ for\ a\ JFIF-read\ capability\ in\ the\n'wish'\ interpreter\ ---\ item\ 92\ on\ the\ wiki\ page\ \[Tk\ 9.0\ WishList\].\ I\ think\ that\ you\ may\ find\nthe\ references\ there\ (on\ JPEG-JFIF\ and\ JPEG-2000\ information)\ enlightening,\ as\ I\ did\ ---\nin\ particular,\ the\ historical-insight\ quote\ from\ the\ 1999\ book\ by\ John\ Miano.\n\n------\n\n\[bll\]\ 2014-2-6:\n\nThis\ package\ (version\ 1.3)\ is\ broken\ on\ recent\ debian/ubuntu/linuxmint.\nGo\ to:\ http://packages.debian.org/jessie/libtk-img\nand\ scroll\ down\ to\ the\ bottom\ of\ the\ page\ to\ download\ a\ fixed\ version\ (version\ 1.4.2).\nUse\ dpkg\ -i\ <filename>\ to\ install\ it.\n\n<<categories>>\ Package\ |\ Graphics\ |\ Image\ Processing regexp2} CALL {my render Img The\ venerable\ Img\ \[package\]\ by\ \[Jan\ Nijtmans\]\ provides\ the\ handling\ of\ several\ image\ formats\ beyond\ the\ standard\ formats\ in\ \[Tk\].\n\n\[Img\]\ source\ code\ (latest\ version:\ '''1.4.2''')\ is\ available\ at\ \[SourceForge\]:\n\n\ \ \ *\ '''http://sourceforge.net/projects/tkimg/'''\n\nIn\ Debian\ (and\ related\ distros)\ it\ is\ packaged\ as\ '''libtk-img'''.\n\nThe\ original\ homepage,\ now\ of\ historical\ interest,\ was\ at:\ \ http://members1.chello.nl/~j.nijtmans/img.html\n\nThere\ are\ also\ \[starkit\]s\ running\ around.\ \ \[Steve\ Redler\],\ for\ example,\ has\ tentatively\ committed\ to\ provision\ a\ directory\nof\ '''tk.img'''s\ toward\ the\ end\ of\ October\ 2005,\ perhaps\ in\ the\ vicinity\ of\ http://server.linuxsys.net/files\ .\n\n\n**\ Synopsis\ **\n\n======\n%\ package\ require\ Tk\n%\ 8.6.3\n%\ image\ create\ photo\ -file\ wish.ico\nERROR:\ couldn't\ recognize\ data\ in\ image\ file\ \"wish.ico\"\n%\ package\ require\ Img\n1.4.2\n%\ image\ create\ photo\ im\ -file\ wish.ico\nimage1\n======\n\n\n**\ Description\ **\n\nImg\ is\ a\ Tk\ extension,\ adding\ support\ for\ many\ other\ Image\ format.\nThe\ list\ below\ includes\ ''many''\ of\ the\ supported\ formats,\ but\ is\ not\ formally\ kept\ in\ sync\ with\ the\ code:\n\n\ \ \ *\ \[bmp\]:\ Windows\ bitmap\ format.\ See\ img-bmp\ .\n\ \ \ *\ \[gif\]:\ The\ venerable\ graphics\ interchange\ format\ (with\ transparency,\ but\ without\ LZW.\ The\ latter\ due\ to\ patent\ issues).\ See\ img-gif\ .\n\ \ \ *\ \[ico\]:\ Windows\ icon\ files.\ See\ img-ico\ .\n\ \ \ *\ \[jpeg\]:\ The\ format\ for\ lossy\ compressed\ still\ pictures\ specified\ by\ the\ Joint\ Picture\ Experts\ Group.\ See\ img-jpeg\ .\n\ \ \ *\ pcx:\ Paintbrush\ image\ format.\ See\ img-pcx\ .\n\ \ \ *\ \[pixmap\]:\ While\ the\ other\ formats\ are\ handlers\ for\ the\ Tk\ photo\ image\ type\ this\ is\ a\ new\ image\ type\ for\ Tk.\ See\ img-pixmap\ .\n\ \ \ *\ \[png\]:\ Portable\ Network\ Graphics,\ successor\ to\ GIF.\ See\ img-png\ .\n\ \ \ *\ \[ppm\]:\ Portable\ Pixmaps.\ See\ img-ppm\ .\n\ \ \ *\ ps:\ \[Postscript\]\ and\ \[PDF\]\ (Portable\ document\ format).\ Requires\ an\ external\ application,\ ghostview,\ for\ its\ operation.\ See\ img-ps\ .\n\ \ \ *\ sgi:\ Native\ SGI\ format.\ See\ img-sgi\ .\n\ \ \ *\ sun:\ Sun\ raster\ images.\ See\ img-sun\ .\n\ \ \ *\ tga:\ Targa\ files.\ See\ img-tga\ .\n\ \ \ *\ \[tiff\]:\ Tagged\ Interchange\ File\ Format.\ See\ img-tiff\ .\n\ \ \ *\ window:\ ???\ (not\ a\ file\ but\ window\ snapshot)\ See\ img-window\ .\n\ \ \ *\ \[xbm\]:\ X\ Bitmaps.\ See\ img-xbm\ .\n\ \ \ *\ \[xpm\]:\ X\ Pixmaps.\ See\ img-xpm\ .\ \n\nVersion\ 1.4.x\ only\ works\ with\ Tcl/Tk\ 8.3\ or\ higher.\n\nVersion\ 1.3\ only\ works\ with\ Tcl/Tk\ 8.2\ or\ higher.\ \n\nIf\ you\ are\ using\ Tk\ 8.1\ or\ lower\ please\ stick\ with\ Img\ 1.2.4\ (which\ is\ still\ available).\ \n\nAnd\ if\ you\ are\ using\ Tk4.2\ or\ lower,\ please\ stick\ with\ Img\ 1.1.4\ (which\ is\ also\ still\ available).\ \n\n\n----\ \n\n**\ Discussion\ **\n\n\n***\ GIF\ and\ PNG\ Support\ ***\n\n\[Tk\]\ provides\ built-in\ support\ for\ \[GIF\],\ and\ \[TkPNG\]\ is\ a\ good\ alternative\ to\ Img\ for\ \[PNG\]\ support.\n\n\[AMG\]:\ Recent\ versions\ of\ \[Tk\]\ have\ built-in\ \[PNG\]\ support,\ which\ was\ derived\ from\ TkPNG.\n\n\[peterc\]\ 2009-09-01:\ Possibly\ worth\ noting\ that\ the\ Unisys\ GIF/LZW\ patents\ expired\ in\ mid\ 2004\ \[http://en.wikipedia.org/wiki/Graphics_Interchange_Format#Unisys_and_LZW_patent_enforcement\].\ PNG\ is\ generally\ preferred\ over\ GIF\ by\ most\ graphics\ people\ anyhow\ as\ it\ supports\ Alpha\ channel\ transparency.\ \n\n----\n\n***\ Example:\ \ converting\ graphics\ formats\ ***\n\nI\ often\ have\ a\ need\ to\ convert\ from\ one\ graphics\ format\ to\ another.\ \ \nAs\ long\ as\ I\ have\ ActiveTcl\ around,\ the\ chore\ is\ easy\;\ all\ I\ need\ is\ a\nscript\ on\ the\ order\ of\n\n\ \ \ \ package\ require\ Img\n\n\ \ \ \ cd\ /temp\n\n\ \ \ \ foreach\ file\ \[glob\ *.bmp\]\ \{\n\ \ \ \ \ \ \ \ set\ root\ \[file\ rootname\ \$file\]\n\ \ \ \ \ \ \ \ set\ image\ \[image\ create\ photo\ -file\ \$file\]\n\ \ \ \ \ \ \ \ foreach\ \{format\ suffix\}\ \{JPEG\ jpg\ GIF\ gif\ PNG\ png\}\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ \$image\ write\ \$root.\$suffix\ -format\ \$format\n\ \ \ \ \ \ \ \ \}\n\ \ \ \ \}\n\n----\n\n***\ Capturing\ a\ window\ (or\ canvas)\ to\ an\ image\ ***\n\n****\ Synopsis\ *****\n\n======\n#\ \$W\ is\ a\ Tk\ window\ ID\nimage\ create\ photo\ -format\ window\ -data\ \$W\n======\n\n\[tklib\]'s\ `canvas::snap`\ is\ based\ on\ \[George\ Petasis\]'\ version\ of\ `canvas2Photo`\ below.\n\n\ \ \ *\ \[Capture\ a\ window\ into\ an\ image\]\n\ \ \ *\ \[A\ little\ magnifying\ glass\]\n\n*****\ Discussion\ ******\n\n\n(posted\ by\ \[Mark\ G.\ Saye\]\ in\ \[comp.lang.tcl\]):\n\n======\nproc\ capture\ \{W\ format\ file\}\ \{\n\ \ \ \ set\ image\ \[image\ create\ photo\ -format\ window\ -data\ \$W\]\n\ \ \ \ \$image\ write\ -format\ \$format\ \$file\n\ \ \ \ puts\ \"capture\ ->\ '\$file'\ (\[file\ size\ \$file\]\ bytes)\"\n\ \ \ \ image\ delete\ \$image\n\}\n\npackage\ require\ -exact\ Img\ 1.2.4\n\nset\ top\ .t\ntoplevel\ \$top\nframe\ \$top.f\npack\ \ \$top.f\ -fill\ both\ -expand\ 1\n\nlabel\ \$top.f.hello\ -text\ \"Hello\ World\"\npack\ \ \$top.f.hello\ -s\ top\ -e\ 0\ -f\ none\ -padx\ 10\ -pady\ 10\nupdate\nbind\ \$top\ <Key-x>\ \[list\ capture\ \$top\ gif\ capture.gif\]\n======\n\n----\nSaves\ a\ white\ image\ only,\ however\ \;-(.\ \n\[Paul\ Obermeier\]\ has\ this:\n\n======\nproc\ canvas2Photo\ \{\ canvId\ \}\ \{\n\ \ \ \ #\ The\ following\ line\ grabs\ the\ contents\ of\ the\ canvas\ canvId\ into\ photo\ image\ ph.\n\ \ \ \ set\ retVal\ \[catch\ \{image\ create\ photo\ -format\ window\ -data\ \$canvId\}\ ph\]\n\ \ \ \ if\ \{\ \$retVal\ !=\ 0\ \}\ \{\n\ \ \ \ \ \ \ \ puts\ \"\\n\\tFATAL\ ERROR:\ Cannot\ create\ photo\ from\ canvas\ window\"\n\ \ \ \ \ \ \ \ exit\ 1\n\ \ \ \ \}\ \n\ \ \ \ return\ \$ph\n\}\n======\n\n\[RS\]:\ experimented\ with\ this\ and\ found\ that\ it\ can\ convert\ \[canvas\],\ \[text\]\ and\ \[listbox\]\ widgets,\ \nbut\ not\ a\ compound\ \[toplevel\].\ Hence,\ the\ name\ might\ better\ be\ ''widget2photo''...\ or,\ \nby\ using\ default\ error\ handlers,\ be\ simplified\ to\ an\ \[interp\]\ alias:\n\n======\ninterp\ alias\ \{\}\ capture\ \{\}\ image\ create\ photo\ -format\ window\ -data\n======\n\n----\n\[George\ Petasis\]\ 2004-10-24:\ \n\nI\ have\ written\ an\ improved\ version\ of\ the\ canvas2Photo\ procedure.\ \nThis\ one\ is\ able\ to\ capture\ *all*\ canvas\ items\ in\ the\ image,\ and\ not\ the\ visible\ part\ only...\n\n''NOTE'':\ this\ is\ now\ included\ in\ \[tklib\]\ as\ `canvas::snap`.\n\n======\nproc\ canvas2Photo\ \{canvas\ image\}\ \{\n\ \ \ \ ##\ Ensure\ that\ the\ window\ is\ on\ top\ of\ everything\ else,\ so\ as\ not\ to\ get\n\ \ \ \ ##\ white\ ranges\ in\ the\ image,\ due\ to\ overlapped\ portions\ of\ the\ window\ with\n\ \ \ \ ##\ other\ windows...\n\ \ \ \ raise\ \[winfo\ toplevel\ \$canvas\]\ \n\ \ \ \ update\n\ \ \ \ set\ border\ \[expr\ \{\[\$canvas\ cget\ -borderwidth\]\ +\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \[\$canvas\ cget\ -highlightthickness\]\}\]\n\ \ \ \ set\ view_height\ \[expr\ \{\[winfo\ height\ \$canvas\]-2*\$border\}\]\n\ \ \ \ set\ view_width\ \ \[expr\ \{\[winfo\ width\ \ \$canvas\]-2*\$border\}\]\n\ \ \ \ foreach\ \{x1\ y1\ x2\ y2\}\ \[\$canvas\ bbox\ all\]\ \{break\}\n\ \ \ \ set\ x1\ \[expr\ \{int(\$x1-10)\}\]\n\ \ \ \ set\ y1\ \[expr\ \{int(\$y1-10)\}\]\n\ \ \ \ set\ x2\ \[expr\ \{int(\$x2+10)\}\]\n\ \ \ \ set\ y2\ \[expr\ \{int(\$y2+10)\}\]\n\ \ \ \ set\ width\ \ \[expr\ \{\$x2-\$x1\}\]\n\ \ \ \ set\ height\ \[expr\ \{\$y2-\$y1\}\]\n\ \ \ \ image\ create\ photo\ \$image\ \\\n\ \ \ \ \ \ \ \ \ \ \ \ -height\ \$height\ -width\ \$width\n\ \ \ \ ##\ Arrange\ the\ scrollregion\ of\ the\ canvas\ to\ get\ the\ whole\ window\ visible,\n\ \ \ \ ##\ so\ as\ to\ grab\ it\ into\ an\ image...\n\ \ \ \ set\ scrollregion\ \[\$canvas\ cget\ -scrollregion\]\n\ \ \ \ set\ xscrollcommand\ \[\$canvas\ cget\ -xscrollcommand\]\n\ \ \ \ set\ yscrollcommand\ \[\$canvas\ cget\ -yscrollcommand\]\n\ \ \ \ \$canvas\ configure\ -xscrollcommand\ \{\}\n\ \ \ \ \$canvas\ configure\ -yscrollcommand\ \{\}\n\ \ \ \ set\ grabbed_x\ \$x1\n\ \ \ \ set\ grabbed_y\ \$y1\n\ \ \ \ set\ image_x\ 0\n\ \ \ \ set\ image_y\ 0\n\ \ \ \ while\ \{\$grabbed_y\ <\ \$y2\}\ \{\n\ \ \ \ \ \ \ \ while\ \{\$grabbed_x\ <\ \$x2\}\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ \$canvas\ configure\ -scrollregion\ \[\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ list\ \$grabbed_x\ \$grabbed_y\ \[\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ expr\ \{\$grabbed_x\ +\ \$view_width\}\]\ \[\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ expr\ \{\$grabbed_y\ +\ \$view_height\}\]\]\n\ \ \ \ \ \ \ \ \ \ \ \ update\n\ \ \ \ \ \ \ \ \ \ \ \ ##\ Take\ a\ screenshot\ of\ the\ visible\ canvas\ part...\n\ \ \ \ \ \ \ \ \ \ \ \ image\ create\ photo\ \$\{image\}_tmp\ \\\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ -format\ window\ -data\ \$canvas\n\ \ \ \ \ \ \ \ \ \ \ \ ##\ Copy\ the\ screenshot\ to\ the\ target\ image...\n\ \ \ \ \ \ \ \ \ \ \ \ \$image\ copy\ \$\{image\}_tmp\ \\\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ -to\ \$image_x\ \$image_y\ -from\ \$border\ \$border\n\ \ \ \ \ \ \ \ \ \ \ \ incr\ grabbed_x\ \$view_width\n\ \ \ \ \ \ \ \ \ \ \ \ incr\ image_x\ \ \ \$view_width\n\ \ \ \ \ \ \ \ \}\n\ \ \ \ \ \ \ \ set\ grabbed_x\ \$x1\n\ \ \ \ \ \ \ \ set\ image_x\ 0\n\ \ \ \ \ \ \ \ incr\ grabbed_y\ \$view_height\n\ \ \ \ \ \ \ \ incr\ image_y\ \ \ \$view_height\n\ \ \ \ \}\n\ \ \ \ \$canvas\ configure\ -scrollregion\ \$scrollregion\n\ \ \ \ \$canvas\ configure\ -xscrollcommand\ \$xscrollcommand\n\ \ \ \ \$canvas\ configure\ -yscrollcommand\ \$yscrollcommand\n\ \ \ \ return\ \$image\n\}\n======\n\n\n----\n\n***\ Uncategorised\ discussion\ ***\n\nCan\ anyone\ provide\ examples\ of\ how\ to\ use\ this\ package\ with\ Tk\ to\ display\nsome\ of\ the\ above\ image\ types?\ \ \ \n\n\[MG\]:\ Sure..\n\n======\npackage\ require\ Img\nimage\ create\ photo\ myJpeg\ -file\ \"image.jpeg\"\npack\ \[label\ .l\ -image\ myJpeg\]\ \;#\ to\ show\ it\ works\ ok\n======\n\nIt's\ as\ simple\ as\ that\ :)\ As\ for\ writing\ images\ (after\ you've\ executed\ the\ above\ code)...\n\n======\nmyJpeg\ write\ \"image.png\"\ -format\ PNG\n======\n\nWhere\ can\ one\ get\ freely\ distributable\ win32\ binaries?\n\n\[MG\]:\ Img\ is\ included\ in\ the\ \[ActiveTcl\]\ binaries.\ I\ don't\ know\ where\ you\ can\ find\ \na\ binary\ of\ Img\ on\ its\ own,\ though...\n\n\[\[Would\ be\ valuable\ to\ compare\ its\ capabilities\ with\ \[Xbit\]'s.\]\]\n\nA\ comparison\ with\ \[TclMagick\]\ would\ also\ be\ useful.\n\n----\n\n\[sheila\]\ 2004-10-18:\n\nWhat\ is\ the\ default\ format\ that\ is\ returned\ when\ one\ uses\ the\n\n======\n\$image_256.bmp\ data\n======\n\nas\ opposed\ to\ specifying\ ''-format\ bmp''?\ Looks\ like\ a\ list\ of\ lists,\ and\ the\ elements\ of\ the\ list\ are\ #rrggbb\ values.\ When\ I\ use\ ''-format\ bmp''\ I'm\ guessing\ I\ get\ base64\ encoded\ data.\ \nYou\ can\ go\ from\ this\ format\ to\ hex\ in\ order\ to\ manipulate\ bits\ in\ hex\ maybe\n\n======\npackage\ require\ base64\n=====\n\nthis\ is\ a\ row\ from\ the\ first\ line\ of\ a\ dump\ from\ \$image\ data\ -format\ bmp.\ \n(this\ is\ just\ a\ rendition,\ since\ the\ actual\ characters\ aren't\ printable\ to\ this\ screen)\n\n======none\n%\ set\ row\nQk322AEAAAAAADYEAAAoAAAAkAEAACwBAAABAAgAAAAAAMDUAQBtCwAAbQsAAAABAAAAAQAA\n\n%\ set\ d64\ \[base64::decode\ \$row\]\n\nM\ and\ binary\ formated\ data\n\n%\ binary\ scan\ \$d64\ H*\ hex\n1\n%\ set\ hex\n424df6d80100000000003604000028000000900100002c0100000100080000000000c0d401006d0b00006d0b00000001000000010000\n======\n\nThis\ example\ is\ a\ Windows\ BMP\ 24-bit\ format.\ After\ you\ get\ this,\ you\ can\ parse\ the\ file\ to\ access\ data\ of\ interest.\ I\ was\ curious\ about\ how\ to\ do\ a\ difference\ operation\ on\ two\ bitmaps,\ and\ wanted\ to\ xor\ the\ rgp\ data,\ so\ I\ was\ going\ to\ do\ a\ parser\ for\ the\ BMP\ file.\ I\ didn't\ do\ that\ after\ discovering\ the\ TclMagick\ extension\ for\ accessing\ the\ ImageMagick\ API\ (Hmm,\ I'd\ like\ to\ reduce\ the\ footprint\ of\ my\ ImageMagick\ install).\n\nI'm\ still\ curious\ though.\ Having\ the\ rgb\ data\ already\ conveniently\ returned\ in\ #rrggbb\ elements\ is\ nice.\ Is\ there\ a\ way\ to\ convert\ that\ back\ to\ a\ format\ that\ can\ be\ used\ to\ create\ new\ bmp\ images\ automatically,\ or\ would\ I\ have\ to\ write\ a\ generator\ for\ creating\ a\ new\ BMP\ file\ to\ pass\ to\ image\ create?\n\n\[AF\]:\ The\ \[tklib\]\ \[ico\]\ package\ will\ read\ and\ write\ BMPs\ to/from\ lists\ of\ rgb\ colors\ and\ tk\ images.\n\n----\n\n\[Serge\ Kazantzev\]:\ In\ order\ to\ compile\ tkimg1.3\ on\ MacOSX/Jaguar\ with\ Tcl/Tk\ 8.4,\ ''tiff/tiffjpeg.c''\ must\ be\ modified\ as\ follows:\ndelete\ line\ 228:\ #define\ CALLVJPEG(sp,\ op)\ CALLJPEG(sp,\ 0,\ ((op),1))\nand\ replace\ by:\ \ #define\ CALLVJPEG(sp,\ op)\ (SETJMP((sp)->exit_jmpbuf)\ ?\ (0)\ :\ ((op),1))\n\n----\n\n\[SZ\]:\ As\ of\ version\ 1.3,\ Img\ is\ '''very'''\ slow.\ I\ tried\ to\ use\ it\ to\ load\ images\ made\ by\ 3M+pixel\ digital\ camera\ and\ it\ loaded\ JPEG\ file\ in\ 75\ seconds!\ Same\ goes\ to\ loading\ of\ Targa\ images\ \n(I\ thought\ it\ was\ decoding\ routines\ that\ slow\ down\ process).\n\nI\ did\ a\ little\ investigation\ and\ found\ that\ Img\ uses\ Tk_PhotoPutBlock\ on\ every\ row\ it\ read,\ be\ it\ JPEG\ or\ Targa.\ My\ code\ (for\ Targa\ loading)\ that\ does\ Tk_PhotoPutBlock\ once\ complete\ image\ loaded\ works\ over\ 50\ times\ (yes,\ fifty\ times)\ faster\ than\ Img.\n\nThis\ design\ decision\ is\ spread\ thinly\ over\ all\ Img\ image\ format\ handlers,\ as\ far\ as\ I\ can\ tell.\ \nSo\ it\ is\ unreasonably\ to\ think\ that\ this\ Img\ inefficiency\ could\ be\ fixed\ quickly.\n\nOther\ route\ is\ to\ fix\ Tk_PhotoPutBlock.\ I\ haven't\ looked\ into\ it\ yet.\n\nTo\ do\ not\ let\ that\ stop\ anyone,\ I\ put\ some\ workaround\ (whole\ image\ loading\ for\ JPEG\ and\ Targa\ images)\ into\ the\ web:\ \[http://ubicon.biz/?p=16\].\ It's\ ready\ for\ Windows,\ but\ source\ code\ is\ there\ too.\n\n----\n\n\[Peter\ Newman\]\ 2005-06-07:\ That's\ interesting.\ I\ have\ 3\ GIF\ files\ which,\ when\ tiled\ onto\ a\ canvas,\ with\ ''Img'',\ take\ something\ like\ a\ MINUTE\ to\ render.\ Every\ other\ small\ GIF\ file\ will\ tile\ in\ less\ than\ a\ second.\ I\ was\ assuming\ that\ maybe\ these\ GIF\ files\ are\ corrupt.\ But\ I\ don't\ think\ so.\ \nSo\ the\ other\ alternative\ was\ that\ ''Img''\ has\ some\ bug\ in\ it.\ Which\ could\ perhaps\ be\ that\ ''Tk_PhotoPutBlock''\ thing\ you\ mention\ above.\ \n\n----\n\n\[NJG\]\ 2005-06-07:\ \n\nPerhaps\ this\ is\ the\ same\ problem\ as\ the\ one\ in\ the\ tk8.4.9\ bug\ report\ \[http://sourceforge.net/tracker/index.php?func=detail&aid=1081966&group_id=12997&atid=112997\]\ \nrelated\ to\ the\ changes\ in\ handling\ the\ transparency\ channel\ of\ photo\ images.\n\nSee\ also:\ \[Get\ the\ color\ of\ the\ pixel\ under\ the\ pointer\]\n\n----\n\[TV\]\ 2006-01-28:\ I\ was\ wondering\ whether\ someone\ has\ compiled\ Img\ on\ 64\ bit\ linux?\ (I\ want\ to\ use\ it\ fedora\ core\ 4,\ 64,\ and\ I\ think\ it\ wasn't\ just\ compilable,\ though\ it's\ been\ a\ while)\n\n----\n\n\[JA\]\ 2006-02-12:\ I\ tried\ to\ compile\ ''Img''\ with\ the\ Borland\ free\ compiler\ under\ Windows,\ not\ Mingw,\ but\ I'm\ not\ getting\ anywhere.\ \ Has\ anyone\ tried\ it\ and\ built\ it\ successfully\ with\ either\ the\ Borland\ and\ Microsoft\ free\ C/C++\ compilers?\n\n----\n\n\[PM\]\ 2006-03-02:\ I've\ submitted\ a\ patch\ on\ sourceforge\ Tkimg\ that\ fixes\nthe\ jpeg\ slowness\ problem\ giving\ about\ a\ 20x\ speedup,\ using\ the\ approach\nmentioned\ by\ \[SZ\]\ above.\ \ I\ note\ that\ PPM\ is\ also\ slow,\ but\ not\ by\ half\nas\ bad\ as\ jpeg.\ \ Other\ formats\ like\ gif\ and\ png\ seem\ ok\ as\ is.\n\n----\n\n\[LV\]:\ Has\ anyone\ written\ additional\ img\ format\ handlers?\ If\ so,\ have\ you\ submitted\ a\ feature\ request\ to\ the\ sf.net\ project\ asking\ for\ the\ new\ handler\ to\ be\ included?\n\n----\nImg\ -photo\ has\ problems\ under\ \[Mac\ OS\ X\]\;\ it\ renders\ everything\ as\na\ black\ image.\ \ \[\[Is\ there\ an\ entry\ in\ the\ \"bug\ database\"\ for\ this?\]\]\n\n----\n\nJohn\ 2008-4-11:\ How\ to\ configure\ for\ compiling/building\ with\ MS\ Visual\ C++\ v6\ -\ Running\ configure\ under\ bash/cygwin\ forces\ \"uname\ -s\"\ to\ generate\ a\ cygwin\ or\ mingw\ set\ of\ files\ -\ Help\ files\ for\ tkimg1.3\ indicate\ build\ with\ MS\ Visual\ C++\ v6\ platform\ is\ supported.\ -\ various\ google\ searches\ produce\ no\ clues,\ except\ for\ old\ (pre-1.2.4)\ Microsoft\ Windows\ builds\ -\ am\ trying\ to\ build\ against\ tcl/tk8.5.2\ core\n\n----\n\nMat\ 2008-06-05:\ I've\ found\ binaries\ (including\ win32)\ of\ this\ package\ at\ http://www.posoft.de/html/extTkImg.html\n\n\[PO\]:\ I\ upload\ binaries\ compiled\ from\ SVN\ head\ for\ Windows\ (32-bit),\ Linux\ (32-\ and\ 64-bit),\ Irix\ (n32)\ and\ Mac\ (Intel)\ to\ the\ above\ mentioned\ page\ on\ a\ regular\ basis.\ \n\n2011-12-04\ -\ Newest\ available\ binaries\ are\ for\ version\ 1.4\ (Revision\ 332).\n\n----\n\n\[stuart\]\ 2009-11-21\ 18:31:55:\n\nI\ am\ having\ trouble\ compiling\ IMG\ 1.3\ (source\ obtained\ from\ sourceforge)\ on\ my\ SunBlade\ 1000\ running\nSolaris\ 5.8.\ Its\ using\ an\ older,\ Forte\ 7\ compiler,\ but\ I\ don't\ think\nthe\ compiler\ itself\ is\ the\ issue.\ I\ get\ a\ number\ of\ errors\ like:\n\"sun.c\",\ line\ 576:\ undefined\ symbol:\ TK_PHOTO_COMPOSITE_OVERLAY\n\"sun.c\",\ line\ 576:\ prototype\ mismatch:\ 7\ args\ passed,\ 6\ expected\n\"sun.c\",\ line\ 685:\ undefined\ symbol:\ TK_PHOTO_COMPOSITE_OVERLAY\n\"sun.c\",\ line\ 685:\ prototype\ mismatch:\ 7\ args\ passed,\ 6\ expected\n\"sun.c\",\ line\ 784:\ undefined\ symbol:\n\nI\ can't\ find\ the\ string\ \ TK_PHOTO_COMPOSITE_OVERLAY\ any\ where\ in\ the\ndistribution.\n\nAny\ ideas?\n\n\[Duoas\]\ 2009-11-21\ 00:45\ Z:\n\nYour\ Tcl/Tk\ distribution\ must\ be\ 8.2\ or\ later\ to\ compile\ IMG\ 1.3\ (as\ indicated\ above).\ Download\ the\ latest\ Tcl/Tk\ sources\ and\ compile\ them.\ Good\ luck!\n\n\n**\ See\ Also\ **\n\n\ \ \ \[zlibtcl\]:\ \ \ \n\n\ \ \ \[tclimage\]:\ \ \ as\ far\ as\ I\ can\ tell,\ tclimage\ is\ a\ different\ code\ base\ than\ Img.\n----\n\n\{Steve\ Cohen\}\ 2012-04-30\ 15:35\n\nWould\ anyone\ have\ any\ ideas\ for\ speeding\ up\ the\ reading\ of\ interlaced\ JPEG\ files?\ \ When\ I\ have\ two\ files\ of\ almost\ identical\ resolution\ the\ interlaced\ version\ takes\ about\ ten\ times\ as\ long\ to\ read\ as\ the\ non-interlaced\ version...\ \ Curious.\n\n----\n\n\[AK\]\ 2012-05-01\ 17:42:14:\n\nThe\ img::jpeg\ type\ uses\ the\ official\ libjpeg\ (*)\ to\ perform\ reading,\ as\ such\ I\ would\ suspect\ that\ this\ is\ where\ the\ inefficiency\ lies.\n\n(Ad\ *)\ The\ version\ of\ the\ library\ in\ use\ is\ part\ of\ the\ Img\ sources\ and\ build\ into\ a\ package\ 'jpegtcl'\ which\ has\ no\ Tcl\ level\ commands,\ only\ a\ C-level\ stubs\ table\ the\ img::jpeg\ can\ call\ on.\n\n------\n\n\[uniquename\]\ 2014-01-08:\n\nI\ would\ like\ to\ refer\ readers\ of\ this\ page\ to\ my\ suggestion\ for\ a\ JFIF-read\ capability\ in\ the\n'wish'\ interpreter\ ---\ item\ 92\ on\ the\ wiki\ page\ \[Tk\ 9.0\ WishList\].\ I\ think\ that\ you\ may\ find\nthe\ references\ there\ (on\ JPEG-JFIF\ and\ JPEG-2000\ information)\ enlightening,\ as\ I\ did\ ---\nin\ particular,\ the\ historical-insight\ quote\ from\ the\ 1999\ book\ by\ John\ Miano.\n\n------\n\n\[bll\]\ 2014-2-6:\n\nThis\ package\ (version\ 1.3)\ is\ broken\ on\ recent\ debian/ubuntu/linuxmint.\nGo\ to:\ http://packages.debian.org/jessie/libtk-img\nand\ scroll\ down\ to\ the\ bottom\ of\ the\ page\ to\ download\ a\ fixed\ version\ (version\ 1.4.2).\nUse\ dpkg\ -i\ <filename>\ to\ install\ it.\n\n<<categories>>\ Package\ |\ Graphics\ |\ Image\ Processing} CALL {my revision Img} CALL {::oo::Obj3915902 process revision/Img} CALL {::oo::Obj3915900 process}

-errorcode

NONE

-errorinfo

Unknow state transition: LINE -> END
    while executing
"error $msg"
    (class "::Wiki" method "render_wikit" line 6)
    invoked from within
"my render_$default_markup $N $C $mkup_rendering_engine"
    (class "::Wiki" method "render" line 8)
    invoked from within
"my render $name $C"
    (class "::Wiki" method "revision" line 31)
    invoked from within
"my revision $page"
    (class "::Wiki" method "process" line 56)
    invoked from within
"$server process [string trim $uri /]"

-errorline

4