I am working on an image node. Who's in?

john's Avatar

john

12 Jan, 2021 05:09 PM

Fellow NodeBoxers,

For several months now I've been working on a general purpose image node and am getting close.

I plan on sharing it, but would like to know who would want to use it. If you would like to incorporate images (PNG, JPG, BMP, TIFF) into your NodeBox projects, please hit the reply button, say "ME!", and maybe also say what you might want to use it for. The more responses I get, the more motivated I will be to get this thing out the door ASAP.

Some Background

A way of incorporating images is probably the single most requested NodeBox feature. NodeBox is and will remain a pure vector application - not much I can do about that. But by using some Python code and a NodeBox subnetwork, I can read in a file and output a "pixel group" - a group of square rectangles each with a position, a pixel size, and a fill color. The output will appear in your drawing area as an actual image and you can feed it into all the usual nodes like any other group of paths.

The challenge is that even a small or low-res image has a LOT of pixels. My experience has been that Nodebox can only handle pixel groups of about 100,000 rects. Much higher and it becomes painfully sluggish and starts getting memory errors. To protect you from crashing Nodebox I limit output to 100,000 pixels.

100,000 pixels is a lot or rectangles, but only .1 megapixels, enough to display a 400 x 250 pixel photo - about the size of a post-it note on a typical laptop screen. Fortunately, it is possible to get surprisingly good results by either down-sampling (capturing, say, every third pixel), or by using a mask to capture a portion of the image. This is what my node does.

For the mask you can feed in any closed shape (a rect, a circle, a star, a text path) OR a series of points resampled along one or more paths (concentric circles, lines, a spiral). Once you've captured a pixel group you can adjust it in many ways, including turning the squares into dots of different sizes based on the luma value, applying color filters, etc.

These are things I am starting to play with. You could also use images as a reference for placing vector elements, use the pixels as a source of perlin-like noise, take pixel slices through individual frames of a movie and arrange them into color strips - the possibilities are endless!

So if this sounds interesting, please hit the Reply button and type "I'm in!" Questions and suggestions always welcome.

John

  1. 1 Posted by Alexander Gogl on 13 Jan, 2021 07:44 AM

    Alexander Gogl's Avatar

    Dear John,

    I am interested in testing your image node. Please keep me updated.

    Best,

    Alexander

    john <[email blocked]> --- 2021-01-12 Tue 18:11:

  2. 2 Posted by Guilherme Vieir... on 13 Jan, 2021 01:54 PM

    Guilherme Vieira's Avatar

    Hi John,

    It would be a very interesting node, I imagine many possibilities with images as a data source.

    It might help in this endeavor to try to look at how the images were implemented in DrawBot (https://www.drawbot.com/content/images.html). The NodeBox shares similar output limitations, at least in older versions of DrawBot.

  3. Support Staff 3 Posted by john on 13 Jan, 2021 04:45 PM

    john's Avatar

    Alexander, Guilherme,

    Thanks for responding! I will email you both the current version of my image node soon and would appreciate it if you could test it out on various images before I release it to the wider community.

    DRAWBOT

    Thanks also for the link to DrawBot, Guilherme. I took a quick look at it. I have something very similar to their image, imageSize, and imagePixelColor.

    But my node and python code is much more limited and humble. I do as little as possible in Python; I just get colors and use a subnetwork to present them as a group of rects that you can then play with in NodeBox. My Python code is very short but, I think, has no dependencies. It should work without you having to install any image libraries or do anything like that.

    DrawBot's list of filters is most impressive. I intend to provide a separate node to do some very limited manipulations of the "pixel" rects just to get people started (e.g. convert square pixels to multi-size dots). But in theory you could construct all sorts of fancy filter nodes right in NodeBox (with images of no more than .1 megapixels). For example, you should be able to convert a small pixel group into ASCII art.

    This would not be for serious image manipulation (which you can already do in zillions of other apps and then import into NodeBox using my node). It would just be for fun and experimentation - and generative art. Perhaps we could construct and share some filter nodes here on the forum.

    If you are really into both DrawBot and NodeBox, it should be possible to combine them by creating custom NodeBox nodes from DrawBot Python source code on their Github site. You would have to install DrawBot and import their library inside your custom NodeBox Python code. (As I said, I didn't want to require any such dependencies.). If that idea interests you, you could study my very simple Python code to see how to pass things like colors and rects back to NodeBox.

    I am going to fix a few more bugs and try a few more things. But I'll send you both something to play with soon.

    John

  4. Support Staff 4 Posted by john on 17 Jan, 2021 04:53 AM

    john's Avatar

    Alexander, Guilherme,

    I just emailed you the beta Image node with some samples and documentation. Please reply ASAP with your first impressions. I hope to release the node to everyone else soon.

    John

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

Recent Discussions

17 Jan, 2021 04:53 AM
16 Jan, 2021 04:26 PM
15 Jan, 2021 03:28 PM
15 Jan, 2021 03:22 PM
15 Jan, 2021 09:46 AM

 

13 Jan, 2021 03:56 AM
05 Jan, 2021 07:23 AM
05 Jan, 2021 06:37 AM
04 Jan, 2021 10:42 PM
03 Jan, 2021 04:22 PM
30 Dec, 2020 02:52 AM