I do not know about open source software that meets your requirements.
Only part of it can be solved by writing your own shell script (or other program).
Detect image resolution.
pdfimages -list some.pdf, , PDF, ... . : ( PDF). 720x720 . , 10x10- , 72 DPI . 1x1 , 720 DPI. "" PDF , " ", . , DPI , , PDF...
Ghostscript 300 dpi "". (Ghostscript "" , , . - .)
CMYK ICC.
Ghostscript . . Ghostscript, ICC.
.
( ) pdffonts some.pdf , .
Ghostscript .
, Ghostscript, , :
gs \
-o cmyk.pdf \
-sDEVICE=pdfwrite \
-sColorConversionStrategy=CMYK \
-sProcessColorModel=DeviceCMYK \
-sOutputICCProfile=/path/to/your.icc \
-sColorImageDownsampleThreshold=2 \
-sColorImageDownsampleType=Bicubic \
-sColorImageResolution=300 \
-sGrayImageDownsampleThreshold=2 \
-sGrayImageDownsampleType=Bicubic \
-sGrayImageResolution=300 \
-sMonoImageDownsampleThreshold=2 \
-sMonoImageDownsampleType=Bicubic \
-sMonoImageResolution=1200 \
-dSubsetFonts=true \
-dEmbedAllFonts=true \
-sCannotEmbedFontPolicy=Error \
-c ".setpdfwrite<</NeverEmbed[ ]>> setdistillerparams" \
-f some.pdf
, , (*ImageDownSampleThreshold=2). , ( PDF, "" "" ).
, , , $2 . $6 . , . ( - callas pdfToolbox6 ( , CLI Linux) - 500 .)