[Plugin] ImageTrimmer
-
FWIW, I opened the wreath PNG (the one in the link) in my image editor, selected the background and made it transparent. I couldn't see any difference in the image, though. I got the same results with the revised version as I did before.
-
@unknownuser said:
Your 'Java' installation can't access the 'jar' file... Have you tried updating your Java installation ? It might be 'old'...
I am using vista so who knows?
-
Hi TIG,
I have probe different combinations and to make it works this is the process in Ruby Console:- Type jar="EdgeDetector.jar"
- Type UI.openURL("file:/Users/Oxer/Library/Application Support/Google SketchUp 8/SketchUp/plugins/SKMtools/"+jar)
With these two commands EdgeDetector runs and creates the 2 files into TrimmedImages folder.
Note that the path to EdgeDetector is to my User Account, on Mac you can place the Sketchup plugins in two locations:
a) /Users/User Name*/Library/Application Support/Google SketchUp/SketchUp/plugins
or
b) Library/Application Support/Google SketchUp/SketchUp/plugins
I hope this help you.
-
@unknownuser said:
@unknownuser said:
Your 'Java' installation can't access the 'jar' file... Have you tried updating your Java installation ? It might be 'old'...
I am using vista so who knows?
Strange I too run Vista with that version of Java... and have no problems!
Can you post screen-shots of your 'Java settings'...
Do you have full read/write/execute access-rights to the SKMtools folder and its contents?
I have a fix for a MAC problem that I'll post asap - this might also help you... watch this space... -
Here's an update - http://forums.sketchucation.com/viewtopic.php?p=293677#p293677 - it addresses some glitches with the MAC file paths [I hope! Thanks for the assistance Oxer et al]...
-
Thanks TIG.
Have you had an opportunity to look at the two images I was having difficulty with? They were randomly collected off the web and I'm guessing that if I could find two problem images that easily, others would also come across them. Maybe it has to do with images saved from websites?
-
@dave r said:
Thanks TIG.
Have you had an opportunity to look at the two images I was having difficulty with? They were randomly collected off the web and I'm guessing that if I could find two problem images that easily, others would also come across them. Maybe it has to do with images saved from websites?You need to ensure that all sold areas are 'solid' with no transparency - edit the png, merge layers, flatten and select area of the transparent color and delete so transparency is only applied to the 'holes'...
I also tried and made the wreath image smaller so it processed faster...
But it still fails - must be something in the 'form'
As a result of your report I'm revisiting the Java in the EdgeDetector.jar as it had a glitch on the image's edge pixels.
I'm also adding a timed wait [3secs] for the 'dat' file to complete, as I found that 'dat' file was getting made BUT the Ruby was reading the file too soon so it wasn't getting the data...
I'll post updates when they are tested.... -
TIG, after reading your last post I thought I'd try a couple of things n that wreath image. I selected the areas that should be transparent and deleted them and I selected the rest and adjusted the Transparency slider to make them opaque. I couldn't see any change in the editor but when I imported the image into SU, the transparent areas were black rather than transparent. I tried running the script on it anyway. It ran for awhile slowly increasing the percentage of pixels processed. I turned away to work on something else and when I looked back SketchUp had closed. No bug splat and no message from Windows. Just closed as if I had hit the X.
I'll wait for your next version and see what happens.
Just some free thinking here, which I probably shouldn't do but is it possible to inspect the PNG for problems before starting to create the edges and throw up some sort of message indicating potential problems?
-
Hi,
I have tested the last revision, and now the plugins runs but nothing happens, after 60 seconds this message appears
The Ruby Console is empty and the plugin don't makes the two files in TrimmedImage folder.EDIT: I probe to run EdgeDetector.jar directly and OSX shows this:
Has not been possible to open the file JAR of Java "EdgeDetector.jar" Open the Console to see the possible error messages.
The OSX Console shows this:I have looked in SKMtools folder and there aren't the from.ini and to.ini files, the previous revisions of the plugin generated these files.
This is in what I can help you. -
Oxer
Can you open you Java control panel and check the settings - that you are allowed to 'auto'-run 'jar' files on your MAC etc. The from/to.ini files are made by the tool but are auto-removed on completion or error. You can manually reproduce these by making than as you did before - then the jar runs when double-clicked [opened] and UI.openURL(full_path) so I can't see why it's not working now from within SUp ... The timeout occurs when the files aren't made...
I have a think.... -
@dave r said:
TIG, after reading your last post I thought I'd try a couple of things n that wreath image. I selected the areas that should be transparent and deleted them and I selected the rest and adjusted the Transparency slider to make them opaque. I couldn't see any change in the editor but when I imported the image into SU, the transparent areas were black rather than transparent. I tried running the script on it anyway. It ran for awhile slowly increasing the percentage of pixels processed. I turned away to work on something else and when I looked back SketchUp had closed. No bug splat and no message from Windows. Just closed as if I had hit the X.
I'll wait for your next version and see what happens.
Just some free thinking here, which I probably shouldn't do but is it possible to inspect the PNG for problems before starting to create the edges and throw up some sort of message indicating potential problems?
After a bit of editing of the pngs and tweaking the jar and ruby code it now works although the wreath is painfully slow as there are lots of separate 'face' dots formed by the pointed leaf-ends...
I hope to post the updates asap, but I can concurrently trying to sort out Oxer's MAC problem too
Here's the tweaked pngs and a skp that works...TroublesomeImages.zip -
Here's an update http://forums.sketchucation.com/viewtopic.php?p=293677#p293677
The time-out for larger .dat files in extended and the EdgeDetector.jar is improved.We seem still to have problems with some MAC users [see Oxer]... any MAC users who are getting good results please let us know your Java settings etc - this might be the key to resolving this issue...
-
Thank you TIG. I'll give that a go ASAP.
What did you do to the PNGs to make them work? Was it essentially the same thing to both of them? Do you suppose the problems they exhibit could be common to a lot of PNGs?
-
@dave r said:
Thank you TIG. I'll give that a go ASAP.
What did you do to the PNGs to make them work? Was it essentially the same thing to both of them? Do you suppose the problems they exhibit could be common to a lot of PNGs?I made them a bit smaller so they processed quicker and ensured the areas were either fully transparent or solid. I also rounded off the very pointed one pixel leaf tips - this speeds up processing as otherwise tiny 2 pixel separate square faces get made and slow down the 'hole' checking proportionately.
The main issue was that the bigger wreath took so long to make the .dat file (8+Mb!) that the time-out kicked in before it finished - I've improved the algorithm so it waits till the .dat file has all the required lines in it...
Also there was an error in the way the outermost pixels were made with the .jar in some transparent pixel arrangements, and this meant that some perimeter pixels were getting missed out so that you never got a full 'loop' so the faces etc never go made - that's all fixed too [I hope].
So to recap... don't use images much more than 1000x1000 pixels as it'll take ages to trim, also avoid very thin pointy area of solid/transparent pixels as these will extend the process time too and add little to the final trimmed result...
Please keep testing and post any problems - we need to get this working as well as we can... -
Thanks for the clarification, TIG. I'll be happy to keep testing for you.
I think I mentioned this before but those were just randome images I picked for testing. Evidently I'm good at picking bad images.
Happy holidays to you.
Dave
-
-
test in sketchup 6 7 & 8 still have same problem:
Error; #<Errno;;ENOENT; No such file or directory - F;\TrimmedImages\hero[Edges].dat> C;/Program Files/Google/Google SketchUp 6/Plugins/SKMtools/ImageTrimmer.rb;219;in `readlines' C;/Program Files/Google/Google SketchUp 6/Plugins/SKMtools/ImageTrimmer.rb;219;in `make_edges' C;/Program Files/Google/Google SketchUp 6/Plugins/SKMtools/ImageTrimmer.rb;173;in `process_image' C;/Program Files/Google/Google SketchUp 6/Plugins/SKMtools/ImageTrimmer.rb;150;in `initialize' C;/Program Files/Google/Google SketchUp 6/Plugins/SKMtools/ImageTrimmer.rb;644;in `new' C;/Program Files/Google/Google SketchUp 6/Plugins/SKMtools/ImageTrimmer.rb;644 C;/Program Files/Google/Google SketchUp 6/Plugins/SKMtools/ImageTrimmer.rb;644;in `call'
-
@arc said:
test in sketchup 6 7 & 8 still have same problem:
Error; #<Errno;;ENOENT; No such file or directory - F;\TrimmedImages\hero[Edges].dat> > C;/Program Files/Google/Google SketchUp 6/Plugins/SKMtools/ImageTrimmer.rb;219;in `readlines' > C;/Program Files/Google/Google SketchUp 6/Plugins/SKMtools/ImageTrimmer.rb;219;in `make_edges' > C;/Program Files/Google/Google SketchUp 6/Plugins/SKMtools/ImageTrimmer.rb;173;in `process_image' > C;/Program Files/Google/Google SketchUp 6/Plugins/SKMtools/ImageTrimmer.rb;150;in `initialize' > C;/Program Files/Google/Google SketchUp 6/Plugins/SKMtools/ImageTrimmer.rb;644;in `new' > C;/Program Files/Google/Google SketchUp 6/Plugins/SKMtools/ImageTrimmer.rb;644 > C;/Program Files/Google/Google SketchUp 6/Plugins/SKMtools/ImageTrimmer.rb;644;in `call' >
I assume your model.skp is on the F: drive? Is that a memory-stick, or something similar??
Sometimes writing to non-C: drive locations causes problems with SUp/Ruby generally...
Try running it with the SKP saved onto your 'C:/Users/Arc/Desktop/' so that you definitely have the correct permissions...
Is a new folder named 'TrimmedImages' getting made on the F: drive?
Do you have permission to make the folder and/or write files into it?
Is there a file called 'hero.png' in that folder?
Is there a file called 'hero[Edges].png' in that folder?
Is there a file called 'hero[Edges].dat' in that folder? -
On another PC, I copy a png file named"growCursor.png" in c:\ and import in sketchup7, now run the Image Trimmer,
Error; #<Errno;;ENOENT; No such file or directory - C;\TrimmedImages\growCursor[Edges].dat> D;/Program Files/Google/Google SketchUp 7/Plugins/SKMtools/ImageTrimmer.rb;219;in `readlines' D;/Program Files/Google/Google SketchUp 7/Plugins/SKMtools/ImageTrimmer.rb;219;in `make_edges' D;/Program Files/Google/Google SketchUp 7/Plugins/SKMtools/ImageTrimmer.rb;173;in `process_image' D;/Program Files/Google/Google SketchUp 7/Plugins/SKMtools/ImageTrimmer.rb;150;in `initialize' D;/Program Files/Google/Google SketchUp 7/Plugins/SKMtools/ImageTrimmer.rb;644;in `new' D;/Program Files/Google/Google SketchUp 7/Plugins/SKMtools/ImageTrimmer.rb;644 D;/Program Files/Google/Google SketchUp 7/Plugins/SKMtools/ImageTrimmer.rb;644;in `call' D;/Program Files/Google/Google SketchUp 7/Plugins/SKMtools/image_class.rb;941
Ruby can auto make folder C:\TrimmedImages\ and copy the growCursor.png in it, but not have growCursor[Edges].dat.
-
@arc said:
On another PC, I copy a png file named"growCursor.png" in c:\ and import in sketchup7, now run the Image Trimmer,
Error; #<Errno;;ENOENT; No such file or directory - C;\TrimmedImages\growCursor[Edges].dat> > D;/Program Files/Google/Google SketchUp 7/Plugins/SKMtools/ImageTrimmer.rb;219;in `readlines' > D;/Program Files/Google/Google SketchUp 7/Plugins/SKMtools/ImageTrimmer.rb;219;in `make_edges' > D;/Program Files/Google/Google SketchUp 7/Plugins/SKMtools/ImageTrimmer.rb;173;in `process_image' > D;/Program Files/Google/Google SketchUp 7/Plugins/SKMtools/ImageTrimmer.rb;150;in `initialize' > D;/Program Files/Google/Google SketchUp 7/Plugins/SKMtools/ImageTrimmer.rb;644;in `new' > D;/Program Files/Google/Google SketchUp 7/Plugins/SKMtools/ImageTrimmer.rb;644 > D;/Program Files/Google/Google SketchUp 7/Plugins/SKMtools/ImageTrimmer.rb;644;in `call' > D;/Program Files/Google/Google SketchUp 7/Plugins/SKMtools/image_class.rb;941 >
Ruby can auto make folder C:\TrimmedImages\ and copy the growCursor.png in it, but not have growCursor[Edges].dat.
OK... but why complicate matters by using a root-level path - try your 'Desktop' path as I explained before...
Also check you have full access rights to the ../Plugins/SKMtools/ folder as temporary ini files need to be written/read/executed from there etc...
Please double-click the EdgeDetector.jar file in the ../Plugins/SKMtools sub-folder... what does it do, if the file-type '.jar' is not set to open with Java then the images won't process... If you look in earlier posts I explained to Oxer how to make a 'from.ini' and 'to.ini' file in the SKMtools folder. Edit them with Notepad .exe or a similar plain-text editor and add a line C:\TrimmedImages\growCursor.png [that file must be in that folder] to the from.ini - do NOT end the line with a 'return' - similarly add C:\TrimmedImages\growCursor to the to.ini file.
Now double-click on the EdgeDetector.jar file and it should read the data from the two ini files and make C:\TrimmedImages\growCursor[Edges].png and C:\TrimmedImages\growCursor[Edges].dat - does it ?
Similarly - ensure the folder C:\TrimmedImages\ only contains the growCursor.png file again; now in Sketchup open the Ruby Console and type in
UI.openURL("file:/full_path_to_Plugins/SKMtools/EdgeDetector.jar")
where you put the 'full path to you Plugins folder' afterfile:/
and before the/SKMtools/...
[please use / for all folder/file separators]...
If we can get the jar tool to work 'somehow' we should be able to get it to work 'normally for you - like it does for most users...
In passing the 'growCursor.png' file [mine] is poor example to 'trim as it is small with single pixel pinch points which will get erased - here is what happens when I trimmed it...
Why not try this instead... which is used in an example and is known to work fine to show 0 or 2 as the factor for 'smoothing' the outline too....
Advertisement