sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    [Plugin] ImageTrimmer

    Scheduled Pinned Locked Moved Plugins
    364 Posts 58 Posters 228.2k Views 58 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • thomthomT Offline
      thomthom
      last edited by

      You've made a great deal of tools there. Too bad my apartment is such a mess still - don't get much time to look at all these new goodies.

      Thomas Thomassen β€” SketchUp Monkey & Coding addict
      List of my plugins and link to the CookieWare fund

      1 Reply Last reply Reply Quote 0
      • shuraS Offline
        shura
        last edited by

        With that .jar business I resign right away. just want to put another +1 here: simplifying edges? Oh yes please! (drooling)

        1 Reply Last reply Reply Quote 0
        • TIGT Online
          TIG Moderator
          last edited by

          I had dallied with some outline simplification ideas... but brought v1.0 to market without that functionality as my brain hurt.
          I'll think about it again - e.g. even a simple square hole 32x32 pixels currently has 128 edges when 4 would do!!
          A square hole on the diagonal has 256 edges when 4 would do!!!
          I'm sure I can clone some ideas from others' code πŸ˜‰ πŸ˜„

          TIG

          1 Reply Last reply Reply Quote 0
          • thomthomT Offline
            thomthom
            last edited by

            @tig said:

            I'll think about it again - e.g. even a simple square hole 32x32 pixels currently has 128 edges when 4 would do!!
            A square hole on the diagonal has 256 edges when 4 would do!!!
            I'm sure I can clone some ideas from others' code πŸ˜‰ πŸ˜„

            With the simplification algorithm I linked to, then those 128 edges should become 4. You feed it a set of points that form a curve (for separate each curve into sets and you get a simplified set.

            Thomas Thomassen β€” SketchUp Monkey & Coding addict
            List of my plugins and link to the CookieWare fund

            1 Reply Last reply Reply Quote 0
            • CadFatherC Offline
              CadFather
              last edited by

              speechlessly amazing!

              1 Reply Last reply Reply Quote 0
              • TIGT Online
                TIG Moderator
                last edited by

                Here's v1.1 http://forums.sketchucation.com/viewtopic.php?p=294815#p294815
                It's got an 'outline simplifier' option added.
                This is also available a separate tool to simplify the outlines of existing ImageTrimmed components.
                See the notes for details...
                [Thanks to ThomThom and Douglas-Peucker fro the simplification algorithm ideas...]

                TIG

                1 Reply Last reply Reply Quote 0
                • TIGT Online
                  TIG Moderator
                  last edited by

                  @cadfather said:

                  not sure what happened but when run, the script opened edge 'detector.jar' file and there it stayed..
                  it opened with winrar so will check this out

                  You need to have Java enabled on you computer - it usually is...
                  Did you extract most files into SKMtools subfolder as the instructions...
                  The script doesn't open 'EdgeDector.jar' - rather it should 'execute' it as it's a very small app that does just one thing ?
                  What OS system are you using ? XP ??
                  What version of IE do you have ?
                  What version of SUp ? I guess NOT 9.1 πŸ˜’

                  TIG

                  1 Reply Last reply Reply Quote 0
                  • CadFatherC Offline
                    CadFather
                    last edited by

                    not sure what happened but when run, the script opened edge 'detector.jar' file and there it stayed..
                    it opened with winrar so will check this out

                    EDIT: yes if winrar (i guess any other zipping app as well) is set to open jar files too - trimmer will run winrar -- uncheking the file association makes trimmer work fine

                    1 Reply Last reply Reply Quote 0
                    • CadFatherC Offline
                      CadFather
                      last edited by

                      well TIG, with the likes of you, it feels like SU 10.2! πŸ˜†

                      1 Reply Last reply Reply Quote 0
                      • T Offline
                        tomasz
                        last edited by

                        Thanks for the interesting plugin and the inspiration TIG!

                        @tig said:

                        I only taught myself Java in the last week or two

                        Two weeks is not that much. I will give it a try!

                        Author of [Thea Render for SketchUp](http://www.thearender.com/sketchup)

                        1 Reply Last reply Reply Quote 0
                        • TIGT Online
                          TIG Moderator
                          last edited by

                          CADfather

                          I have looked at your '.jar' issue... I can reproduce it! IF I let a 'zip/unzip' application like AlZip or WinRar 'poach' the '.jar' file-type as one that it will open. If so then when Ruby tries to 'open' a '.jar' file instead of it 'executing' in Java [like it should], it 'opens' in the decompression application...

                          The solution = look at your WinRar settings and ensure '.jar' is NOT one of its file-types for opening...

                          TIG

                          1 Reply Last reply Reply Quote 0
                          • CadFatherC Offline
                            CadFather
                            last edited by

                            thanks TIG, that's exactly what i did - (perhaps wasn't too clear in the edit)

                            one specu-question: could you, adjust the sampling rate/area of the script? suppose you didn't want so much precision, it could perhaps speed up the trimming process - having said that, the simplifier is well integrated
                            once the trim is achieved

                            1 Reply Last reply Reply Quote 0
                            • TIGT Online
                              TIG Moderator
                              last edited by

                              @cadfather said:

                              thanks TIG, that's exactly what i did - (perhaps wasn't too clear in the edit)

                              one specu-question: could you, adjust the sampling rate/area of the script? suppose you didn't want so much precision, it could perhaps speed up the trimming process - having said that, the simplifier is well integrated
                              once the trim is achieved

                              Sorry - didn't see the 'edit' ! πŸ˜’
                              It first has to 'get' all of the edges of the solid/transparent areas - it's 'easier' to draw all of the edges as boundaries to these pixels - this is the most complex outline - a Factor 2 simplification will often improve the steppiness of these edges, BUT it can trim small solid areas or leave small transparent areas... Most of the time in the initial processing is finding which edge bits get faces or 'holes' and of course therefore which are part of which 'loops'... The 'simplifier' works on the face perimeter loops once they are made - it's much easier than trying to decide which edges could be the loops initially... You will have seen that the simplifier at Factor 2 reprocesses the faces' loops quite quickly... I can see how to easily recast the code to allow simplification before processing πŸ˜•

                              TIG

                              1 Reply Last reply Reply Quote 0
                              • CadFatherC Offline
                                CadFather
                                last edited by

                                i see.. still a pretty amazing feat.. in fact so are the images produced in the folder.. Thanks again

                                1 Reply Last reply Reply Quote 0
                                • TIGT Online
                                  TIG Moderator
                                  last edited by

                                  @cadfather said:

                                  i see.. still a pretty amazing feat.. in fact so are the images produced in the folder.. Thanks again

                                  The Image's original 'image' file, 'edged' .png and a .dat file [01s] are put into the temporary folder [it is removed IF it's empty] made inside the SKP model's folder. If you answer 'No' when asked if you want to remove temporary files you can open/use them. I didn't automate this deletion because you might want the Image's 'image' file and/or the 'edged' .png. The .dat file does go but it's just a load of 0s and 1s !!! If you leave one of the dialogs open you can always read/copy it before it 'goes' πŸ˜‰

                                  TIG

                                  1 Reply Last reply Reply Quote 0
                                  • CadFatherC Offline
                                    CadFather
                                    last edited by

                                    very useful indeed.. πŸ˜„

                                    1 Reply Last reply Reply Quote 0
                                    • soloS Offline
                                      solo
                                      last edited by

                                      What am I doing wrong? I have a .png. I made it a component, selected it and then clicked on Image trimmer and get a warning 'Image trimmer: You selected an Image first.', so I exploded and tried again with same warning, I tried simplyfier and it works, but trimming does not, what am I doing wrong?

                                      http://www.solos-art.com

                                      If you see a toilet in your dreams do not use it.

                                      1 Reply Last reply Reply Quote 0
                                      • TIGT Online
                                        TIG Moderator
                                        last edited by

                                        @solo said:

                                        What am I doing wrong? I have a .png. I made it a component, selected it and then clicked on Image trimmer and get a warning 'Image trimmer: You selected an Image first.', so I exploded and tried again with same warning, I tried simplyfier and it works, but trimming does not, what am I doing wrong?

                                        You don't use 'ImageTrimmer' on a 'Component' - you use it on a plain imported [unexploded] 'Image' - check in Entity Info to see what it is...
                                        After it's 'trimmed' that Image is copied as a Material applied to Faces inside a new Component...
                                        so then you can no longer 'trim' it, but of course you can 'simplify' the outlines later within the Component... πŸ˜•

                                        TIG

                                        1 Reply Last reply Reply Quote 0
                                        • Dave RD Offline
                                          Dave R
                                          last edited by

                                          Oxer, you might try importing the image as an image and then immediately running the plugin on it. See if that does what you want.

                                          Etaoin Shrdlu

                                          %

                                          (THERE'S NO PLACE LIKE)

                                          G28 X0.0 Y0.0 Z0.0

                                          M30

                                          %

                                          1 Reply Last reply Reply Quote 0
                                          • OxerO Offline
                                            Oxer
                                            last edited by

                                            Hello TIG!

                                            I don't know how use the plugin, i do this:

                                            1. I import a png file like image.
                                            2. I make a new component, its name the same like image.
                                            3. I make a new material with the png file with the same name, and i apply this material to the face inside the component.
                                            4. I select the image into SU and run the plugin.
                                              Nothing happens, only the plugin creates a folder named "TrimmedImages" in the same directory that Model file, it contains the png file.
                                              What i do bad?

                                            I use Mac with OSX 10.6 and SU 8.

                                            EDIT: Appears this message in Console Ruby
                                            Console Error

                                            "The result is the end what is important is the process" by Oxer
                                            [http://www.oxervision.blogspot.com/(http://www.oxervision.blogspot.com/)]

                                            1 Reply Last reply Reply Quote 0
                                            • 1
                                            • 2
                                            • 3
                                            • 4
                                            • 5
                                            • 18
                                            • 19
                                            • 1 / 19
                                            • First post
                                              Last post
                                            Buy SketchPlus
                                            Buy SUbD
                                            Buy WrapR
                                            Buy eBook
                                            Buy Modelur
                                            Buy Vertex Tools
                                            Buy SketchCuisine
                                            Buy FormFonts

                                            Advertisement