The current code at line 102 trims 4 characters from the end of the filename (i.e. '.png') and adds '_pred.png'. This rigid filename trim is inconvenient when using '.tiff' files or any other with extensions longer than 4 characters total, resulting in extra '.' - i.e. 'outfile._pred.png' . The proposed fix introduces dynamic extension trimming, removing any extension after the final '.' in a filename and adding '_pred.png'.
The current code at line 102 trims 4 characters from the end of the filename (i.e. '.png') and adds '_pred.png'. This rigid filename trim is inconvenient when using '.tiff' files or any other with extensions longer than 4 characters total, resulting in extra '.' - i.e. 'outfile._pred.png' . The proposed fix introduces dynamic extension trimming, removing any extension after the final '.' in a filename and adding '_pred.png'.