How can I register an already uploaded unmanaged file as managed file? I am stuck in a point that should be easy but I couldn't figure it out.

To make a long story short; I uploaded manually some images to the public directory and now I want to register them as managed files but I am stuck for some time where I couldn't figure out how to do it.

I tried using system_retrieve_file but it seems to accept only URLs not local paths public:// as it uses cURL to get the file

Also, I tried using file_save_data with no luck as well for the same mentioned points.

Any ideas?
I ended up creating a new managed file, pretty easy as the following:

$user = \Drupal::currentUser()-&gt;id();
    $image = File::create([
    'uri' =&gt; $image_local_path,
    'uid' =&gt; $user,
    'status' =&gt; FILE_STATUS_PERMANENT,
  ]);
  $image-&gt;save();