Hello ,is there a way to extract images from file , which had already been imported as images.
Lost the originales. There are about 25 images and sure I can pluck them one by one using grab.
Is there an easier way ?
Maybe edit the material in an image editor and do a Save As⌠to a new location?
Yes thank you or using Grab which is a screen capture thing
Grab from the model will be at whatever resolution your screen is at. And it might not show the full image depending on how it is applied. And it might not be the original color depending on shadows / style / etc.
Editing in the image editor should give you original, which you can save.
Iâm sure someone may have written a script to do this at some pointâŚ
Thank you, since this only for referencing I could live with Grab
This post now sounds like a product placement postâŚ
Good luck.
If you have many images, there is an alternate method.
You can rename your file from âyour file.skpâ to âyour file.zipâ, then unzip. You can find all images after unzip.
This does not apply skp version earlier than 2021. (holtsgata is using SU2019, according to his forum profile.)
If all of these âimagesâ are textures of materials itâs easy enough to make a texture_writer to save them out⌠Something like this - untestedâŚ
### if image used as a texture
path=File.join(File.dirname(Sketchup.active_model.path), "All_Textures")
tw=Sketchup.create_texture_writer
temp_group=Sketchup.active_model.active_entities.add_group()
Sketchup.active_model.materials.each{|mat|
next unless mat.texture
temp_group.material=mat
iname=File.basename(mat.texture.filename).gsub(/[^\.A-Za-z0-9_-]/, "_")
ipath=File.join(path, iname)
tw.load(temp_group)
tw.write(temp_group, ipath)
temp_group.erase! if temp_group.valid?
}
### if raw images...
path=File.join(File.dirname(Sketchup.active_model.path), "All_Images")
images = []
Sketchup.active_model.definitions.each{ |d| images << d if d.image? }
images.each{|img|
temp_groupX=Sketchup.active_model.active_entities.add_group()
tr=Geom::Transformation.new()
ins = temp_groupX.entities.add_instance(img, tr)
exp = ins.explode
face = exp.grep(Sketchup::Face)[0]
mat = face.material
temp_groupX.erase! if temp_groupX.valid?
temp_group=Sketchup.active_model.active_entities.add_group()
temp_group.material=mat
iname=File.basename(mat.texture.filename).gsub(/[^\.A-Za-z0-9_-]/, "_")
ipath=File.join(path, iname)
tw.load(temp_group)
tw.write(temp_group, ipath)
temp_group.erase! if temp_group.valid?
}
### or something like this - this is untested...