I created a field with the field type "file" I now have to convert this to "image" field type. The field has already content so I cannot not delete and recreate a new one. How can I do this programatically using the hook_update in my module?
Hook update performs an update on a node, it wont be too useful in your case. When you create a field it creates a table in the DB with appropriate datatypes. You cannot just change the datatype of a field without going down the line and changing all the details, including the data in most cases. which trust me is a huge pain in the ass.
I've had to do this before but what i ended up doing was creating new field with the datatype I wanted, then used View Bulk operations Execute arbitrary PHP script and ran custom php to get the
FID from all the File and then add it to the new field. I think there was a user reference for each file as well, so the fidelity is there to transfer your data between fields. Then delete the old field
Worst case scenario, find ways of limiting what types of files(image only) your file upload field can upload.