[Plugin] ImageTrimmer
-
@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.... -
I have tried a couple times of creating image trimmer of TIG's plugin and still does not work. If anyone already uses it and know how to do it could you please create a short video tutorial that would be great! This plugin is so great I hope someone have a time to do it.Thanks a lot
-
[flash=400,318:18u3oz90]http://blip.tv/play/gYhbgpfpGQA[/flash:18u3oz90]
Does this help?
-
@dave r said:
[flash=400,318:owonrm97]http://blip.tv/play/gYhbgpfpGQA[/flash:owonrm97]
Does this help?
Dave,
Thanks for posting vid tut but something is still missing in my TrimmedImages folder?? There is only one png file created and no edge file, it should be two isn't it? No idea what is wrong with that?? -
hgdn
Something is stopping the EdgeDetector.jar file working properly...
Do you have full access rights to the SKMtools folder with in Plugins?
The tool needs to write from.ini and to.ini files into that folder.
Check if they are there - they are auto-deleted if the tool works OK but if it fails they might be there?
The from.ini contains the full path to the ../TrimmedImages/xxx.png file ['xxx' being the image file name], the to.ini is similar but without a file-extension ../TrimmedImages/xxx
If these don't exist try making them [use Notepad.exe to edit them] - note there should be no 'return' at the end of the one line of text in each of them.
If you make these ini files... and the xxx.png file is in the TrimmedImages folder, then double-clicking on the EdgeDetector.jar icon inside the SKMtools folder should read the two ini files and make the xxx[Edges].png and xxx[Edges].dat files.
If it does I can't see what the [i:2uqgfm3t]Ruby[/i:2uqgfm3t] calling the '[i:2uqgfm3t]jar[/i:2uqgfm3t]' is failing
If it doesn't work do you get any errors ?? -
@tig said:
hgdn
Something is stopping the EdgeDetector.jar file working properly...
Do you have full access rights to the SKMtools folder with in Plugins?
The tool needs to write from.ini and to.ini files into that folder.
Check if they are there - they are auto-deleted if the tool works OK but if it fails they might be there?
The from.ini contains the full path to the ../TrimmedImages/xxx.png file ['xxx' being the image file name], the to.ini is similar but without a file-extension ../TrimmedImages/xxx
If these don't exist try making them [use Notepad.exe to edit them] - note there should be no 'return' at the end of the one line of text in each of them.
If you make these ini files... and the xxx.png file is in the TrimmedImages folder, then double-clicking on the EdgeDetector.jar icon inside the SKMtools folder should read the two ini files and make the xxx[Edges].png and xxx[Edges].dat files.
If it does I can't see what the [i:2tth50ys]Ruby[/i:2tth50ys] calling the '[i:2tth50ys]jar[/i:2tth50ys]' is failing
If it doesn't work do you get any errors ??TIG,
There is no to.ini file in folder SKMtools, and from.ini file contains the path C:\Temp\x\AB.skm
Strange may be my computer system won't let it saves directly!! I'll spend more time closely and follow your instructions and hope find the problem soon!
Thanks for explainations and Happy New Year! -
hgdn
That from.ini is a 'left-over' file from some testing that I've accidentally left in the folder when zipping it - IF the tool worked OK it'd delete it on completion anyway!
So for some reason your Ruby is making the from/to.ini files ???
Try making them with appropriate entries as I directed and see if the jar makes the two new [Edges] files...
I suspect that you need to change the access rights to the Plugins folder and/or SKMtools sub-folder so you have full read/write/execute|change access... -
@tig said:
hgdn
That from.ini is a 'left-over' file from some testing that I've accidentally left in the folder when zipping it - IF the tool worked OK it'd delete it on completion anyway!
So for some reason your Ruby is making the from/to.ini files ???
Try making them with appropriate entries as I directed and see if the jar makes the two new [Edges] files...
I suspect that you need to change the access rights to the Plugins folder and/or SKMtools sub-folder so you have full read/write/execute|change access...TIG,
What do you mean of changing access rights to the Plugins and sub folder? Could you give me more details of how to change that?
I don't have any problem of installations any plugins before. I got so confused! -
@hgdn said:
@tig said:
hgdn
That from.ini is a 'left-over' file from some testing that I've accidentally left in the folder when zipping it - IF the tool worked OK it'd delete it on completion anyway!
So for some reason your Ruby is making the from/to.ini files ???
Try making them with appropriate entries as I directed and see if the jar makes the two new [Edges] files...
I suspect that you need to change the access rights to the Plugins folder and/or SKMtools sub-folder so you have full read/write/execute|change access...TIG,
What do you mean of changing access rights to the Plugins and sub folder? Could you give me more details of how to change that?
I don't have any problem of installations any plugins before. I got so confused!OK when you move plugins to the Plugins folder do you get prompted to allow this ?
If so you have limited permissions.
Perhaps your system is stopping the temporary files being written into the ../Plugins/SKMtools folder.
To check the permissions highlight the SKMtools folder icon, right-click and get then 'Properties' from the context-menu... then open the security tab and edit the settings - ensure all listed 'users' have ticks in all 'Allow' boxes... You might have to be an administrator to do this ? The illustration is Vista BUT XP is essentially the same... -
TIG,
What do you mean of changing access rights to the Plugins and sub folder? Could you give me more details of how to change that?
I don't have any problem of installations any plugins before. I got so confused![/quote]
OK when you move plugins to the Plugins folder do you get prompted to allow this ?
If so you have limited permissions.
Perhaps your system is stopping the temporary files being written into the ../Plugins/SKMtools folder.
To check the permissions highlight the SKMtools folder icon, right-click and get then 'Properties' from the context-menu...[attachment=0:81qclo16]<!-- ia0 -->Capture.PNG<!-- ia0 -->[/attachment:81qclo16] then open the security tab and edit the settings - ensure all listed 'users' have ticks in all 'Allow' boxes... You might have to be an administrator to do this ? The illustration is Vista BUT XP is essentially the same...[/quote]Something is out of my head as I've tried the ways you showed me but still not get it. Too bad I have not had a chance to try it out!
Sorry for spending your precious time! -
All I want you o do is check that the access rights [security] settings to the installed folder 'SKMtools' inside ../Plugins allows all users full access - i.e. all of the 'Allow' boxes are ticked for everyone. To do this follow the instructions in my last post...
Highlight the 'SKMtools' folder's icon and right-click to get a context-menu and select 'Properties'.
Pick the 'Security' tab and under the list of users etc check that all have full-rights allowed.
If not pick 'Edit' and update the settings...
Apply/OK and close.
Now retry my tool...
Advertisement