Rewrite some methods in udImages.pas

Fix bugs