Unfortunately, there is no programmatic way to do "Select Image > Picture Format > Compress Pictures". It might be worth setting up an AutoHotKey script to run through your files.
If your rtf files were originally created in word, they likely saved two copies of each image (original file and huge uncompressed version). You can change this behavior by setting ExportPictureWithMetafile=0
in the registry, then re-saving each file. This can be done with a script, for example:
# Set registry key: (use the correct version number, mine is 16.0)
Try { Get-ItemProperty HKCU:\SOFTWARE\Microsoft\Office\16.0\Word\Options\ -Name ExportPictureWithMetafile -ea Stop}
Catch { New-ItemProperty HKCU:\SOFTWARE\Microsoft\Office\16.0\Word\Options\ -Name ExportPictureWithMetafile -Value "0" | Out-Null }
# Get the list of files
$folder = Get-ChildItem "c:\temp\*.rtf" -File
# Set up save-as-filetype
$WdTypes = Add-Type -AssemblyName 'Microsoft.Office.Interop.Word, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' -Passthru
$RtfFormat = [Microsoft.Office.Interop.Word.WdSaveFormat]::wdFormatRTF
# Start Word
$word = New-Object -ComObject word.application
$word.Visible = $False
ForEach ($rtf in $folder) {
# save as new name temporarily (otherwise word skips the shrink process)
$doc = $word.documents.open($rtf.FullName)
$TempName=($rtf.Fullname).replace('.rtf','-temp.rtf')
$doc.saveas($TempName, $RtfFormat)
# check for success, then delete original file
# re-save to original name
# check for success again, then clean up temp file
if (Test-Path $TempName) { Remove-Item $rtf.FullName }
$doc.saveas($rtf.FullName, $RtfFormat)
if (Test-Path $rtf.FullName) { Remove-Item $TempName }
# close the document
$doc.SaveAs()
$doc.close()
}
$word.quit()
I made some default word files with a 2mb image, saved as rtf (without the registry change), and saw the rtf files were a ridiculous 19mb! I ran the script above, and it shrunk them down to 5mb.