Jump to content
Our response time is longer than usual currently. We're working to answer users as quickly as possible and thank you for your continued patience.

Unexpected Feature: Vectorize a Bitmap Image Directly in Publisher


Recommended Posts

Believe it or not, a rudimentary vectorizer has been included with Affinity from the very launch of Publisher 1!
Before you get too excited though: it only works on images with transparency, for example 1-bit images with alpha channel.
But hey, better than nothing, right?

  1. Place your image into a Publisher document, the more pixels the original image has, the better
  2. Select the image and click the Edit Wrap Outline button in the main toolbar
  3. Copy
  4. Paste = Curves object: there's your image (roughly) vectorized, traced based on the transparency outline
  5. Apply fill and stroke as you see fit
  6. Optionally convert all the sharp nodes to smooth or smart nodes to make it appear less jagged, clean up as you see fit

Tested in APu v1.10.6 Mac and APu v2.0.3 iPad.

apu_trace_image_wrap_outline.png.6a54afe7e29811b32acdb86f7e148f4a.png

Link to comment
Share on other sites

Works perfectly for vectorizing bitmap QR codes:

apu_trace_image_wrap_outline_qr_code.png.b2292a93c79e661756ac48157a78b17d.png

If the image doesn't have transparency yet, all you need to do is:

  1. Place the QR code image in Publisher and select it with the Move tool
  2. Context toolbar > Edit Image
  3. Switch the opened image to the Photo persona
  4. Flood Select tool > Contiguous: off > click the white background
  5. Delete (optionally enable Transparent Background to check if all white pixels are gone)
  6. Save (if PNG) or export as PNG (if JPEG, then replace the JPEG in the other afpub)
  7. proceed with Wrap Outline as above
Link to comment
Share on other sites

Really nice catch. 👌👍👍👍

Mac mini M1 A2348

LG34WK950U-W, calibrated to DCI-P3 with LG Calibration Studio / Spider 5

iPad Air Gen 5 (2022) A2589

Special interest into procedural texture filter, edit alpha channel, RGB/16 and RGB/32 color formats, stacking, finding root causes for misbehaving files, finding creative solutions for unsolvable tasks, finding bugs in Apps.

 

Link to comment
Share on other sites

Remember, you can convert any color to transparent with help of blend ranges.

More complex color transformations are possible with Chanel mixer or Procedural Texture filter.

Use posterize or gradient map for multi-pass tracing specific color ranges.

The new hue/luminosity live filter mask come handy.

Mac mini M1 A2348

LG34WK950U-W, calibrated to DCI-P3 with LG Calibration Studio / Spider 5

iPad Air Gen 5 (2022) A2589

Special interest into procedural texture filter, edit alpha channel, RGB/16 and RGB/32 color formats, stacking, finding root causes for misbehaving files, finding creative solutions for unsolvable tasks, finding bugs in Apps.

 

Link to comment
Share on other sites

Does it generate 2-4 nodes per pixel - at every pixel edge in principle? (No opportunity to try it on my own today)

Mac mini M1 A2348

LG34WK950U-W, calibrated to DCI-P3 with LG Calibration Studio / Spider 5

iPad Air Gen 5 (2022) A2589

Special interest into procedural texture filter, edit alpha channel, RGB/16 and RGB/32 color formats, stacking, finding root causes for misbehaving files, finding creative solutions for unsolvable tasks, finding bugs in Apps.

 

Link to comment
Share on other sites

8 hours ago, NotMyFault said:

Remember, you can convert any color to transparent with help of […]

Yep, it opens quite a few possibilities, for instance by using some clever APh macros.

8 hours ago, NotMyFault said:

Does it generate 2-4 nodes per pixel - at every pixel edge in principle?

Something like that, as it seems.
^ Actually strike that, it's vice versa: more like a node per 8 pixels or so. Hence the jagged edges. Because generally that's "good enough" for text wrap, isn't it.

But before posting, I did a few tests to figure out what can make a difference. In the end it boils down to the sheer amount of pixels. More is more.
But… the more pixels, the more nodes. The more nodes, the more… troubles. There were a bunch of crashes and spin dumps along the way.

Edited by loukash
see strikethrough
Link to comment
Share on other sites

2 hours ago, loukash said:

Believe it or not, a rudimentary vectorizer has been included with Affinity from the very launch of Publisher 1!
Before you get too excited though: it only works on images with transparency, for example 1-bit images with alpha channel.

apu_trace_image_wrap_outline.png.6a54afe7e29811b32acdb86f7e148f4a.png

giphy.gif

Microsoft Windows 10 Home (Build 19045)
AMD Ryzen 7 5800X @ 3.8Ghz (-30 all core +200mhz PBO); Mobo: Asus X470 Prime Pro
32GB DDR4 (3600Mhz)
EVGA NVIDIA GeForce GTX 3080 X3C Ultra 12GB
Monitor 1 4K @ 125%; Monitor 2 @ 150%

WACOM Intuos4 Large; X-rite i1Display Pro; NIKON D5600 DSLR

Link to comment
Share on other sites

43 minutes ago, NotMyFault said:

color to transparent with help of blend ranges

That doesn't work non-destructively in place. The image/pixel layer must be flattened with "real" transparency.
Also, the "absolute pixel grid" bug is an issue. Hence my workflow via Edit Image in a separate document, i.e. without any potential misalignment in the existing layout.

Link to comment
Share on other sites

It has a million points to it, but it works-ish.

image.thumb.png.ccf957d11a0d9632bb903efc9db41314.png
 

image.thumb.png.cc06b1084cf4938fa3385484944d986c.png

Paste into Designer (as curves). mmm 8-bit.

image.thumb.png.1002a4260add941b017be389dc76e817.png

Microsoft Windows 10 Home (Build 19045)
AMD Ryzen 7 5800X @ 3.8Ghz (-30 all core +200mhz PBO); Mobo: Asus X470 Prime Pro
32GB DDR4 (3600Mhz)
EVGA NVIDIA GeForce GTX 3080 X3C Ultra 12GB
Monitor 1 4K @ 125%; Monitor 2 @ 150%

WACOM Intuos4 Large; X-rite i1Display Pro; NIKON D5600 DSLR

Link to comment
Share on other sites

11 minutes ago, debraspicher said:

It has a million points to it

Straight lines are relatively easy to clean up, simply select all nodes inbetween two corners with the node-lasso and delete them.
To clean up round curves, it would need a quick method to select e.g. every 2nd node, delete the "steps", then convert the rest to smooth.

Link to comment
Share on other sites

To smooth the jagged edges, go to Designer persona and apply multiple steps of the following until you're satisfied with the result:

  1. select all nodes > apply Corner Tool > Rounded > ~20 px (or about 2 mm @ 300 dpi) > Bake Appearance
  2. select all nodes > click the Smooth Curve button a few times
  3. select all nodes > click Convert: Sharp button
  4. repeat steps 1 > 2 > 3 > etc. > 1 > 2
  5. optionally apply Contour Tool or similar to your liking

Works surprisingly well within a minute or so.

Black is the initial jagged "million-nodes" vectorization of the hidden pixel layer, red overlay is a smoothed copy using several passes of the above workflow:

apu_trace_image_wrap_outline_smooth.png.739c32f8e7e1568294546467cf1390d6.png

Not all that shabby, huh? :) 

Link to comment
Share on other sites

Tracing some "vector" brushes:

apu_trace_vector_brush_wrap_outline.png.cd990fb8caca6a09b374883ee8f16c20.png

The trick: rasterize them first but avoid too many semi-transparent pixels. Fake "1-bit" images without antialiasing work best for tracing.

And again: the bigger the better.
Make sure your canvas is thousands of pixels wide for tracing. Heck, try ten thousands! (Save early, save often! :D)

Link to comment
Share on other sites

7 hours ago, loukash said:

To smooth the jagged edges, go to Designer persona and apply multiple steps of the following until you're satisfied with the result:

  1. select all nodes > apply Corner Tool > Rounded > ~20 px (or about 2 mm @ 300 dpi) > Bake Appearance
  2. select all nodes > click the Smooth Curve button a few times
  3. select all nodes > click Convert: Sharp button
  4. repeat steps 1 > 2 > 3 > etc. > 1 > 2
  5. optionally apply Contour Tool or similar to your liking

Works surprisingly well within a minute or so.

Black is the initial jagged "million-nodes" vectorization of the hidden pixel layer, red overlay is a smoothed copy using several passes of the above workflow:

apu_trace_image_wrap_outline_smooth.png.739c32f8e7e1568294546467cf1390d6.png

Not all that shabby, huh? :) 

NO…Not at all…. I think I could totally live with that in 90% of my applications of the technique….

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...

Important Information

Please note there is currently a delay in replying to some post. See pinned thread in the Questions forum. These are the Terms of Use you will be asked to agree to if you join the forum. | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.