use of eu.transkribus.core.io.util.ExtensionFileFilter in project TranskribusCore by Transkribus.
the class ScalePageCoordinatesToImageDimension method heldenbuch300to600dpi.
private static void heldenbuch300to600dpi() throws JAXBException, IOException {
File input = new File("/tmp/Ambraser_Heldenbuch/Ambraser_Heldenbuch/page");
File output = new File("/tmp/Ambraser_Heldenbuch/page_edited");
if (!output.isDirectory()) {
output.mkdirs();
}
File[] files = input.listFiles(new ExtensionFileFilter("xml", true, false));
for (File f : files) {
System.out.println("Processing file: " + f.getName());
PcGtsType pc = PageXmlUtils.unmarshal(f);
TrpPageTypeUtils.applyAffineTransformation(pc.getPage(), 0, 0, 2, 2, 0);
final String filename;
if (f.getName().contains("_")) {
filename = f.getName().split("_")[1];
} else {
filename = f.getName();
}
System.out.println("Writing file: " + filename);
PageXmlUtils.marshalToFile(pc, new File(output.getAbsolutePath() + File.separator + filename));
}
}
use of eu.transkribus.core.io.util.ExtensionFileFilter in project TranskribusCore by Transkribus.
the class ScalePageCoordinatesToImageDimension method fixAltoFilenames.
private static void fixAltoFilenames() throws IOException {
final String path = "/media/daten/Dokumente/newseye_testdata/alto/";
ExtensionFileFilter filt = new ExtensionFileFilter("xml", true, false);
File[] files = new File(path).listFiles(filt);
for (File f : files) {
File target = new File(f.getAbsolutePath().replaceAll("-gt2", ""));
Files.move(f, target);
}
}
use of eu.transkribus.core.io.util.ExtensionFileFilter in project TranskribusCore by Transkribus.
the class ScalePageCoordinatesToImageDimension method heldenbuch600to300dpi.
private static void heldenbuch600to300dpi() throws JAXBException, IOException {
File input = new File("/tmp/Heldenbuch_600dpi/Heldenbuch_600dpi/page");
File output = new File("/tmp/Heldenbuch_600dpi/page_edited");
if (!output.isDirectory()) {
output.mkdirs();
}
File[] files = input.listFiles(new ExtensionFileFilter("xml", true, false));
for (File f : files) {
System.out.println("Processing file: " + f.getName());
PcGtsType pc = PageXmlUtils.unmarshal(f);
TrpPageTypeUtils.applyAffineTransformation(pc.getPage(), 0, 0, 0.5, 0.5, 0);
final String filename;
if (f.getName().contains("_")) {
filename = f.getName().split("_")[1];
} else {
filename = f.getName();
}
System.out.println("Writing file: " + filename);
PageXmlUtils.marshalToFile(pc, new File(output.getAbsolutePath() + File.separator + filename));
}
}
Aggregations