You need pip and poetry for this project.
pip install poetryThen you can run the following command to install the dependencies.
poetry installThe sample file is sample-pdf.pdf
sample-dir is the sample output directory. This was generated with the following command
poetry run splitter images sample-pdf.pdf sample-dir --padding 5poetry run splitter rectangles sample-pdf.pdf sample-dir --padding 5produces the following JSON
[
{
"page": "sample-dir/sample-pdf.pdf-1.png",
"rectangles": [
{
"top_left": [
234,
693
],
"bottom_right": [
3421,
1551
]
},
{
"top_left": [
234,
1628
],
"bottom_right": [
3421,
2500
]
},
{
"top_left": [
234,
2575
],
"bottom_right": [
3421,
3425
]
},
{
"top_left": [
234,
3537
],
"bottom_right": [
3421,
4388
]
}
]
}
]poetry run splitter images sheet-music-pdf.pdf temporary-dir --padding 4This will create temporary-dir and save the split images there.
poetry run splitter rectangles sheet-music-pdf.pdf temporary-dirThis will create temporary-dir and save the work images there.
Then the rectangles will be output to stdout.
If you wish to omit poetry run from your commands, you may use poetry shell to do so.
