How to get image extension from wp image editor object?

I tried using generate_filename yesterday but probably it was kind of late and I was trying and didnt manage to make it work, today I managed to workaround the problem without fetching the image another time like this:

$save_path = WP_CONTENT_DIR . '/tmp/' . $img_name . "-" . $nw . "x" . $nh;
$wp_img->save($save_path);
$img_name = basename($wp_img->generate_filename('suffix'));
$img_name = str_replace('-suffix', '', $img_name);
$img_url = content_url() . '/tmp/' . $img_name;
$filepath = WP_CONTENT_DIR . '/tmp/' . $img_name;

As you can see a suffix must be specified because currently the method adds a default suffix as the image size by default, and to retrieve the correct image filename + extension it must be removed afterwards.