Table of Contents
Manage images embedded in DOCX documents.
2. Subcommands
| Subcommand | Description |
|---|---|
|
List all embedded images with metadata |
|
Extract images to a directory |
|
Insert an image into the document |
|
Remove an image by filename |
3. Options
4. Examples
List images:
uniword images list document.docx
uniword images list document.docx --json
Extract all images:
uniword images extract document.docx ./output_images
Insert an image:
uniword images insert document.docx photo.png -o out.docx
uniword images insert document.docx logo.png -o out.docx --width 6in --height 4in
uniword images insert document.docx chart.png -o out.docx --position 2
Remove an image:
uniword images remove document.docx image1.png -o out.docx
5. Ruby API
doc = Uniword.load("document.docx")
# List
images = doc.list_images
images.each { |img| puts "#{img.name} (#{img.content_type})" }
# Extract
count = doc.extract_images("/tmp/images")
# Insert
doc.insert_image("photo.png", width: "6in", height: "4in")
.save("output.docx")
# Remove
doc.remove_image("image1.png").save("output.docx")