Colouring an image

Moderator: jsachs

Marpel
Posts: 692
Joined: September 13th, 2009, 3:19 pm
What is the make/model of your primary camera?: Nikon D810
Location: Port Coquitlam, British Columbia

Colouring an image

Post by Marpel »

I am making an image in which there are a great many (I mean hundreds) small rectangles of varying sizes (maybe from a few pixels wide up to about 100 pixels wide). Currently, these rectangles are white, separated by black lines (about 6 pixels wide).

I am in the process of filling in these white shapes with different solid colours with no two adjacent colours. Initially, I tried the pen tool, however, I found it too difficult to be accurate and not encroach on neighbouring spaces or the black lines. I then tried generating a mask for each colour and each space by using the mask flood fill tool. It is accurate, however, it is too time consuming because I have to generate a mask, generate a single coloured image then combine the coloured image with the master, then cancel the mask, and trash the coloured image only to do it all over again, and again.....

It appears the pen tool does not have a flood fill capacity like the mask tool (at least I can't find one), which would make it a snap to do by just clicking on each white space with a different colour.

Can anyone suggest an easy way to accomplish what I am trying to do? If I carry on like I am, it will take me hours and hours (the image is 6000 X 4000 pixels in size) if not days and days.

Thanks in advance,

Marv
jsachs
Posts: 4203
Joined: January 22nd, 2009, 11:03 pm

Re: Colouring an image

Post by jsachs »

The flood fill mask tool is the easiest way - you can flood fill all the rectangles that are the same color at once.

Then use the Composite transformation and select a solid color overlay of the desired color and it will apply that color to all the areas where the mask is. This way you can build up the final image in stages.

Some other programs such as Photoshop have a flood fill tool that lets you apply a color directly to the image, but there is no such feature in PWP.
Jonathan Sachs
Digital Light & Color
Marpel
Posts: 692
Joined: September 13th, 2009, 3:19 pm
What is the make/model of your primary camera?: Nikon D810
Location: Port Coquitlam, British Columbia

Re: Colouring an image

Post by Marpel »

Jonathan,

Yes, I have been using the exact method you describe and it is working well except, because each single colour is only used for less than ten spaces (of the hundreds and hundreds) I was hoping there was a bit quicker method where I could just click on a spot on the colour wheel then click in a space(s) and the colour would flood the area up to the boundary lines. The current method is a bit slow going, but effective, so I will just have to continue slogging along.

Thanks for your input

Marv
den
Posts: 856
Joined: April 25th, 2009, 6:33 pm
What is the make/model of your primary camera?: Canon EOS-350D/Fuji X100T
Location: Birch Bay near Blaine, WA USA

Re: Colouring an image

Post by den »

Marv...

In truth I don't have a good mind picture... ...but may be one could create a 600x400 pixel "tile" image that then could be expanded/repeated with the Special Effects/Tile transform to 6000x4000 pixels that would do the job...

...den...
Marpel
Posts: 692
Joined: September 13th, 2009, 3:19 pm
What is the make/model of your primary camera?: Nikon D810
Location: Port Coquitlam, British Columbia

Re: Colouring an image

Post by Marpel »

Hey Den,

Thanks for your suggestion, however I am not familiar with the Special Effects/Tile transform to know whether it would be helpful or not. I will have to do some research on that. And I'm not even sure if "tiling" would be applicable as each of the "spaces/rectangles" that I mentioned in my introductory post is a different size than all the rest. Not one is the same size as another. But I will take a look at the transform you mentioned and see if there is anything I can make use of.

Marv
den
Posts: 856
Joined: April 25th, 2009, 6:33 pm
What is the make/model of your primary camera?: Canon EOS-350D/Fuji X100T
Location: Birch Bay near Blaine, WA USA

Re: Colouring an image

Post by den »

There is a "graphics random size color rectangles" 600x400 image [click on the Plate 7.3 thumbnail] here: http://www.cs.arizona.edu/icon/gb/plates/plates.htm

which I have modified to have black borders/spaces:
rects.png
rects.png (6 KiB) Viewed 6468 times
Interestingly, there is a link to code that appears width and height could be set to 6000 and 4000, which may avoid the appearance of repeating patterns when using PWP's Tile transform with the 600x400 image but perhaps the size of the rectangles would be up-scaled as well. I did not investigate.

Note: I reduced image's borders so that when "tiled" they would be approx 4 pixels... ...and when "tiled" 10 horizontal repeats and 10 vertical repeats with no mirrors, the actual size will be 5980x3980.

...den...
Last edited by den on August 31st, 2014, 2:03 am, edited 1 time in total.
ksinkel
Posts: 594
Joined: April 2nd, 2009, 11:58 am
Contact:

Re: Colouring an image

Post by ksinkel »

Marv,

Can you give some context to the problem you are trying to solve or post a small version of your image.

Kiril
Kiril Sinkel
Digital Light & Color
Marpel
Posts: 692
Joined: September 13th, 2009, 3:19 pm
What is the make/model of your primary camera?: Nikon D810
Location: Port Coquitlam, British Columbia

Re: Colouring an image

Post by Marpel »

Den,

Thanks for your continued efforts at trying to help me out. I took a look at the link you provided and went a bit farther in looking at the ICON links and program. However, that stuff was waaaay above me (a bit like asking a 6 month old to describe why a ball falls to the floor when he lets it go).

Having said that, the image of the coloured squares separated by black lines is pretty well what I was trying to initially describe (of interest, at the link you provided, I also found another ICON program which generates variations of a single colour - refer to my comments to Kiril for the relevance of that).

Kiril,

I cannot provide an image example as I am in the middle of generating one and do not have a completed one on hand.

However - I am starting with a pure white 6000 X 40000 pixel new image. On that image, will be a number of shapes (for ease of explanation, I will call them circles) of various sizes. These circles are easy to generate with the mask tool. Within each circle are a multitude of randomly sized black bordered squares and rectangles (as in Den's post). These squares/rectangles will be different sizes for each circle (the smaller the circle, the smaller the squares etc). And of course, the squares/rectangles will not be so at the edges of the circle. Each circle must contain a different pattern of squares/rectangles, so I can't use the same setup for each circle - but I think the squares/rectangles can be relatively easily generated in PWP.

However, the difficult part comes when I have to colour fill each square/rectangle with a different colour BUT each circle will be filled with the same colour made up of a different tone and hue of that same colour in each square (in other words, one circle will be all orange related hues and another all blue etc). No two adjacent squares can be the exact same tone/hue or size. Because each circle may have dozens of squares/rectangles, I have narrowed the hue/tone choices by using the same hue/tone in 8 - 10 squares within the circle. So far, I have generated a specific hue/tone image, and flood filled a mask in about 8 squares then composited the two images using the mask to isolate the hue/tone to specific randomly selected squares. This has proven quite time consuming (and I may be doing the same operation for multiple images).

Hope my explanation suffices,

Marv
den
Posts: 856
Joined: April 25th, 2009, 6:33 pm
What is the make/model of your primary camera?: Canon EOS-350D/Fuji X100T
Location: Birch Bay near Blaine, WA USA

Re: Colouring an image

Post by den »

Marv...

Sounds as if you have yourself a project and it may be best to proceed with the process you understand... ...hopefully you can show us what you have created when completed...

...Perhaps, the following would be helpful to speed up the coloring process while at the same time limiting HSV-Hue to a narrow range, orange for example, of the previously illustrated 400x600 rectangle image:
(1) create a mask to limit color changes only to rectangle image areas protecting the border/background image areas so that they remain black...
(2) use a HSV-H Color Curves transform as illustrated... ...possibilities are almost un-limited when changes to the HSV-V and HSV-S curves are made as well... ...in the illustration, these channels remained unchanged:
Limiting_HSV-Hue_to_a_range.jpg
Limiting_HSV-Hue_to_a_range.jpg (76.57 KiB) Viewed 6338 times
For a 'blue' HSV-Hue range, relocate vertically the nearly horizontal straight-line curve between 60 and 70 of the vertical axis...

...den...
Charles2
Posts: 225
Joined: November 24th, 2009, 2:00 am
What is the make/model of your primary camera?: Fuji X-Pro 2
Contact:

Re: Colouring an image

Post by Charles2 »

ksinkel wrote: Can you give some context to the problem you are trying to solve or post a small version of your image.
Yes, it is not clear how this job relates to serious photographers (alluding to DLC's motto).

If you know any programming at all, it would seem easier to define a 6000 x 4000 matrix, code the black cells more or less by hand (perhaps via Excel), code one cell within each rectangle for RGB, then write a program that propagates the colored cells to neighboring white cells without going across two adjacent black cells.
Post Reply