RTF and images

I don’t know if this should be called a bug or rather a feature request. Anyway, for the records, in this thread, https://forum.literatureandlatte.com/t/comparison-to-other-word-processors-and-writing-tools/68/1, we encountered the following problem:
Images in exported RTFs do work in MS Word; however they are ignored when the same Scrivener generated RTF is imported into InDesign (tested with CS4). If the Scrivener RTF is opened in Word and saved again, the images subsequently survive the InDesign import. It would be nice, however, if piping through MS Word would not be required.

Scrivener RTF’s uses a simple RTF syntax:
In Scrivener, it reads:
{*\shppict {\pict \picw720 \pich540 \pngblip …

Word is much more verbose:
{*\shppict {\pict{*\picprop\shplid1025{\sp{\sn shapeType}{\sv 75}}{\sp{\sn fFlipH}{\sv 0}}{\sp{\sn fFlipV}{\sv 0}}{\sp{\sn fLine}{\sv 0}}{\sp{\sn fLayoutInCell}{\sv 1}}}\picscalex100\picscaley100\piccropl0\piccropr0\piccropt0\piccropb0
\picw25400\pich19050\picwgoal14400\pichgoal10800\pngblip\

The first is beautiful and human readable, but the second one seems to work more consistently between RTF enabled applications.

xaxa

Unfortunately I have to hack the images into the RTF and I’m not really sure about the extra RTF blurb from Word. I will take a look at it though.
Thanks,
Keith

Okay, I’ve looked at this some more, and this is indeed a bug - but it’s in the wrong forum: it should be on the Adobe forums, because the bug is with InDesign, not with Scrivener. Unfortunately, this is down to a buggy RTF importer on the part of InDesign. I’ve experimented with importing an RTF file with an image in it (generated by Scrivener) into InDesign (using Place…), and this is what I have found:

  1. If there are any spaces between the RTF elements inside the “{*\shppict…}” element, InDesign won’t import the image (even though this is perfectly valid and it should just ignore the whitespace). Obviously, I can work around this InDesign limitation by eliminating spaces in my own RTF output.

  2. If there are any custom elements inside the “{\pict…}” element, InDesign won’t import the image. This is particularly annoying. In Scrivener 2.0, I use a custom control word from Nisus to record the image name, as follows:

{*\shppict {\pict {*\nisusfilename image_file_name} …}}

Note the preceding “*” before “\nisusfilename” - this tells RTF readers that the control should be ignored if they do not recognise the element, as per the RTF specs:

InDesign, however, doesn’t seem to follow the RTF specs properly - instead of just ignoring the \nisusfilename block as it should, it completely bails and ignores the entire \shppict section. (In fact, from brief testing, it seems to ignore the rest of the file completely, but I may be wrong there.)

What I have done for 2.0, then, is to remove the spaces from between the controls in the \pict element and also to make the \nisusfilename element optional and off by default (as that is only really useful for Nisus Writer, even though it should be harmless for all other readers that follow the specs correctly). This means that you can bring RTF files exported from Scrivener 2.0 into InDesign with images intact.

However, I still strongly recommend that you take this up with Adobe, as all I can do really is ensure that I am writing valid RTF (which I was already) - I can’t tailor it to account for bugs in every RTF reader out there, so there’s no guarantee that InDesign won’t have other problems. It’s also worth noting that InDesign fails to read images from valid RTF files saved from Nisus Writer and Mellel. So although I have provided a way of getting this working in 2.0 (because it was a relatively easy workaround), this is still an InDesign bug and hopefully Adobe will fix it in the future if you bring it to their attention.

All the best,
Keith

Wow, Keith – this is indeed a thorough analysis. Before reporting the problem to Adobe: which version of ID were you running your tests with?

I’m on CS4 (version 6.0) - I haven’t got around to updating to CS5 yet.
Best,
Keith

Hi Keith,

I found this 10 year old thread through Google! I’m having exactly the same problem with Scrivener 3.1.5 and InDesign 2020 on Mac. Is it possible to fix so the RTFs synced by Scrivener will Place in InDesign with inline images intact?

All the best,

Matt