For inctance, we need to convert all .gif to .jpg
Execute next commands in teminal
> cd /vaw/www/media/catalog/product/
> for i in $(find $(pwd) -name \*.gif -print); do convert $i $(echo $i.jpg | sed s/.gif//g); done
> rm -r cache/
Then, run these sql-statements in DB
update `catalog_product_entity_varchar`
set value = REPLACE(`value`, '.gif', '.jpg')
where `attribute_id` in
(SELECT `attribute_id` from `eav_attrubute`
where `attribute_code` in ('image', 'small_image', 'thumbnail') and `entity_type_id` = 4
)
;
update `catalog_product_entity_media_gallery`
set `value` = REPLACE(`value`, '.gif', '.jpg');