Use "save_thumbnail" to generate ".jpg"

I want to use the “save_thumbnail” function to export the skp file to the jpg picture format. What should I do? only find examples like this, but I don’t know where the pictures are stored

depth = 100
width = 100
model = Sketchup.active_model
entities = model.active_entities
pts = []
pts[0] = [0, 0, 0]
pts[1] = [width, 0, 0]
pts[2] = [width, depth, 0]
pts[3] = [0, depth, 0]
# Add the face to the entities in the model
face = entities.add_face pts
status = model.save_thumbnail "testthumbnail2.jpg"
UI.messagebox status

have a look at 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)

john

2 Likes

I solved my problem, thank you very much!

As John showed …

… the key is to specify an absolute path so that you know where the file’s save location is.