GIMP Chat
http://gimpchat.com/

Scaling paths?
http://gimpchat.com/viewtopic.php?f=8&t=2868
Page 1 of 1

Author:  PhotoMaster [ Wed Oct 19, 2011 6:54 pm ]
Post subject:  Scaling paths?

GIMP Version: 2.6.11
Operating System: Windows
OS Version: Win 7 - 64 bit
GIMP Experience: Advanced Level



This is something I never tried before, and is probably quite simple. I'm just having a brain spasm about it, so I figured I'd ask.

If I take a basic graphic image/shape and enlarge it, the edges tend to get tiled, which is standard for raster graphics. But if I make a selection of a graphic image and make a path from the selection, I should be able to enlarge the path and in essence make a cleaner, larger version of the same basic image/shape, from the enlarged path. Does anyone know how I could go about doing this? I would think Gimp can do it, but I'm not sure.

Thanks in advance,

Greg

Author:  lylejk [ Wed Oct 19, 2011 7:06 pm ]
Post subject:  Re: Scaling paths?

As long as your path is from a selection fill (single color) this can be done PM. Then scale the path and fill it. :)

Author:  Oregonian [ Wed Oct 19, 2011 7:22 pm ]
Post subject:  Re: Scaling paths?

A path will enlarge along with its image. The first image is 300x300 and I drew a path in it that takes up most of the image. Then I scaled the image to 500x500 and the path enlarged along with it.

Image Image

Author:  nzdawghaus [ Wed Oct 19, 2011 7:23 pm ]
Post subject:  Re: Scaling paths?

I just realized what those buttons are for at the top of the tool options. PhotoMaster jedi-mindtricked me into learning some thing new. He's sneaky like that...

Image

Author:  PhotoMaster [ Wed Oct 19, 2011 10:06 pm ]
Post subject:  Re: Scaling paths?

Thank you muchly! I tried it and it did work, although creating a selection from the enlarged path was still blocky. So I created a selection from the enlarged path, and created a new path from the selection. Then finally I created a new selection from the new path and when I filled the selection, it was smooth! No blockiness!

Author:  Rod [ Thu Oct 20, 2011 3:35 am ]
Post subject:  Re: Scaling paths?

I was going to suggest just that.
Take your path and create a selection from it, enlarge that and re save as path again. :)
Then stroke or fill the path.

Author:  ofnuts [ Thu Oct 20, 2011 4:59 am ]
Post subject:  Re: Scaling paths?

PhotoMaster wrote:
Thank you muchly! I tried it and it did work, although creating a selection from the enlarged path was still blocky. So I created a selection from the enlarged path, and created a new path from the selection. Then finally I created a new selection from the new path and when I filled the selection, it was smooth! No blockiness!
You must have missed something ... because if you scale a path up and stroke it (or Select from path+Fill) the result is sharp and clean. In fact your method may look smooth, but it also rounds off sharp edges. Here is a comparison of the various methods to get a 5x enlargement. To my naked eye, even with zooming, I don't see any difference in quality between the last three, that are:

- Path from font size 20 blow up 5 times, selected and filled
- Path from font size 100, selected and filled
- Output from the Text tools (font size 100)

(there may be a minute shape difference if the font in size 100 isn't exactly the size 20 one blown up 5x).
Attachment:
ScalePath.png
ScalePath.png [ 28.77 KiB | Viewed 11288 times ]

Author:  GnuTux [ Thu Oct 20, 2011 7:38 am ]
Post subject:  Re: Scaling paths?

Thanks for a timely thread. Good info!

Stroking the path does what stroking the selection with a paint brush is supposed to do, but doesn't.

Author:  dd [ Thu Oct 20, 2011 8:31 am ]
Post subject:  Re: Scaling paths?

When creating paths from selections, you can use the advanced options. Shift-click the "selection to path" icon and it brings up the advanced options window.

What I do is I just switch "align treshold" and "error treshold" to minimum, this way the selection-to-path conversion seems to be much more accurate.

Then just scale the resulting path to whatever size you want with the scale tool, and you're all set.

Also, this way you can also adjust the corner tresholds, to choose which corners will be rounded and which won't.

Author:  Rod [ Thu Oct 20, 2011 8:45 am ]
Post subject:  Re: Scaling paths?

Nice info DD thanks!

Author:  Oregonian [ Thu Oct 20, 2011 9:04 am ]
Post subject:  Re: Scaling paths?

:ditto
Cool info dd, thanks!

Author:  saulgoode [ Thu Oct 20, 2011 12:07 pm ]
Post subject:  Re: Scaling paths?

GnuTux wrote:
Stroking the path does what stroking the selection with a paint brush is supposed to do, but doesn't.

When GIMP paints colors onto a layer, it does so with sub-pixel accuracy (unless the Pencil is used). What this means is that if you specify coordinates with fractional components, GIMP shades the neighboring (integral) pixels by proportional amounts of the specified color as shown in the following diagrams:

Attachment:
sub-pixel-paint.png
sub-pixel-paint.png [ 8.91 KiB | Viewed 2141 times ]


Unless you are zoomed into the image to see those discrete pixels, your eyes will interpolate the amount of color in each of the neighboring pixels and the end result is that you perceive the full color as appearing proportionally at a single point "between" the pixels. I'm sure you are aware of all this, but it is necessary background for explaining the difference between stroking a selection and stroking a path.

When GIMP strokes a selection, what it actually is stroking is the "marching ants" outline of the selection (what some other image editors call a "marquee"). These marching ants run along the pixels where the selection transitions from below 50% to above 50% and, being the actual coordinates of the pixel, they are always integer values with no fractional components (zoom in to an elliptical selection and note the "stair-stepping" of the marching ants). While a brush stroke from one point on the marching ants to the next may include interpolated points containing fractional components, the end points of that stroke will always fall exactly on a pixel with integer coordinates (because they are on the marching ants).

When stroking a path, there is no restriction of the points on the path being integer values (zoom in while an elliptical path is shown and you will see that it does not follow the shape of the pixels like the marching ants do). This is why stroking a path renders the shape more accurately than stroking a selection, because the painting of the strokes is done with sub-pixel accuracy of all points along the stroke.

Author:  Rod [ Thu Oct 20, 2011 5:46 pm ]
Post subject:  Re: Scaling paths?

I think i get it.The selection will round out to the next value then?
If you want 2 pixels selected it selects 2 pixels EXACTLY.
If you want 2.3 pixels selected it selects 2 pixels EXACTLY.
If you want 2.5 pixels selected it selects 3 pixels EXACTLY.

Why can't it select transparent pixels?After all they are there.Half or less alpha and the rest solid.
If it could do that you would pretty much have the same effect as the new foreground select tool right?

Author:  PhotoMaster [ Thu Oct 20, 2011 6:13 pm ]
Post subject:  Re: Scaling paths?

Some important information for me to play with and figure out! Thank you all!

Author:  ofnuts [ Thu Oct 20, 2011 6:32 pm ]
Post subject:  Re: Scaling paths?

Rod wrote:
I think i get it.The selection will round out to the next value then?
If you want 2 pixels selected it selects 2 pixels EXACTLY.
If you want 2.3 pixels selected it selects 2 pixels EXACTLY.
If you want 2.5 pixels selected it selects 3 pixels EXACTLY.

Why can't it select transparent pixels?After all they are there.Half or less alpha and the rest solid.
If it could do that you would pretty much have the same effect as the new foreground select tool right?
Selection isn't interested by transparency but by selection :). But if you have partially selected pixels, since it has to translate an area (of things more or less selected) into a line, it takes the most obvious one, the outline of areas where selection > 127 which also happens to be the marching ants line, so there is no surprise for the user.

Moreover, if we can compute the value of a pixel given its distance to a line, the reverse may not be true, a "dark" pixel can be dark because its close to a single line, or because it's a bit farther from two different lines.

Author:  Rod [ Thu Oct 20, 2011 6:36 pm ]
Post subject:  Re: Scaling paths?

Thanks Ofnuts. :)

Author:  GnuTux [ Thu Oct 20, 2011 11:41 pm ]
Post subject:  Re: Scaling paths?

Thanks to everyone for all the detailed technical info on selection -vs- path.

Are there any procedures available to fill to path, something equivalent to fill to selection?

Author:  saulgoode [ Fri Oct 21, 2011 12:21 am ]
Post subject:  Re: Scaling paths?

GnuTux wrote:
Are there any procedures available to fill to path, something equivalent to fill to selection?

To my knowledge, there are none that are currently available to the user or exposed by the Procedural DataBase. Path filling is obviously performed when fonts are rendered, but this I believe is handled by the Pango and Cairo libraries.

GEGL provides a path filling operation, but it has not yet been made available to the user or the PDB. There also has been some work done on implementing "vector layers" in GIMP but I am not sure what the status of that project is. One of the concepts of vector layers is that every path has an associated fill color (or pattern), which may or may not be rendered.

As far as I know, filling a path is currently best handled by a manual process involving filling the selection and stroking the path. This also demands some degree of user analysis of the situation because these two operations may overlap when you don't want them to, or not overlap when you do.

Author:  GnuTux [ Fri Oct 21, 2011 1:12 am ]
Post subject:  Re: Scaling paths?

Hopefully, we will see a "fill to path" procedure in the not to distant future. It seems another deficiency using "fill to selection/stroke to path" would be when the aim was to fill with a pattern or gradient, although using that approach might make for some interesting effects. :hehe

Author:  Rod [ Fri Oct 21, 2011 2:52 am ]
Post subject:  Re: Scaling paths?

GnuTux wrote:
Hopefully, we will see a "fill to path" procedure in the not to distant future. It seems another deficiency using "fill to selection/stroke to path" would be when the aim was to fill with a pattern or gradient, although using that approach might make for some interesting effects. :hehe


A fill to path option would be true vector objects then wouldn't it?
You would be in path/vector mode, so it would have to create the math for the fill right?

Could this be possible with a SVG gradient?Even if the gradient was 0% = 000000 100% = 000000.
(2 points on the gradient line)... this would fill all points in between with black or a solid color.You could also do it with real gradient fill (SVG), as Gimp already can handle SVG gradients.

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/