Frame resizing to contents

I have hundreds of images (screenshots) in a document with captiond and a wrapping frame added when the caption was inserted.

I need to resize many of them and even replace with a translated screenshot. Replacing the image/screenshot often does not match the frame, either leaving gaps or the image overflows the frame.

What are the condition or situations where resizing the frame also resizes the internal picture? I suspect it is related to anchoring objects. Can someone shed some light?

Also, the Help mentions this feature as an extra button in the Frame dialog, which I’m unable to find.

https://help.libreoffice.org/7.1/en-US/text/swriter/01/05060100.html

I’m not sure what you mean with “this feature”. If you mean Anchoring, that doesn’t have a button. The top right area of the Type tab of that dialog box is used to set anchoring, the graphic to the right suggests show that works.

If I understand correctly your question, your document contains captioned images. Structurally, this translate to a text frame (the caption) containing a nested frame (the image). But default, these frames are AutoSize, meaning the size of the image dictates the Graphics frame size which in turn dictates the Frame frame size.

But it seems you want it the other way round, i.e. changing the outer frame size to cause the image to shrink or expand.

This is usually what happens when you drag the frame handle.

However, it seems there is a bug (?) or non-documented behaviour when you paste or otherwise replace the image directly, even if both height and width are AutoSize.

From experimentation, it looks like the outer frame keeps its width when the image is replaced. Then if the new image scaled to width:

  • is taller than the replaced one, the caption frame expands vertically
  • is shorter than the replaced image, the caption frame keeps its height.

Reapplying the frame style does nothing because the Height (at least) parameter kept its previous value. This parameter overrides (or complements) AutoSize. This parameter is set frame per frame and can be considered direct formatting which explains why reapplying the frame style has no effect. But this is not common direct formatting and Ctrl+M has no effect either.

The only workaround I could find was to apply another frame style and then Frame again. It seems that Marginalia resets enough parameters to do the trick.

Note that anchors play no role here.

Summary

  • define your own frame styles or tune built-in Frame and Graphics (so that you format your illustrations and captions with a double-click on the style name – refrain from adding manual properties)
  • make sure all your frames are AutoSize
  • replace your picture
  • apply frame style Marginalia
  • reapply the original frame style to the caption frame (by default Frame)

To show the community your question has been answered, click the ✓ next to the correct answer, and “upvote” by clicking on the ^ arrow of any helpful answers. These are the mechanisms for communicating the quality of the Q&A on this site. Thanks!

In case you need clarification, edit your question (not an answer which is reserved for solutions) or comment the relevant answer.