• March 21, 2019, 11:04:53 PM
• Welcome, Guest. Please login or register.
Did you miss your activation email?

Author Topic: Cutting large SVG into smaller equi-dimensional SVGs  (Read 10148 times)

0 Members and 1 Guest are viewing this topic.

Offline adrenalineforu

  • Sr. Newbie
  • **
  • Posts: 5
Cutting large SVG into smaller equi-dimensional SVGs
« on: August 06, 2016, 10:53:11 AM »
Hello guys,

Hope everyone's doing fine.

I have been using Inkscape (0.91) primarily to trace bitmaps of JPGs. I am trying to figure a way to cut a large SVG into smaller equi-dimensional sizes.

https://www.dropbox.com/s/y7uetmu9qj0kyyv/Wave-left-horz.svg?dl=0

If you take a look at the attached SVG, it's been nicely laid out on 1000 mm x 400 mm document size with of grids of 200 mm x 200 mm. I need to cut this image into sizes of 200 mm x 200 mm which shall give me 10 individual equi-dimensional SVGs.

Originally, I tried cutting the JPG into equi-dimensional images and then trace them individually, which worked fine, but the only problem was the SVGs, after being traced out, does not maintain the aspect ratio of the original image being traced.

A solution to either one of the two cases above would be appreciated.

Thanks in advance.
Regards

Offline brynn

  • Administrator
  • *****
  • Posts: 312
  • Country: us
  • Gender: Female
    • Inkscape Community
Re: Cutting large SVG into smaller equi-dimensional SVGs
« Reply #1 on: August 07, 2016, 06:26:49 AM »
Welcome!

Using Trace Bitmap on the JPG pieces should not affect the proportions or aspect ratio.  The traced image might have different proportions than the original, because there is some blank space in the original, between the drawing and the edge of the page.  But the proportions of the image itself -- the drawing -- doesn't change.

If you look closely, like in the very middle of this drawing, where  there is only that thin stem, it looks like this drawing had been cut there, at some time, and then reconnected back together.  I'm guessing someone pieced it together before doing an auto trace.

Of course, you realize that the drawing only exists in 5 or 6 of those 10 pieces.  So do you actually need some of those 10 SVG files to be blank?  Or do you need them to consist of a white square?

Here's how you can break the drawing up into those 5 squares.  There's a 6th square which contains just the tip of one of the light rays from the lighthouse.  Since I'm not sure what your goal is with this project, I can't suggest how to handle that.  But I just wanted to mention it.  (Maybe just sacrifice that tip, or maybe shift the square up slightly.)

Also, there's a 99% transparent Rectangle on top of the 2nd square from the left, bottom row.  You should delete that, because it won't be needed (it's not the right size anyway).  Oh wait, there's another, far left square, bottom row.  Delete them both. (Just click in the middle of the square to select them.  Then Delete.)

1 - Draw a new square, the size that you need.  Make sure the corners are square, by clicking this button on the Rectangle tool control bar.  And if you were the one who drew the transparent rectangles, you might need to make sure the new ones aren't transparent.  After you draw them, go to Object menu > Fill and Stroke and find the Opacity slider.  Put it all the way to the right, with a value of 100.00.

Actually the new ones could either be partially transparent, to help you see what you're doing, or you could give the squares a stroke and remove the fill entirely.  You can do that in the Fill and Stroke dialog.

2 - After you draw the square, do Path menu > Object to Path

3 - Switch to the Selection tool  :sel:.  On the Selection tool control bar, make the X and Y values both 0.000.  (Press Enter key after you change the values.)  That will align the square to be the bottom-left square, over the drawing.

4 - Next you need to learn about Snapping, if you haven't already.  Or, you could use the X and Y values to place the rectangles in their proper places.  Since it's a fixed grid with known size, that shouldn't be too hard.  Here's the manual section on Snapping, if you want to try it:  http://tavmjong.free.fr/INKSCAPE/MANUAL/html/Snapping.html

5 - Duplicate the first square, and place them side by side.  Whether you use snapping or just align them with X and Y values doesn't matter.  But duplicate the first square 4 or 5 times, and move them into place.

6 - Select the drawing and duplicate it

7 - While the duplicate is still selected, hold the Shift key and click on one of the squares.  (The Shift key allows you to select more than one object at a time.)

8 - Path menu > Intersection.  You might have to wait a few moments for this operation to finish, because this drawing has so many nodes.  (Edit - the part of the drawing that you just "cut out" is right on top of the original.  So it won't be immediately obvious that anything has happened.  You'll just see the dotted line and arrows where the square used to be.   But just drag the result off to the side, and you'll be able to see it.)

9 - Repeat steps #6, #7 and #8 for each square, until you have all the pieces you need.  If you forget #6, at any point, you'll quickly realize why it's important  :)  Just keep the Undo button handy!

Let us know how it goes!
  • 0.92.2
  • Windows 7 Pro, 64-bit

Offline adrenalineforu

  • Sr. Newbie
  • **
  • Posts: 5
Re: Cutting large SVG into smaller equi-dimensional SVGs
« Reply #2 on: August 07, 2016, 08:41:58 AM »
Morning Brynn and thank you for bringing me in.

You are right about what you mentioned on Aspect ratio, guess I couldn't explain it right. The traced image was removing the blank 'white' space between the edge of the drawing and the edge of page. The resultant trace was exactly same at the original but selection became smaller - and that's what I did not want. And you are right again; effectively I only need 5 blocks and I can do away with the one that has a small tip of light from light house. And that 'someone' is me trying every possible way left and right to make things works, with utter failure. I have been searching all over google and youtube to make it work; guess now I landed at the right place. Sorry if the image you received was already un-treatable. I will create a fresh trace from JPG and start over with your instructions.

Well basically, let me emphasize why I am so specific about image sizes. That 200 mm x 200 mm is the maximum I can print on my 3D printer. That's the bed size it has and anything larger than that size has to be cut to be exactly proportionate so when I put the pieces together side-by-side, they complete the whole image, only this time in 3 dimensions. I re-sized and placed the entire image such that I do not have to print too many blocks with small things inside them (for printing efficiency); that's why you see empty blocks which are intentionally that way. Unfortunately, a light ray tip from light house will still have to be sacrificed (or maybe not) :lol:

I cannot thank you enough for giving me your valuable time and walk me through this.  :th:

I have been through your instructions and will see how they work out. Will update you soon.

Happy Friendship Day to you and nice people here.

EDIT - I followed the instructions verbatim and everything went fine right up to #8. I am actually getting the splits from the main image, but one problem remains. The intersected path maintains the proportion as original image but loses the empty white space around it, which I need, otherwise when I offer this image to printer it re-sizes it based on the bed size and that's when the piece goes out of proportion.
« Last Edit: August 13, 2016, 08:11:46 AM by adrenalineforu »

Offline brynn

  • Administrator
  • *****
  • Posts: 312
  • Country: us
  • Gender: Female
    • Inkscape Community
Re: Cutting large SVG into smaller equi-dimensional SVGs
« Reply #3 on: August 07, 2016, 08:38:03 PM »
Oh wow, that's amazing!  I've never heard of paper quilling before.

I'm not positive about this, but I'm pretty sure there's going to be a way to use some different options in Trace Bitmap dialog, so that you can keep the white background.

I'll try and work something out, and I'll post again with instructions  :)
  • 0.92.2
  • Windows 7 Pro, 64-bit

Offline brynn

  • Administrator
  • *****
  • Posts: 312
  • Country: us
  • Gender: Female
    • Inkscape Community
Re: Cutting large SVG into smaller equi-dimensional SVGs
« Reply #4 on: August 07, 2016, 09:31:41 PM »
Actually, rather than use Trace Bitmap, let's keep it as SVG paths.  I think that will get a better result anyway.

Here's what you need to do.

Do #1, #2, and #3, from the previous instructions.

4 - Duplicate all the squares once.  Give them a white fill, and a stroke, if you want a stroke.

5 - Put the squares with the white fill behind the paths (Object menu > Lower, or Lower to Bottom, or use buttons on the Selection tool control bar, or key shortcuts).  The other square has to be on top of the paths, to be used for the Intersection operation.

6 - Perform the intersection

7 - Select the result from the intersection and the extra (white) square, and do Object menu > Group (or use the button on the command bar  :gr:, or the key shortcut)

Before, I think I missed the part about putting each square in its own SVG file.  So now for that:

8 - Select a group, Copy, and Paste into a new file

9 - Set the page size for that file to match the square size, if that's what you need to do  (I'm not sure, since I've never printed from Inkscape.  And plus, all printers are different.)

I hope that will work for you.  Because of the nature of vector graphics, the only way to keep the white space, it to use a separate path to hold it.  Well....actually the path doesn't have to be separate.  It could be combined with the drawing paths, rather than grouped.

Oh!  Actually, that's not true.  If keeping that white square causes some kind of problem, I can think of another way to preserve the space.  Go back to the previous instructions, but before you start, set up the 5 or 6 SVG files with the page size set to the size of the squares.

-- Next, perform all the intersections.
-- Select 1 intersection result and Copy it.
-- Open one of the new SVG files, and paste it in.
-- Object menu > Align and Distribute
-- In the Relative To: dropdown menu, choose Page
-- With the intersection result selected, click these 2 buttons in that dialog and .  This will center the object on the page.
-- Repeat for all the squares.
-- Next, when you send the page to the printer, make sure it's set to print the Inkscape page.  Since I don't use printers, I don't have a good understanding how they work.  But once a long time ago, I had trouble with printing something, because I wanted a whole 8.5 x 11 sheet printed, but the printer was imposing some kind of margins, and I couldn't make it work right.

But anyway, as long as the squares were aligned perfectly, and your printer can print the Inkscape page, this should work perfectly.  But if any of the squares were a  little bit off, when you did the intersections, the pieces won't fit together exactly.  Or if the printer can't print the Inkscape page size, you'll need to use the white square technique.

I hope at least one of those techniques will work  :)
  • 0.92.2
  • Windows 7 Pro, 64-bit

Offline adrenalineforu

  • Sr. Newbie
  • **
  • Posts: 5
Re: Cutting large SVG into smaller equi-dimensional SVGs
« Reply #5 on: August 08, 2016, 05:49:20 PM »
Hi Brynn,

I made a few configuration changes with the printer and the problem of maintaining the size is fixed; I no longer have to worry about the removed white background (empty space). In any case, I will keep your guide handy for I might end up with some new sizing issues with other pieces or drawing.

Basically,  :ur:

This was the second-last hurdle in the project which you helped me out with, so many thanks to you. I'm currently in the process of printing two of the pieces (left-most upper and left-most lower) and once they are out will finally see how they fit physically.

Just so you are also aware, the printer doesn't take SVG files as input. There's another step in-between, where SVG is converted in to STL, which a 3D printer very well understands.

I will share when the prints are finally out.

Offline brynn

  • Administrator
  • *****
  • Posts: 312
  • Country: us
  • Gender: Female
    • Inkscape Community
Re: Cutting large SVG into smaller equi-dimensional SVGs
« Reply #6 on: August 09, 2016, 03:47:17 AM »
Oh, that's good news!

Hopefully you can save your sister a few steps  :)
  • 0.92.2
  • Windows 7 Pro, 64-bit

Offline adrenalineforu

  • Sr. Newbie
  • **
  • Posts: 5
Re: Cutting large SVG into smaller equi-dimensional SVGs
« Reply #7 on: August 10, 2016, 05:35:53 PM »
Nailed it !!! Almost 20 meters and 6 hours of hit-n-trials printing.

I had orange filament only, so everything's orange. Would have loved it Black. Guess Orange is the new Black  :b1:
Gotta try out coloring now.

Thanks for a all the help Brynn. I appreciate it.

Take care
« Last Edit: August 13, 2016, 08:10:57 AM by adrenalineforu »

Offline brynn

  • Administrator
  • *****
  • Posts: 312
  • Country: us
  • Gender: Female
    • Inkscape Community
Re: Cutting large SVG into smaller equi-dimensional SVGs
« Reply #8 on: August 11, 2016, 04:43:01 PM »
Wow!

That doesn't look like paper though.  I must have misunderstood something.  What is that made of?
  • 0.92.2
  • Windows 7 Pro, 64-bit

Offline adrenalineforu

  • Sr. Newbie
  • **
  • Posts: 5
Re: Cutting large SVG into smaller equi-dimensional SVGs
« Reply #9 on: August 11, 2016, 05:07:30 PM »
Well, it's not paper. It's PLA (Polylactic Acid), kind of biodegradable plastic.

The idea is to use this instead of paper and save hours of cutting and pasting. Of course, it cannot replace the look and feel of paper but I feel this material and methodology is revolutionary as half of the work is taken over by machine, and they do parallel tasks. That's what I feel.

I myself gotta wait to see even better results so I can further justify.

I have some more modifications in my head. Hope they work out the same way as this have up until now.

Regards