Page 1 of 1

Change embedded TIFFs to JPEGs in rtf document

Posted: 2016-11-23 17:05:17
by alanterra
Hi

I have a document that is growing in size quickly. It has hundreds of screen grabs in it, and they all seem to have come in (through screenshot to clipboard, paste into document) as TIFFs.

Is there any easy way to convert these TIFFs to JPGs? It is not worth the time to go through the document, paste into, say Photoshop, save as JPG, and then import into the document, but if there was an easy way to do this, it would be so cool.

I know how to change the size of a pdf using various tools, but I don't know of any similar tools for rtf documents.

Thanks

Re: Change embedded TIFFs to JPEGs in rtf document

Posted: 2016-11-23 19:50:49
by phspaelti
Assuming Photoshop has a batch processing feature, you could do this as follows:
  1. Extract the images from the document (see this discussion https://www.nisus.com/forum/viewtopic.php?f=18&t=6473)
  2. Convert the images using the batch feature
  3. Use a macro to replace the images with the converted ones
If you are already keeping your images in a folder (in some more or less systematic fashion), the first step is already done.

Re: Change embedded TIFFs to JPEGs in rtf document

Posted: 2016-11-23 20:18:36
by alanterra
Thanks, Phillip. I'll look into this. I haven't scripted Nisus Writer before. And, yes, Photoshop can be scripted -- there are lots of limitations, but it can be made to work.

Re: Change embedded TIFFs to JPEGs in rtf document

Posted: 2016-11-23 21:09:15
by phspaelti
I don't know Photoshop. I use Graphic Converter. And it allows batch conversion as a simple operation (no scripting needed).

As for Nisus, a macro to replace inline images of one type with images with the same names, and an extension '.jpg' would look something like this:

Code: Select all

$jpegFolderPath = Choose Folder # ... or specify 
$doc = Document.active
foreach $img in $doc.allImages
$jpegName = $img.name.filePathByChangingExtension 'jpg'
    $jpeg = Image.newFromFileAtPath $jpegFolderPath.filePathByAppendingComponent($jpegName)
    $text = $img.anchorText
    $loc = $img.anchorTextRange.location
    $text.deleteInRange $img.anchorTextRange
    $text.insertAtIndex $loc, $jpeg
end

Re: Change embedded TIFFs to JPEGs in rtf document

Posted: 2016-12-05 14:15:42
by Vanceone
You do not need to use Photoshop; the built-in "Automator" program can batch convert an entire set of files.

What I would do is save your Nisus document as file type "RTFD". This will generate a file that actually has all of your images inside a folder inside the file. You can then batch process all of those images, and use the macro provided.

If you haven't used Automator before, it is pretty easy, especially if you know how to script photoshop already. But no need for Photoshop at all.