IsFileSelectableEvent 

The PSR-14 event \TYPO3\CMS\Backend\ElementBrowser\Event\IsFileSelectableEvent allows to decide whether a file can be selected in the file browser.

To get the image dimensions (width and height) of a file, you can retrieve the file and use the getProperty() method.

Example: Prevent the selection of PNG images 

EXT:my_extension/Classes/Backend/EventListener/MyEventListener.php
<?php

declare(strict_types=1);

namespace MyVendor\MyExtension\Backend\EventListener;

use TYPO3\CMS\Backend\ElementBrowser\Event\IsFileSelectableEvent;
use TYPO3\CMS\Core\Attribute\AsEventListener;

#[AsEventListener(
  identifier: 'my-extension/backend/modify-file-is-selectable',
)]
final readonly class MyEventListener
{
  public function __invoke(IsFileSelectableEvent $event): void
  {
    // Deny selection of "png" images
    if ($event->getFile()->getExtension() === 'png') {
      $event->denyFileSelection();
    }
  }
}
Copied!

API 

final class IsFileSelectableEvent
Fully qualified name
\TYPO3\CMS\Backend\ElementBrowser\Event\IsFileSelectableEvent

Listeners to this event are able to define whether a file can be selected in the file browser

getFile()
Returns
\TYPO3\CMS\Core\Resource\FileInterface
isFileSelectable()
Returns
bool
allowFileSelection()
denyFileSelection()