LRIPhoto est un paquet pour Tk écrit avec critcl par La Rochelle Innovation pour la manipulation rapide d'images Tk.
Après chargement, (avec package require LRIPhoto) la version actuelle fournit deux commandes :
::LRI::imgtransform imgTk ?-rotate angle? ?-scale echelle? ?-gray booléen? ?-bw booléen?
et
::LRI::imgcopy imgTkSrc imgTkDest ?-rotate angle? ?-scale echelle? ?-gray booléen? ?-bw booléen?
Les manipulations sont identiques pour les deux commandes, sauf que imgtransform modifie une image alors qu'imgcopy modifie imgTkDest sans toucher à l'image source imgTkSrc.
Dans tous les cas, les images doivent exister avant d'invoquer les commandes.
Effets des commandes :
A noter :
::LRI::imgcopy imgTkSrc imgTkDest
Utilisée sans option, imgcopy se contente de copier l'image imgTkSrc dans imgTkDest
Téléchargement :
http://wfr.tcl-lang.org/files/LRIPhoto.zip
L'archive comprend les binaires pré-compilés pour linux (32 et 64 bits), windows (32 et 64 bits) et Mac OSX (32 et 64 bits) ; les sources sont également incluses.
Toute contribution (améliorations, nouvelles fonctions, ou binaires pour d'autres plate-formes) seront les bienvenues.
Licence :
Cette extension est placée sous licence OLL.
Voici un programme pour tester les effets des commandes :
package require Tk catch {package require Img} ; # Without you can only works with PNG & GIF. package require LRIPhoto # var variable ::imgN none variable ::angle 0 variable ::gray 0 variable ::bw 0 variable ::scale 100 image create photo imgTkDest # Procs proc openImage {} { set ext { {{Images} {*.gif *.bmp *.tif *.jpg *.png}} } set title "Choose a bitmap" catch "image delete imgTkSrc" set baseimg [tk_getOpenFile -filetypes $ext -title $title -parent .] if {[file exists $baseimg] && ![catch {image create photo imgTkSrc -file $baseimg}]} { set ::imgN [file tail $baseimg] .do configure -state normal update } else { set ::imgN none .do configure -state disabled update } } proc DoIt {} { catch "::LRI::imgcopy imgTkSrc imgTkDest -rotate $::angle \ -scale $::scale -gray $::gray -bw $::bw" } # Gui wm title . "LRIPhoto demo" grid [frame .f1] -sticky w button .f1.b -text image -command openImage label .f1.i -textvariable ::imgN grid .f1.b .f1.i -sticky w grid [frame .f2] -sticky w label .f2.l -text "Angle :" radiobutton .f2.a0 -text 0° -value 0 -variable ::angle radiobutton .f2.a90 -text 90° -value 90 -variable ::angle radiobutton .f2.a180 -text 180° -value 180 -variable ::angle radiobutton .f2.a270 -text 270° -value 270 -variable ::angle grid .f2.l .f2.a0 .f2.a90 .f2.a180 .f2.a270 -sticky w scale .s -label "scale (%)" -from 1 -to 200 -showvalue 1 -variable ::scale \ -orient horizontal -relief raised grid .s -sticky ew grid [frame .f3] -sticky w label .f3.l -text "Convert to :" checkbutton .f3.g -text Gray -variable ::gray checkbutton .f3.b -text B&W -variable ::bw grid .f3.l .f3.g .f3.b -sticky w grid [button .do -text Process -command DoIt -state disabled] -sticky we grid [label .l -image imgTkDest]
Applications qui utilisent LRIPhoto :
Voir également : LRIText.