OK. I see now what you are trying to do. I'm not sure I would spend time creating a plugin to create this "optimal" percentage when CSS does all the work for you automatically - and it works for all devices, not just your specific device display. Good news though - I'm not a plugin creator!!
If you can get someone to make it then more power to you!!
I concur with Doitsu's recommendation though - have any plugin automatically add custom classes or IDs to the
CSS for the selected images and insert basic tags in the html file.
eg.
Code:
img {max-height:100%}
div.image1 {width:100%; max-width:SGC_IMAGE_WIDTH}
<div class="image1"><img alt="" src="../Images/SGC_IMAGE_FILENAME" /></div>
-OR-
img {max-height:100%}
#image1 {width:100%; max-width:SGC_IMAGE_WIDTH}
<div id="image1"><img alt="" src="../Images/SGC_IMAGE_FILENAME" /></div>
Just throwing out an idea here...
Since Sigil has an "Insert File" function that already does most of the work...wouldn't it be easier to simply add a user preferences section for that tool?? One where the user could enter their desired default code into a text box. If the textbox is empty Sigil uses it's normal algorithm, if not it uses the user's code.
It is a simple copy/paste with some basic variable fields. These variable fields are already in use by Sigil: SGC_IMAGE_WIDTH, SGC_IMAGE_HEIGHT, SGC_IMAGE_FILENAME, etc.
It wouldn't just need to be for "Insert File" function either. It could be used for the "Add Cover" tool, or the "Create HTML ToC" tools that already look in a folder location to see if there is a user defined "cover.xhtml" or "sgc-toc.css" file. It seems like it would be simpler (or at least easier for the user) to enter their desired code into textboxes in preferences than create a new file in a hidden Sigil folder...
FWIW