6

I use Photoshop for carpet designing. My typical artwork is 1800 × 2400 pixels with 8 or 10 colors. Each pixel's position and color is important.

The weaving macine which outputs the carpet can't make 1 pix high horizontal single color lines in good quality if the line has length 10 pix or more. A single color pattern can well be 10 pix (or more) wide if it is higher than 1 pix.

See my image sample. I have marked some problematic lines:

Photoshop selection

Until this I have walked through the image manually and replaced the problematic lines one by one. That's very time consuming job and easily some errors stay unnoticed.

I need a fast method - maybe a script or Photoshop plugin or separate program - that finds all those 1x10 (or more) single color lines and replaces them with another pattern of the same color. Even automatic finding would be a delight. If I could define also other patterns to be found and replaced, the software add-on would be luxorius.

Can anyone help me?

16
  • 3
    There's still a huge amount of not selected areas that are 10 pixel wide, 1 pixel high and have the same color in all 10 pixels. You should tell, what makes your single color 10x1 areas special (=worth to be selected). No software can make the selections for you if you don't tell that basic difference. NOTE: Photoshop knows nothing about plants, beauty or what is important to you in your thoughts. Also Photosop does not see any relations that cant be said as numbers. So: What makes your 10x1 single color areas more important than those (thousands) that you have not selected?
    – user82991
    Apr 7, 2017 at 8:31
  • Wouldn't this script also pick up the entire background? Apr 7, 2017 at 19:23
  • @TimTroiano this isnt script i selected thos areas manually. Apr 8, 2017 at 5:34
  • @user287001 i thank u for complete my mean. yeah its correct i want a intelligent selection that select every single color in 1x10 pixels overall my work. Apr 8, 2017 at 5:35
  • Still no clearance. Let me quess: The interesting 1x10 or longer areas are surrounded by other colors at least on most of their length. Additionally they are at the end of a stairs pattern of the same color. You want to make the appearance of the curves more pleasant and for that you want to fast way to walk through all problematic parts. OK? What about vertical too gentle curve ends? Find them, too?
    – user82991
    Apr 8, 2017 at 6:58

1 Answer 1

1

I do not have a complete solution, but I do have some ideas. Getting each of the colours into their own channels should make things easier to interrogate.

You can do this by selecting a pixel or two of a colour (and only that colour), then choose SelectSimilar.

Photoshop select similar

With all the pixels of a single colour selected, you can now save the selection, which will create a new channel.

Here’s where things get a bit more difficult and hand-wavy. Through some processing, we should hopefully be able to keep the lines that are 10px wide or longer, but remove all others.

Here’s a test pure black and white selection with some varying line lengths. The top two lines are 12px and 10px wide respectively, and the ones underneath are shorter. We’re trying to keep the 10 and 12px lines, but remove the others.

enter image description here

Duplicating the selection a few times, offsetting it, and using varying opacity for the layers gets us part of the way there. I used 5px offsets and 50% and 33% opacity, plus levels to take the grey pixels back to white (keeping the ones we want).

enter image description here

Another pass using the same method, but this time with a 3px offset.

enter image description here

And a final pass, doing exactly what we did in the first pass. I think this should give the required result, and also be able to be automated by recording an action.

enter image description here

With a good selection, filling those parts of the image with a pattern should be pretty easy. A pattern layer using the newly created mask would work for that.

Here’s a GIF of the steps used. I think it should work with any initial artwork.

GIF process

Now I think about it, I think this entire structure could be set up using smart objects and smart filters, so you’d just have to replace the contents of the smart object to process it (assuming the source artwork is the same dimensions).

9
  • Whet happens to those placeswhere you have 2 rows exactly on top of each other? Anyway this is just a single for loop if you care to write a plugin.
    – joojaa
    Apr 12, 2017 at 15:12
  • @joojaa The offsets are X axis only, so lines above and below aren’t an issue. I think the technique would require 5px padding to be added to the left and right side of the image for it to work in 100% of cases. Apr 12, 2017 at 15:15
  • Yes but your supposed to discard results where there same color on 2 lines because that binds the layers together
    – joojaa
    Apr 12, 2017 at 15:20
  • Aslso consider using filter > other > custom instead of layers
    – joojaa
    Apr 12, 2017 at 15:22
  • @joojaa You’re right about the lines above and below. This is just a partial solution. Maybe those could be tackled in other steps. It really depends on the exact rules (which still seem a little vague to me). Code would be easier, if the OP writes code, but I’m guessing they don’t. At the very least, this could be used to streamline inspection. Apr 12, 2017 at 15:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.