Internal command Image, setting extension

When using the image command to CONVERT an image. I am not able to control the name and extension using the TO argument.
There are times where I want to be able to control the extension, for example convert to a jpg, but make the extension .tbn instead if jpg.
If I try this code below, the result is a file called test.jpg, event though in the to I specify the output file name and extension.

Image CONVERT=jpg TO=test.tbn

Because of this I need to:
[ul]
[li]Check if the target .tbn file exists [/li]
[li]Delete the existing file[/li]
[li]Convert to jpg[/li]
[li]Rename from .jpg to .tbn[/li][/ul]

Is there a better solution?

Hi wow, did you rtfm? o)

TO is for the destination location (path). There is ADDSUFFIX to append a string to the file basename and AS to specifiy a complete new filename, which sadly does not support any kind of patterns to make this work for batch operations.

Yes I did read it.

I did make a mistake in my first post, I meant the AS argument not TO.

Image CONVERT=jpg AS=test.tbn

Leo perhaps you could edit my first post and replace TO with AS.

This creates a new file called test.tbn size 200.

Image AS=test.tbn HEIGHT=200

This creates a new file called test.jpg size 200.

Image CONVERT=jpg AS=test.tbn HEIGHT=200

I want to convert the selected file to jpg, but make the result file's extension respect what is defined in the AS argument.