Jump to content
You must now use your email address to sign in [click for more info] ×

Recommended Posts

I have been playing with converting black & white images into dots. It is a seemingly complex process but I have managed to automate the hardest step.

I start by creating a simple B&W image in Affinity Designer. For example,

AfDB.thumb.png.c2517d757716fd5f64d7ef6efb21f651.png

I then export it to PNG at a small resolution, such as 40x40 pixels. I actually need an ASCII .pbm image, but Designer does not export to those, so I get a PNG instead. Like this,

capB.png.210fd336a44f98ec0fb891bf17605ff9.png(the forum seems scaling it up unfortunately, in reality this is much smaller).

The .pbm image format allows only one of two values for every pixel, 0 if it is a background pixel (so white in our example) and 1 if it is an image pixel (so black in this example). And since it is an easy-to-parse text format, I wrote a simple C program that  creates an SVG file with a circle (dot) for every 1, like this, 

B.png.bd4f2493d394fcef77aef5ab9953dce7.png

or for every 0 instead, like this,

Binv.png.c2c0c2e6d2d609d302d3336687e28dd8.png

And because the result is plain SVG, I can edit several of them together, distort them, change the colors, etc. Like this,

rgb.png.1f7066c16320d9cf433e27fe4058b0f3.png

I will probably post the C source code of my program converting .pbm to SVG. It, of course, would be nice if Affinity Designer could do it on its own, but it is still fun doing it this way.

Link to comment
Share on other sites

32 minutes ago, AdamStanislav said:

The .pbm image format allows only one of two values for every pixel, 0 if it is a background pixel (so white in our example) and 1 if it is an image pixel (so black in this example). And since it is an easy-to-parse text format, I wrote a simple C program that  creates an SVG file with a circle (dot) for every 1, like this, 

B.png.bd4f2493d394fcef77aef5ab9953dce7.png

The top and bottom of the B are flat, so why don’t they translate to unbroken rows of dots? :/

Alfred spacer.png
Affinity Designer/Photo/Publisher 2 for Windows • Windows 10 Home/Pro
Affinity Designer/Photo/Publisher 2 for iPad • iPadOS 17.4.1 (iPad 7th gen)

Link to comment
Share on other sites

I miss Scatter in Affinity. With it, we could create stunning Halftone-style work, using not only circles, but other shapes, hex, etc.

The AP allows you to work interactively with Halftone, which is awesome. But it is a bitmap effect that is not suitable for laser cutting, etc.

 

Link to comment
Share on other sites

53 minutes ago, Alfred said:

why don’t they translate to unbroken rows of dots?

I can only assume that is Affinity’s way to emulate a line of a subpixel width. Typically, there would be a straight line of some shade of gray, but when exporting to just black and white pixels, using a “dotted line” will produce the illusion of a gray line. That is, when the image remains small.

But when it is made larger, suddenly we can see the trick for what it is.

This really is how images and fonts used to be printed by dot-matrix printers some forty years ago. After all they could either print a black dot or nothing. And the dots were very small, so we either did not notice or were just happy we had a way of printing images (that was why Adobe eventually developed hinting for their Type 1 fonts). Kind of like we tolerated the sound of early record players and AM radio because they were all we could get.

Link to comment
Share on other sites

15 minutes ago, AdamStanislav said:

I can only assume that is Affinity’s way to emulate a line of a subpixel width.

On second thought, it is probably how Irfan View converts the PNG to PBM. I examined the PNG and it has more shades than black and white. But PBM is strictly a two-value format. I wonder if there is a way to tell AD to only use black and white when exporting to PNG, as it would probably do a better job converting from the vector than Irfan View converting from PNG.

Link to comment
Share on other sites

2 hours ago, Alfred said:

The top and bottom of the B are flat

OK, I have found a solution, though it involves extra steps. First, I had to give the image a white background in Affinity Designer. Then I had to export it as SVG. Then I had to import the SVG to Inkscape (something I hate to do). Then I could export it to PNG at 40x40 pixels as a 2-color image. Then the rest as before (PNG to PBM, PBM to SVG).

This is the result,

B.png.d6ed4054657816cd8e704451013a6876.png

and this,

Binv.png.47a65015211ae36bcf9bde7841195c23.png

Link to comment
Share on other sites

3 hours ago, AdamStanislav said:

I have been playing with converting black & white images into dots. It is a seemingly complex process but I have managed to automate the hardest step.

Well I think there are better and easier ways to get such things done at all, thus I would instead suggest to take a look at tools like https://plotdevice.io/ etc. instead of unnecessarily fiddling around with AD here. Tools like PlotDevice and NodeBox etc. do also allow to export the generated graphics into certain vector or bitmap formats.

plotdevice.jpg.d426cc527d6d45b92ef64267986d9019.jpg

☛ Affinity Designer 1.10.8 ◆ Affinity Photo 1.10.8 ◆ Affinity Publisher 1.10.8 ◆ OSX El Capitan
☛ Affinity V2.3 apps ◆ MacOS Sonoma 14.2 ◆ iPad OS 17.2

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...
×
×
  • Create New...

Important Information

Terms of Use | 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.