gotcha

Author Topic: Not clear on how to 'crop' something I created in inkscape  (Read 1692 times)

May 13, 2019, 11:37:19 AM
Read 1692 times

chrisj

  • Jr. Member

  • Offline
  • ***

  • 10
I'm very new to inkscape, and saw the steps on how to crop an image (the image I created is simply a couple of words: text.text):
1. "Select all the objects that you want to clip / crop"
so, to 'select" I use the 'selection tool" (arrow) correct?
see attached image example1.png (image created from Paint)

2. "group them together with Object > Group"
when I click Object > Group it stays the same as example1.png

3. "Draw a shape over the top of the group where you want to clip / crop"
so, I assume 'draw' means to use the pencil icon tool, and it looks like example2.png

"Finally, select both the group from Step 1, and the clipping object from Step 2, and from the Inkscape menus, choose Object > Clip > Set."

it looks like example3.png


Clearly, I don't understand how to do this correctly, and additional help is appreciated

  • 0.92
  • windows

May 13, 2019, 02:24:24 PM
Reply #1

brynn

  • Administrator

  • Offline
  • ******

  • 3,941
  • Gender
    Female

    Female
    • Inkscape Community
Welcome to the forum!

1 - correct

2 - Ok, if you look at the text after you select it, notice how the bounding box (the dashed line rectangle) is already around both of them.  That means they are already one object.  I don't know whether they are one text object or a group (I would need to see the SVG file, to know that).  But in any case, since they are already a single object, you don't need to group them.

3 - While you certainly can use any tool that draws a path, to create the clipping path, in this case you would typically use the Rectangle tool, and draw a rectangle around it.  (Even though the Rectangle tool draws a shape, not a path, it still works like a path for clipping, and some other things.)

But now that I'm thinking about that, I'm starting to wonder why you want to clip the text in the first place.  It's not clear from your screenshot what else might be happening with the image.  But it's possible you don't need to clip the text at all.  If you clip the text as you've shown it, it's not going to look any different.

Anyway, you have the correct steps for clipping.  I don't know why the result would look like your 3rd example, because it looks like you've drawn a whole new clipping path.  Possibly you didn't have both the text/group and clipping path both selected.  I'm just not sure.

If you could give us a little more info about what you want to accomplish, we can guide you in the proper way to do it.  I'm concerned that you might not need to clip the text at all.

  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann                       

May 13, 2019, 04:11:22 PM
Reply #2

chrisj

  • Jr. Member

  • Offline
  • ***

  • 10
Thanks for your reply.

Regarding "why you want to clip the text in the first place", I'm simply trying to make that image the size of the 'bounding box' and save it (and then make it's background transparent) (and then use it as a watermark on an uploaded video).

I've been using GIMP, but the image I tested there didn't look sharp, but, I could crop anything I created in a nano-second.
The example I've seen using the rectangle tool (https://inkscapetutorials.wordpress.com/2014/04/22/inkscape-faq-how-do-i-crop-in-inkscape/#clipping), seems to cover up the work that is created. That seems odd. I attempted that and saved a black rectangle instead of what I created..So, I have selected it and then covered it with a rectangle and then clicked object > Clip >Set and it looks like a filled-in rectangle - see attachmentrectangle.png
*rectangle.png
(1.1 kB . 537x119)
(viewed 823 times)


Any additional help, tips, suggestions, solutions, is appreciated
  • 0.92
  • windows

May 13, 2019, 04:40:04 PM
Reply #3

brynn

  • Administrator

  • Offline
  • ******

  • 3,941
  • Gender
    Female

    Female
    • Inkscape Community
Regarding "why you want to clip the text in the first place", I'm simply trying to make that image the size of the 'bounding box' and save it (and then make it's background transparent) (and then use it as a watermark on an uploaded video).

The text already is the size of the bounding box.  That's what the bounding box shows you, the size of the object.  However, to use as a watermark, I'm guessing you probably need the page to be the same size as the object.    (Remember that raster graphics (GIMP) and vector graphics (Inkscape) are very, very different.)

Although I don't know that for a fact.  I guess you either need the page to be the size of the text, or the size of the video.

First, delete all your other contents, all the clipping paths you made, everything but the text.

If you need the page to be the size of the video, go to File menu > Document Properties > Page tab > Custom Size.  If you need it the size of the text, first select the text, then File menu > Document Properties > Page tab > Custom Size > Resize Page to Contents.

Now, the page is the right size.  Next, transparent background.  Inkscape's background is transparent by default.  So as long as you typed the text in Inkscape, and didn't import a raster image, it's already transparent.

To use as a watermark, you probably need to make the text partially transparent as well.  There are a couple of ways to do that, but the easiest way is Object menu > Fill and Stroke > Fill tab, and find the Opacity slider near the bottom of the dialog.  First select whatever you want to be transparent.  Then just slide to your desired amount.

Save and done!

(I'm just guessing, but I think your attempts at clipping have been failing because you don't have both objects selected at the same time.  But I don't think you need clipping after all.)
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann                       

May 14, 2019, 09:50:10 AM
Reply #4

chrisj

  • Jr. Member

  • Offline
  • ***

  • 10
Much thanks for your replies/guidance.

Yes, this worked successfully: File menu > Document Properties > Page tab > Custom Size > Resize Page to Drawing or Selection", and then exported to .png. Then I uploaded as watermark to the web video script that I'm using, as a test example. It looks ok in the smaller screen, but when full screen is selected, it looks unsharp.

This may not be something that inkscape can help with, but I thought I'd attach the sample images. If you select them, you'll be see how they appear. I look forward to any comments/suggestions/solutions to improving it.
  • 0.92
  • windows

May 14, 2019, 02:20:02 PM
Reply #5

Moini

  • IC Mentor

  • Offline
  • ******

  • 1,568
    • VektorRascheln
If your drawing consists of vector elements, then export with a higher resolution (i.e. choose a larger 'dpi' = 'dots per inch' value). It's normal for raster images to be 'unsharp' when zoomed in or enlarged. Only vector data can be zoomed in indefinitely without loosing sharpness.

May 14, 2019, 03:07:54 PM
Reply #6

chrisj

  • Jr. Member

  • Offline
  • ***

  • 10
Thanks for your reply.
I like hearing that "only vector data can be zoomed in indefinitely without loosing sharpness".
Regarding "If your drawing consists of vector elements", how can I determine if I have 'vector elements'?
I just have text as the inkscape "drawing".

Additionally, can the DPI be increased without increasing the size?
« Last Edit: May 14, 2019, 03:51:17 PM by chrisj »
  • 0.92
  • windows

May 14, 2019, 04:42:27 PM
Reply #7

brynn

  • Administrator

  • Offline
  • ******

  • 3,941
  • Gender
    Female

    Female
    • Inkscape Community
PNG is a raster format.  So it's exporting to PNG when the vector text becomes rasterized.  If there were some way to make one watermark file available for the smaller video version, and another watermark file available for the full screen, then you could make 2 different size images, and avoid the pixelation (that's what it's called when a raster image is scaled or zoomed).  I guess you'd have to know a lot about coding webpages (where the video is) to be able to do that.  And I don't know for a fact that it's possible at all.

I don't know if you could use an SVG file to provide the watermark, but it might be possible.  Then that would solve the problem!

The DPI can be increased in the Export PNG dialog.  And it does make the image larger.  If you were printing the image, then you would set the size at printing time, and it compresses the "dots" back down to the right size.  But to be honest, I'm not exactly sure how you would make the watermark image the right size, while keeping the increased dpi.

But I'm sure someone else will be able to explain it for you.  (And I'll look forward to learning myself ;) )
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann                       

May 14, 2019, 07:34:17 PM
Reply #8

flamingolady

  • IC Mentor

  • Offline
  • ******
  • Flamingo Lady

  • 154
  • Gender
    Female

    Female
Just to expand a little on Brynne's post.  When I need a high resolution png I export the resolution as around 200 - 300 dpi.  Keeping it as a png helps too. It doesn't change the physically size bur significantly changes the resolution.  Be sure to open the png file, zoom to 100% and see what it looks like at that dpi.  You can always increase or decrease it as needed. 

May 15, 2019, 10:35:39 AM
Reply #9

chrisj

  • Jr. Member

  • Offline
  • ***

  • 10
Thanks for your reply.

I tried what you suggested. I created the same text image at 65 x 10, raised the dpi to 300, saved as .png and when I look at details > dimensions it shows the size to be 781 x 122. But, when I import it into inkscape it shows the size as 65 x 10. I don't understand that.
And, when you say "It doesn't change the physically size", I don't understand how you do it without changing the size.

and you say "You can always increase or decrease it as needed", what is "it"? the dpi or the physical size?
If it's physical size how?

I look forward to additional assistance



Also, although I changed the preferences to autosave, prior to this, I don't see anything in the autosave directory:\Users\Owner\AppData\Local\Temp
  • 0.92
  • windows

May 15, 2019, 02:10:39 PM
Reply #10

flamingolady

  • IC Mentor

  • Offline
  • ******
  • Flamingo Lady

  • 154
  • Gender
    Female

    Female
When you created 65x10, is that pixels mm or what, that's very small if pixels.   ok, first step, make the design the actual physical size you want the output to be. Just for consistency, group everything and then ensure you've selected it.  Then, bring up File>export png image. Under Image Size there will be a width and height by default. The tab 'Selection' will be highlighted, which is what we want for this purpose.  In the width box type in 300 (overwrite whatever comes up). 
Here's the confusing part, even though it's now showing a much bigger width and height, that's only the number of dpi that has changed - not the physical size.  (don't worry about that right now), just follow along.  Then you can select on 'export as' if you want to change the place it is choosing to save it.  Lastly, click on export.  After exporting, open the new png file, enlarge to 100% zoom and see how it looks.  Let us know.  I'll check back here later.
Edit:  if you have text in your design (keep a copy of it first), you may need to do Path>object to path before exporting in order for it to look good.  Also, gradients dont always come out looking great imo...

May 15, 2019, 04:47:48 PM
Reply #11

chrisj

  • Jr. Member

  • Offline
  • ***

  • 10
Thanks for your reply.
So, I created another text image that is 100px x 18px, followed your instructions and then exported, open to 100% and it looks good, however the png file dimensions show 300px x 54px, which is the width that you instructed. So, how do I retain the 100px x 18px, with good dpi?
  • 0.92
  • windows

May 15, 2019, 07:56:56 PM
Reply #12

brynn

  • Administrator

  • Offline
  • ******

  • 3,941
  • Gender
    Female

    Female
    • Inkscape Community
Yes, changing the dpi does change the size of the object.  The page size that you set doesn't change, but the image is still much bigger.

Hhmm....just thinking it through....  Try this.

Instead of using the Selection option in the Export PNG dialog, use Page.  Remember when we changed the page size to be the same as the image size?  I think this might be the key.  Notice when you do that, in the Export PNG dialog, only the image size changes.  The page size remains the same.  Next, add the new PNG to the video as the watermark, just like you did before.

Ok yes, even though my file manager reports that the PNG image is the larger size, when I import it back into Inkscape, it's the original size.  So I'm thinking the correct size of the page is in the code for the image, and I'm thinking that browsers will display the image as the correct size.

After some more testing, I think it might not even be necessary to use the Page option for export.  It might work just like it is already.  The key is using Resize page to contents, before exporting.  So just try it. 

It's somewhat of an educated guess, on my part.  But it certainly can't hurt to try  :xf1:

Edit (Otherwise, someone else will be able to say how to do this correctly.)
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann                       

May 15, 2019, 08:07:51 PM
Reply #13

flamingolady

  • IC Mentor

  • Offline
  • ******
  • Flamingo Lady

  • 154
  • Gender
    Female

    Female
oh good, sounds like it worked.  Moini, or others are probably better at the explanation than me for the sizing, but I'll give it a shot - took me forever to understand it, and until I did did a comparison, it didn't sink in.  Your file is the same physical size, only the number of dpi (dots per inch) has increased to give a better resolution.   To prove it, open your exported png zoom it to say 50%, and open your original svg and zoom it also to 50% now compare them.  If it helps, cut and paste the png directly into the svg, place them side by side, and you will see that the physical size has not changed. That's the best way I can think of to show you.  Basically, more dots have been squished into the file so it looks better. And then there's printing dpi... I wish the export used a different term to be honest.
What are you trying to do with the file?  Is there a file size limit? If you need a smaller file you can try to export at varying dpis, 200, 250, etc., or you could convert it a jpg which is a bit smaller file.

May 15, 2019, 08:13:19 PM
Reply #14

flamingolady

  • IC Mentor

  • Offline
  • ******
  • Flamingo Lady

  • 154
  • Gender
    Female

    Female
Brynn, we posted at the exact same time, lol.  Pls also do the side by side comparison.  The physical size doesn't change, if you start with a 4"x6" square, no matter if you export at 90 or 300, the physical size will remain at 4"X6".  That's the point I'm trying to make. 
It doesn't matter if you use Page, selection, etc.  However, I chose to use Selection just to ensure that extra space didn't accidentally get included in the mix, that happens a lot when choosing page, and you end up with white space, depends on the size of your bounding box and where your design is.

May 15, 2019, 08:24:32 PM
Reply #15

brynn

  • Administrator

  • Offline
  • ******

  • 3,941
  • Gender
    Female

    Female
    • Inkscape Community
Yeah, that happens sometimes, posting at the same time.  Moini has a tremendous talent for posting while I'm typing a message!

I think the key in this case is using Resize page to contents.  That sets the page size, which I suspect is what the browsers will "read".  Still just a theory, since I'm not set up to make a live test.  But easy enough for chrisj to try.

Yes, I also suspect that it doesn't matter whether you use Selection or Page.  But thinking of the Page option is what put me on the mental trail that using resize to contents might be the answer.

It's good to see you around lately.  I'm going to send you a PM shortly, but no rush.
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann                       

May 15, 2019, 08:33:47 PM
Reply #16

flamingolady

  • IC Mentor

  • Offline
  • ******
  • Flamingo Lady

  • 154
  • Gender
    Female

    Female
Well yes, resizing works well, but I didn't want to start Chrisj on that.  Either way, the physical size doesn't change, only the dpi changes.

ps, still not fully back to life, lots of issues still, but trying to check in a bit.  It's amazing how much one forgets when Inkscape isn't used in awhile.  Right now I'm about to kill the scaling button, doesn't seem to work for me, lol.

May 15, 2019, 08:45:52 PM
Reply #17

brynn

  • Administrator

  • Offline
  • ******

  • 3,941
  • Gender
    Female

    Female
    • Inkscape Community
chrisj needs to use resize page to contents, for what they're doing (whether dpi changes or not).  I just didn't realize that would be the key to keeping the right size after increasing the dpi.  (Or at least that's what I'm suspecting.)
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann                       

May 15, 2019, 09:29:03 PM
Reply #18

chrisj

  • Jr. Member

  • Offline
  • ***

  • 10
Thanks for your replies.
But, this seems ridiculously cumbersome. Not user friendly.
Whenever the dpi goes up the size goes up. That's what I see every time, page or selection.
One person says the physical size does change and one person says it doesn't.
Oh well, it's seems to have the same output as GIMP, except not as simple to use as GIMP
  • 0.92
  • windows

May 15, 2019, 10:16:41 PM
Reply #19

brynn

  • Administrator

  • Offline
  • ******

  • 3,941
  • Gender
    Female

    Female
    • Inkscape Community
Did you try putting the watermark (with higher dpi) on the video?  Was it the right size?  If it was the right size, did the higher dpi help with the blurriness?

If you read the messages closely, we were talking about different things.  The size of the image does change.  The size of the page does not change.  I know it sounds confusing.  But the main point is whether it works or not.

Remember that vector graphics and raster graphics are very different.  So there are different steps to take in different programs.  In raster graphics, the size of the image and the size of the page are usually the same thing.  Not so in vector graphics.   

Raster and vector have different purposes and uses on the internet.  So the first step, before you start to draw your image, is to decide whether you want or need raster or vector.  Most of the time, there's no reason to compare them against each other, because most of the time you need one or the other.  If you need a raster graphic, use gimp.  If you need vector, use Inkscape.  There's a little crossover, and then you can use whichever one you want.
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann                       

May 15, 2019, 11:24:41 PM
Reply #20

flamingolady

  • IC Mentor

  • Offline
  • ******
  • Flamingo Lady

  • 154
  • Gender
    Female

    Female
Physical size of your design does not increase, but the file size increases, and the dpi increases, if that helps.  That's why I suggested to compare them for yourself so you can understand.  I know it feels like a bad psychotic loop at this point. 
Sounds like your design is displaying well now, and that's what I think you really needed,.  Inkscape is like any program you use, it takes time to learn the ins and outs, and it's pretty intricate, but once you know it, it goes faster.  If you have un-resolved issues, please let us know.

May 19, 2019, 09:19:57 AM
Reply #21

chrisj

  • Jr. Member

  • Offline
  • ***

  • 10
Thanks again for your replies.
Can someone please provide me with an .svg file to add to the php web video script to test as a uploaded video watermark?
Anything, say 100 x50 px, a lightbulb image for example. So, I can see if it works/how it works?
Thanks
  • 0.92
  • windows

May 19, 2019, 11:29:43 AM
Reply #22

brynn

  • Administrator

  • Offline
  • ******

  • 3,941
  • Gender
    Female

    Female
    • Inkscape Community
You can make an SVG file yourself, in case you didn't realize it.  That's what Inkscape is primarily made for.

 -- open Inkscape
 -- draw something (or just use the same text image that you made before)
 -- Document Properties > Page tab > Resize page to contents
 -- File menu > Save As > Inkscape SVG
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann                       

May 19, 2019, 11:53:51 AM
Reply #23

chrisj

  • Jr. Member

  • Offline
  • ***

  • 10
Thank you for your message.
I actually did what you suggested, and then changed the name to watermark.svg and tried to replace my watermark.png in my php file, where the videos are uploaded, like this:

//$watermark_image_full_path = "watermark.png";
$watermark_image_full_path = "watermark.svg";

but, it doesn't display on the uploaded video.

Any comments are appreciated
  • 0.92
  • windows

May 19, 2019, 04:55:48 PM
Reply #24

brynn

  • Administrator

  • Offline
  • ******

  • 3,941
  • Gender
    Female

    Female
    • Inkscape Community
I don't actually know how to apply a watermark to a video.  I was only wondering if it might work to use an SVG. 

I'm not sure why an SVG wouldn't work, because it seems like it's just putting an image on a webpage.  But again, I've never done this, and don't know anything about it.

I guess it sounds like it won't work.

Edit
So you're using PHP.  Are you viewing it in a browser?  Or something else?  Maybe that program doesn't support SVG?  I assumed you'd be viewing it in a browser, and most browsers should be able to display an SVG image.  Or maybe PHP doesn't support SVG.....I'd have to do some research to be sure.

Edit #2
Perhaps PHP doesn't support SVG?  Some very brief research, I found this:  https://sheelahb.com/blog/how-to-get-php-to-play-nicely-with-svg-files/
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann