Hi,
I hope IM can handle my request
I have a soccer ranking table as pdf file. This ranking is a) very wide and b) has one column in there which has to be deleted. So I think I speak in pictures which should be easier for you to understand what I want to do.
This is the pdf file (in this case converted already to a png file)
So I have to crop out that ranking (the command I should find) and then I have to edit that wide ranking to make it smaller (and cut off that "Torverh." column).
So I have to move multiple regions bit by bit to the left.
First mark the whole region from "Spiele" to "Punkte" and move that region to the left to have less white space between the club name "Mannschaft" and "Spiele" column.
Then do that for every other column ("G", "U", "V", "Differenz" and "Punkte". "Torverh." should then not be visible anymore after all changes).
The endresult should look like this.
Thanks!
Move regions in image to the left (different regions)
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Move regions in image to the left (different regions)
The following Windows command removes the top, then the "SW" column, then the "Torverh" column.
For Unix, use replace "^" with "\".
See http://www.imagemagick.org/script/comma ... s.php#chop
Code: Select all
convert ^
tabelle.png ^
-chop 0x638+0+0 ^
-chop 360x0+2120+0 ^
-chop 200x0+1520+0 ^
t.png
See http://www.imagemagick.org/script/comma ... s.php#chop
snibgo's IM pages: im.snibgo.com
Re: Move regions in image to the left (different regions)
Perfect, a few more -chop commands and the white spaces between the columns are also gone.
I have the following code now which generates the "thin ranking" as png file from the pdf file:
edit: The different rankings in my pdf files sometimes have 10 teams, then 20 teams, .... so is there an "auto cut/crop command" in IM so I can fine tune my -crop command above so IM recognize when the white space below the ranking appears and cut that off?
There is -trim but problem is after that big white space below the ranking at bottom there is a small footer line/text
I have the following code now which generates the "thin ranking" as png file from the pdf file:
Code: Select all
#!/bin/bash
# PDF to PNG with white background and 300 DPI
convert -density 300 tabelle.pdf -background white -flatten tabelle.png
# tabelle.png zurecht schneiden, damit nur noch das Ranking verengt übrig bleibt
# The -chop option removes entire rows and columns, and moves the remaining corner blocks leftward and upward to close the gaps.
convert \
tabelle.png \
-chop 0x638+0+0 \
-chop 360x0+2120+0 \
-chop 200x0+1520+0 \
tabelle.png
# crop the ranking (footer/white space below the ranking)
convert \
tabelle.png \
-crop 1870x1000+50+20 \
+repage \
tabelle.png
# cut white spaces between the columns
convert \
tabelle.png \
-chop 110x0+600+0 \
-chop 40x0+730+0 \
-chop 110x0+800+0 \
-chop 110x0+900+0 \
-chop 90x0+1000+0 \
-chop 40x0+1210+0 \
tabelle.png
# print the date/time, bottom right
convert \
tabelle.png \
-pointsize 24 \
-fill white \
-undercolor black \
-gravity SouthEast \
-annotate +10+10 " Stand: $(date +%e.\ %b\ %Y\ %H:%M) " \
tabelle.png
exit 0
edit: The different rankings in my pdf files sometimes have 10 teams, then 20 teams, .... so is there an "auto cut/crop command" in IM so I can fine tune my -crop command above so IM recognize when the white space below the ranking appears and cut that off?
There is -trim but problem is after that big white space below the ranking at bottom there is a small footer line/text
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Move regions in image to the left (different regions)
For setting up the chops, it is easier to start at the right and works towards the left, and start at the bottom and work towards the top.
For the variable length, is your small footer a constant length? If so, crop it off, then trim.
Your version of IM might have http://www.imagemagick.org/script/comma ... id-rescale , which might help.
For the variable length, is your small footer a constant length? If so, crop it off, then trim.
Your version of IM might have http://www.imagemagick.org/script/comma ... id-rescale , which might help.
snibgo's IM pages: im.snibgo.com
Re: Move regions in image to the left (different regions)
ok -crop and -trim works. After that I simply do a
to have 60px space for my date/time at the bottom right.
Perfect, thanks again snibgo!
Code: Select all
convert tabelle.png -size ${width}x60 xc:white -append tabelle.png
Perfect, thanks again snibgo!