SKP write thumbnail. SIZE?
-
I guess there is no simple way to set the size on Sketchup.save_thumbnail?
I'm using something similar Dan's snippet.
http://sketchucation.com/forums/viewtopic.php?t=24876It's strange the png's come out 64 X 128 pixels. Most of the times I would rather like to have 64 X 64. I mean Square proportions. Component window has thumbs in thoose proportions for ex..
-
@jolran said:
I guess there is no simple way to set the size on
Sketchup.save_thumbnail
?No the size is dependent upon the aspect ratio of the viewport, in SketchUp when the file is saved. (Which may be outside the control of your plugin.)
@jolran said:
I'm using something similar Dan's snippet.
http://sketchucation.com/forums/viewtopic.php?t=24876This is for EXTRACTING whatever pre-made thumbnail is already embedded within the SKP file.
The SKP file(s) do not need to actually be open within SketchUp.@jolran said:
It's strange the png's come out 64 X 128 pixels. Most of the times I would rather like to have 64 X 64. I mean Square proportions. Component window has thumbs in thoose proportions for ex..
If you wish to control the size of a thumbnail, you will have to open the file within SketchUp, and use View.write_image()
-
Ah, I see.
Im sending thumbs to Webdialog from premade components located in a pluginfolder.
Quite many of them.This seams like to much hassle, I can fix it in the CSS side, no worries..
Will take a look if I can do something different when saving them though.
Thanks.
-
i was farting around with this stuff and needed something similar.. TIG & tt helped me out with this
model = Sketchup.active_model view = model.active_view keys = { :filename => "/Users/jeff/Desktop/write_image.png", :width => 640, :height => 480, :antialias => false, :compression => 0.9, :transparent => true } view.write_image(keys)
(obv change the path and others accordingly)
it's fast though and gives you some decent controls.. -
Nice! Something like this I had in mind.
Thanks Jeff.Let's see if I can make it work with Sketchup.save_thumbnail.
edit: Hmm, not trivial.
-
oh.. i was thinking you use this as the thumbnail.. and avoid the save_thumbnail part..
maybe that's not an option in your situation though? -
Maybe not for this part. I already have a folder with components.
But your code might be very useful for a different projekt I have.This code would have to run each time to see if the user has added new components, when launching the webdialog. And add thumbs to the list.
I already had it working before with 128 px X 64 px, but it would be nice to be able to set the thumbs proportions.
As of now I'm clipping the image in CSS with 2 divs. Never mind how I'm doing it BTW.. The main point is that I may not be able to support IE7 with several imagehacks.
BTW a side question: Trying to stay "Sketchup like" with the dialog. Could there be any copyright issues, mimicing Sketchup GUI interface?
Advertisement