Programmatically select image style for use with custom file entity view mode I have created an empty custom view mode for file entities with hook_entity_info_alter(). 

I would like to programmatically select settings for it, so that they can be deployed without a user having to go to the file entity display settings GUI and select "image" for type of file display and "original size" for the image style. 

I cannot do this with hook_entity_view_mode_alter() because that appears to only fire for nodes, not for file entities. 

How can I programmatically set the display settings for my custom view mode for file entities?
Sounds like something like this should work for you, to set the file display for the image file type, view mode name VIEW_MODE (replace with your custom view mode), to display original image. It either adds a new file display or updates an existing one:

$displays = file_displays_load('image', 'VIEW_MODE', TRUE);
$formatter = 'file_field_image';
if (array_key_exists($formatter, $displays)) {
  $display = $displays[$formatter];
}
else {
  $display = (object) array(
    'api_version' =&gt; 1,
    'name' =&gt; 'image__VIEW_MODE__' . $formatter,
  );
}
$display-&gt;status = 1;
$display-&gt;settings['image_style'] = '';
file_display_save($display);