Page 4 of 4

Re: How to slice up image of text

Posted: 2017-03-26T19:44:07-07:00
by damonm
Changing it to double quotes worked. It's going somewhere but then stalls again - any ideas on this?

c:\Images>rem From image pat_crp.png, guillotines into pieces.
guilFind: OFFSET=192
787,0,graya(0,1)
811,0,graya(0,1)
835,0,graya(0,1)
859,0,graya(0,1)
883,0,graya(0,1)
907,0,graya(0,1)
931,0,graya(0,1)
955,0,graya(0,1)
980,0,graya(0,1)
983,0,graya(0,1)
1027,0,graya(0,1)
1051,0,graya(0,1)
2011,0,graya(0,1)
2035,0,graya(0,1)
guilFind: nCUTS=14
979
1003
1027
1051
1075
1099
1123
1147
1172
1175
1219
1243
2203
2227
'identify' is not recognized as an internal or external command,
operable program or batch file.
'cPrefix' is not recognized as an internal or external command,
operable program or batch file.
convert c:\Images\pat_crp.png -rotate -90
( +clone -crop 980x+0+0 +repage -rotate 90 -write subs_0.png +delete )
( +clone -crop 24x+980+0 +repage -rotate 90 -write subs_1.png +delete )
( +clone -crop 24x+1004+0 +repage -rotate 90 -write subs_2.png +delete )
( +clone -crop 24x+1028+0 +repage -rotate 90 -write subs_3.png +delete )
( +clone -crop 24x+1052+0 +repage -rotate 90 -write subs_4.png +delete )
( +clone -crop 24x+1076+0 +repage -rotate 90 -write subs_5.png +delete )
( +clone -crop 24x+1100+0 +repage -rotate 90 -write subs_6.png +delete )
( +clone -crop 24x+1124+0 +repage -rotate 90 -write subs_7.png +delete )
( +clone -crop 25x+1148+0 +repage -rotate 90 -write subs_8.png +delete )
( +clone -crop 3x+1173+0 +repage -rotate 90 -write subs_9.png +delete )
( +clone -crop 44x+1176+0 +repage -rotate 90 -write subs_10.png +delete )
( +clone -crop 24x+1220+0 +repage -rotate 90 -write subs_11.png +delete )
( +clone -crop 960x+1244+0 +repage -rotate 90 -write subs_12.png +delete )
( +clone -crop 24x+2204+0 +repage -rotate 90 -write subs_13.png +delete )
( +clone -crop +2228+0 +repage -rotate 90 -write subs_14.png )
NULL:

Re: How to slice up image of text

Posted: 2017-03-26T20:24:14-07:00
by fmw42
If you are running IM 7, then you need to replace identify with magick identify

Re: How to slice up image of text

Posted: 2017-03-26T20:25:18-07:00
by damonm
I found it - what about cPrefix? That's not a batch file that I have? I'll double check your site.

Re: How to slice up image of text

Posted: 2017-03-26T21:00:31-07:00
by snibgo
Bother, sorry, cPrefix.exe is an unpublished program. Here, it simply adds a "^" to the end of each line in the BAT file that has been created.

In guilChop.bat, replace this line:

Code: Select all

cPrefix /p0 /i%SCR_FILE% /r"^"
... with these three lines:

Code: Select all

set SCR_FILE2=guilc_tmp2.bat
copy %SCR_FILE% %SCR_FILE2%
@( @for /F "tokens=*" %%L in (%SCR_FILE2%) do @echo %%L ^^) >%SCR_FILE%

Re: How to slice up image of text

Posted: 2017-03-27T08:29:16-07:00
by damonm
Getting even closer, it runs and leaves me with three png files. The issue now is that rather than getting strips like this:

Image

it actually spits out the columns rather than the rows as above. I tried rotating it first but that didn't seem to make a difference. Any ideas?

Re: How to slice up image of text

Posted: 2017-03-27T08:43:07-07:00
by damonm
I did some more pre-processing of the image and came up with strips. One more thing that if I can nail down will have this thing in the bag, it's cutting off the amount on the far right side, can you tell me why that might be? It usually cuts it off just after the comma (if it's thousands) or just before the number if it's hundreds. Is there a command I could edit about the right hand side cutoff because I can edit the image beforehand to have no margin on the right side.

Re: How to slice up image of text

Posted: 2017-03-27T09:39:06-07:00
by snibgo
Re horizontal or vertical: What command are you using to call guillotine.bat? Text at the top of the file describes the six parameters you can use.
damonm wrote:... it's cutting off the amount on the far right side, can you tell me why that might be?
I don't follow. Please provide samples.

Re: How to slice up image of text

Posted: 2017-03-27T09:46:07-07:00
by damonm
In the example above that's blurred out, the last column is an amount. In the finished product, the amount is getting chopped off if it's less than $1,000. If it's more than $1,000 it leaves the $1 and the comma. Does that make sense?

Re: How to slice up image of text

Posted: 2017-03-27T09:55:43-07:00
by snibgo
If you are chopping horizontally, it shouldn't make any vertical chops.

Re: How to slice up image of text

Posted: 2017-03-31T12:53:45-07:00
by damonm
Hey again! I've decided not to worry too much about the amount due that is getting chopped off on the right hand side of each cut, but I have a couple of other questions: 1.) Is there a way to make this process loop through a batch of .jpg files (I need to 156 pages)? and 2.) Is there a way to change the output destination file to another folder?

Many thanks again for all your help, you have made something possible that I thought might be impossible!

Damon

Re: How to slice up image of text

Posted: 2017-03-31T13:11:24-07:00
by snibgo
I assume you now have a script with parameters for input file and output file.

Write another script with a "for" loop, to loop through your JPEGs and calls that script once per JPEG. The output filename can contain a folder.