heif is correct, it is an image format derived from heic for video. It is pretty spectacular especially compared to the aging jpeg, but yes best to stick with uncompressed formats for non-natural imagery such as screenshots of digital UI and text etc.
Edit: Reading this, looks like HEIF is the container and HEIC is the codec. You’re right!
https://en.wikipedia.org/wiki/High_Efficiency_Image_File_Format?wprov=sfti1
If optimized charging was the culprit, it should show a pause symbol on the graph. The issue is likely related to heat or a bug, but I would recommend leaving optimized charging enabled for long term battery health.