implementations for img2term