RSS/Atom feed Twitter
Site is read-only, email is disabled

How to round all square corners?

This discussion is connected to the gimp-user-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

6 of 6 messages available
Toggle history

Please log in to manage your subscriptions.

How to round all square corners? helices 05 Aug 01:21
  How to round all square corners? Ofnuts 05 Aug 12:24
  How to round all square corners? Kevin Cozens 05 Aug 16:08
  How to round all square corners? tobias.lunte 05 Aug 16:35
  How to round all square corners? erroneus 07 Aug 17:02
   How to round all square corners? erroneus 07 Aug 17:24
helices
2012-08-05 01:21:00 UTC (over 11 years ago)

How to round all square corners?

Hi!

Suppose we have a standard QR code composed of hundreds of squares and their hundreds of square corners. (e.g., http://en.wikipedia.org/wiki/QR_code)

How can I get Gimp to round all of the internal and external square corners - let's say to a 10 pixel radius?

Thank you.

If ever I can be of service to you, contact me at once.

I hope that you have a truly extraordinary day ...

Ofnuts
2012-08-05 12:24:36 UTC (over 11 years ago)

How to round all square corners?

On 08/05/2012 03:21 AM, helices wrote:

Hi!

Suppose we have a standard QR code composed of hundreds of squares and their hundreds of square corners. (e.g., http://en.wikipedia.org/wiki/QR_code)

How can I get Gimp to round all of the internal and external square corners - let's say to a 10 pixel radius?

Thank you.

If ever I can be of service to you, contact me at once.

I hope that you have a truly extraordinary day ...

- Filters/Blur/Gaussian blur->10px - Colors/Treshold

But:
- won't blur anything where you have two black and two white square in the diagonals
-output is a bit jaggy, you'll have better results scaling up 2x, blur 20px, threshold, blur 2px, scale down 2x

http://i.imgur.com/LBlAx.png

The Wikepedia example is an SVG vector graphic, if you start from such it is possible to write a script that rounds the corners very accurately.

A completely different look: - generate a square with rounded corners which is the size of your QR-code unit squares.
- Bucket-fill a layer using it as a pattern - Use the QR-code as a layer mask

Kevin Cozens
2012-08-05 16:08:17 UTC (over 11 years ago)

How to round all square corners?

On 12-08-04 09:21 PM, helices wrote:

How can I get Gimp to round all of the internal and external square corners - let's say to a 10 pixel radius?

You could select the area where you want rounded corners then right click image and use Select -> Rounded Rectangle menu entry. The only downside to that is it only lets you specify the radius as a percentage of the current size.

tobias.lunte
2012-08-05 16:35:24 UTC (over 11 years ago)

How to round all square corners?

Apparently I've only answered helices himself but not the mailing list, so here is a copy of the mail I've sent him last night.

---

Hello,

I'm no pro yet and I hope you'll get better answers, but here's what I'd do.
As far as I know, Gimp has no option for complex rounded edges. As long as the image is only pure black on a ground, you can work around that with a little selection manipulation. First use the "select by color"-tool, to get a selection of all the black sqares. Then go to select->shrink by, for example 10px. After that select->grow by 20 (of whatever is twice your first value) and then once again select->shrink by 10.
Now take a new layer, fill the selection black and there you've got your rounded corners.

I've added a little example here --> http://tobl.deviantart.com/art/Rounded-corners-in-GIMP-319063668 wrote:

Hi!

Suppose we have a standard QR code composed of hundreds of squares and their hundreds of square corners. (e.g., http://en.wikipedia.org/wiki/QR_code)

How can I get Gimp to round all of the internal and external square corners - let's say to a 10 pixel radius?

Thank you.

If ever I can be of service to you, contact me at once.

I hope that you have a truly extraordinary day ...

2012-08-07 17:02:29 UTC (over 11 years ago)
postings
18

How to round all square corners?

Hi!

Suppose we have a standard QR code composed of hundreds of squares and their hundreds of square corners. (e.g., http://en.wikipedia.org/wiki/QR_code)

How can I get Gimp to round all of the internal and external square corners - let's say to a 10 pixel radius?

Thank you.

Using an example image found on the page indicated above (http://upload.wikimedia.org/wikipedia/commons/a/a6/Qr-4.svg) I imported the image into GiMP 2.6.x. (The latest version available to me as a CentOS user)

I imported it at 5x the original size (1100x1100) so that I could manipulate details as needed with less quality loss.

I did a Select -> By Color, then selected any of the black. All black areas are selected while the transparent areas are not.

I then did a Select -> Shrink... and set the pixel value to 5. Note that the selection is already rounding the corners, but now the selected area is too small.

Next I did a "Select -> Grow... and set the pixel value to 5. Now the selection is back to where it was but the corners are now more rounded though not quite what I think you want in terms of accuracy.

So next, I go to the layers panel and into the paths tab. I then do a "Selection to path" by clicking the button at the bottom of that tab. (Highlight the buttons to see what their function name/description is) Now there should exist a path with rounded corners added to your paths list. Go ahead and make it visible by clicking the little eye to the left of the path item in the list. (Not needed but makes the path visible so you can see what you are working with.)

Now I make the original background layer invisible by clicking the eye to turn it off in the layers tab and then add a new transparent layer. It should be selected.

Now back to the paths tab and with the rounded QR code path selected, I do a "Path to selection" (the opposite of selection to path) to create a new selection based on the path with rounded corners.

Now I go to the Bucket fill tool and set the option "Fill whole selection." I can choose any color I want, but black is already selected so that's the one I will use. I click in the selected area to fill in my new selection.

You should now see a QR code with rounded corners.

Now if the corners aren't rounded enough for you, you can play with the pixel size when shrinking and growing the initial seleciton. The effect will be the same but with more roundness if you choose a larger number or less if you choose a smaller number.

Hope this was helpful.

2012-08-07 17:24:17 UTC (over 11 years ago)
postings
18

How to round all square corners?

Hi!

Suppose we have a standard QR code composed of hundreds of squares and their hundreds of square corners. (e.g., http://en.wikipedia.org/wiki/QR_code)

How can I get Gimp to round all of the internal and external square corners - let's say to a 10 pixel radius?

Thank you.

Oh, just to add to this... I realized that the result was outside corners were rounded but inside corners were not. So instead of "shrink x5, grow x5" do a "shrink x5, grow x10, shrink x5" to get better results. Continue as before with everything else.

You will not that by creating a path from selection and then a selection from path, you will get a smoother corner. Otherwise I get a blocky corner. There may be some other manipulations to the path which could result better as well.