OK. Yes I worked this out and I saw that web page referenced above.
However I still had issues of one sort or another and solving one brought up another.
A problem occurs as to when to do the convolving. If I take the script above with the cloning, it requires that the whole image be copied and convoled first and then what it does is to clone the convoled section into the source image and output a new image.
Convolving a 300dpi A4 scan with a bunch of text (3600,2400 pixels) takes a long time.
So then looking at the above it should be possible just to add the convolve command into the sequence like this:
Which works.
Then, I realise that the whole point of that script was to clone the already convoled part I may as well just do this:
I did a script to loop through that and do it for each section, and I think I tested theorectically putting that in something similar to the clone script above, thereby reducing IO time however...
That convolve command does not do all I need. Taht simply expands the pixels by 1 or so.
Code: Select all
@echo off
ECHO %TIME%
convert %1 ^
-convolve "0,1,0,1,1,1,0,1,0" -threshold 1 ^
-convolve "0,1,0,1,1,1,0,1,0" -threshold 1 ^
-convolve "1,0,1,0,1,0,1,0,1" -threshold 254 ^
-convolve "1,1,1,1,1,1,1,1,1" -threshold 1 ^
c:\out.tif
ECHO %TIME%
convert %1 ^
-convolve "0,1,0,1,1,1,0,1,0" -threshold 1 ^
-convolve "0,1,0,1,1,1,0,1,0" -threshold 1 ^
-median 2 ^
-convolve "1,1,1,1,1,1,1,1,1" -threshold 254 ^
c:\out2.tif
ECHO %TIME%
convert %1 ^
-convolve "1,1,1,1,1,1,1,1,1" -threshold 254 ^
-convolve "1,1,1,1,1,1,1,1,1" -threshold 254 ^
-convolve "1,1,1,1,1,1,1,1,1" -threshold 254 ^
-convolve "1,1,1,1,1,1,1,1,1" -threshold 254 ^
-convolve "1,1,1,1,1,1,1,1,1" -threshold 254 ^
-convolve "1,1,1,1,1,1,1,1,1" -threshold 254 ^
-convolve "1,1,1,1,1,1,1,1,1" -threshold 254 ^
-convolve "1,1,1,1,1,1,1,1,1" -threshold 254 ^
-convolve "1,1,1,1,1,1,1,1,1" -threshold 1 ^
-convolve "1,1,1,1,1,1,1,1,1" -threshold 1 ^
-convolve "1,1,1,1,1,1,1,1,1" -threshold 1 ^
-convolve "1,1,1,1,1,1,1,1,1" -threshold 1 ^
-convolve "1,1,1,1,1,1,1,1,1" -threshold 1 ^
-convolve "1,1,1,1,1,1,1,1,1" -threshold 1 ^
-convolve "1,1,1,1,1,1,1,1,1" -threshold 1 ^
-convolve "1,1,1,1,1,1,1,1,1" -threshold 1 ^
-convolve "1,1,1,1,1,1,1,1,1" -threshold 1 ^
-convolve "1,1,1,1,1,1,1,1,1" -threshold 1 ^
-convolve "1,1,1,1,1,1,1,1,1" -threshold 1 ^
-convolve "1,1,1,1,1,1,1,1,1" -threshold 1 ^
-convolve "1,1,1,1,1,1,1,1,1" -threshold 1 ^
-convolve "1,1,1,1,1,1,1,1,1" -threshold 1 ^
c:\out1.tif
ECHO %TIME%
I also used a larger kernel, right up to around 7-800 1's, (i can't remember) but Although it meant it did it in one pass (to expand) it used more time and more characters.
(Also, -1 seems to do something, but I couldn't work it out. ?? )
But windows command line has a max character limit of 8191 characters, and when I plug these into the above scripts, I go over the limit. Otherwise I need to make more passes on the file which increases IO time.
This form has 5 questions on this side, the second side hs about 9 or so, so ideally the script would need to handle an arbitary number of 'convolve' iterations.
I thought -bench might have done it (even if it spits out a time) but It appears to not to produce any output.
Does IM have some sort of macro - I could define the operation as a macro and just call it throught the command line at various places..?