from trac.attachment import Attachment
from trac.admin.console import TracAdmin
wikidir = r'C:\Path\To\My\TracProject'
admin = TracAdmin()
filename = r'c:\Path\To\My\Images\2_0.jpg'
attachment = Attachment(admin.env_open(), 'wiki', 'tutorials/page1')
size = os.stat(filename)
attfile = open(filename,'rb')
attachment.insert(os.path.basename(filename), attfile, size)
The parameters should be reasonably self-explanatory, although do not hesitate to send any questions. I'm thinking it would be reasonably simple to add this functionality to trac-admin. I will probably take a look at this sometime soon and submit a patch.