Layout ruby to export to images

Is there a way to do “File > Export > Images” with the ruby api?

I checked the api but don’t seem to find it.

I don’t think so. When PDF exports have been discussed in the past the answer has been to manually rebuild it using a PDF library and exploding viewports to get out the images and lines.

use view.write_image

options = {
  :filename => "c:/tmp/write_image.png",
  :width => 640,
  :height => 480,
  :antialias => false,
  :compression => 0.9,
  :transparent => true
}
model = Sketchup.active_model
view = model.active_view
view.write_image(options)

Shoot, I missed the layout tag.
You can write to image in layout as well:
(give me a second)

EDIT:
… but not from ruby it seems :slight_smile:
You can however export images using the c sdk

result = LODocumentExportToImageSet(document,
                                        output_path.c_str(),
                                        output_name.c_str(),
                                        image_format,
                                        options_dict);

see: https://extensions.sketchup.com/developers/layout_c_api/layout/document_8h.html#a46ebf1a265aeea299f6787dabd7c26f6

Thanks for the answers.

I knew it is possible with the c sdk option, but for now I just manage to do the ruby solutions…
When i have the time, i will have to look for some getting started thing i guess.

Let me know if you need help with that.