It sounds like you are doing the 'shrinking' and 'converting' in the calibre library manager.
Most things can be done directly via commands, see ==>>
calibre User Manual: The Command Line Interface.
I suggest this thread ought be moved to the Calibre->Related Tools forum
<<<==== - tap the '!' button to make a request
BR