initial commit
This commit is contained in:
		
							
								
								
									
										14
									
								
								ScanScripts/Windows/0 - Default Level (doc-scanner).cmd
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								ScanScripts/Windows/0 - Default Level (doc-scanner).cmd
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,14 @@
 | 
			
		||||
@echo off
 | 
			
		||||
rem Author: Carsten Jensen (Tomse)
 | 
			
		||||
rem Copyright (c) 2013-2018 http://retro-commodore.eu
 | 
			
		||||
rem Requires ImageMagick commandline in path
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
mkdir work
 | 
			
		||||
cd origs
 | 
			
		||||
for %%i in (*.tif) DO (
 | 
			
		||||
convert "%%i" -level 11%%,86%% "..\work\%%i"
 | 
			
		||||
)
 | 
			
		||||
for %%i in (*.png) DO (
 | 
			
		||||
convert "%%i" -level 11%%,86%% "..\work\%%i"
 | 
			
		||||
)
 | 
			
		||||
							
								
								
									
										14
									
								
								ScanScripts/Windows/1 - resample to 600dpi.cmd
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								ScanScripts/Windows/1 - resample to 600dpi.cmd
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,14 @@
 | 
			
		||||
@echo off
 | 
			
		||||
rem Author: Carsten Jensen (Tomse)
 | 
			
		||||
rem Copyright (c) 2013-2018 http://retro-commodore.eu
 | 
			
		||||
rem Requires ImageMagick commandline in path
 | 
			
		||||
 | 
			
		||||
cd work/out
 | 
			
		||||
for %%i in (*.tif) DO (
 | 
			
		||||
convert -units PixelsPerInch "%%i" -density 600 "__%%i"
 | 
			
		||||
move "__%%i" "%%i"
 | 
			
		||||
)
 | 
			
		||||
for %%i in (*.png) DO (
 | 
			
		||||
convert -units PixelsPerInch "%%i" -density 600 "__%%i"
 | 
			
		||||
move "__%%i" "%%i"
 | 
			
		||||
)
 | 
			
		||||
							
								
								
									
										8
									
								
								ScanScripts/Windows/2 - G4_Compress.cmd
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								ScanScripts/Windows/2 - G4_Compress.cmd
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,8 @@
 | 
			
		||||
@echo off
 | 
			
		||||
rem Author: Carsten Jensen (Tomse)
 | 
			
		||||
rem Copyright (c) 2013-2018 http://retro-commodore.eu
 | 
			
		||||
rem Requires IrfanView installed in path (or fix path)
 | 
			
		||||
 | 
			
		||||
mkdir work\out\g4compressed
 | 
			
		||||
cd work\out
 | 
			
		||||
"c:\Program Files (x86)\IrfanView\i_view32.exe" .\*.tif /tifc=4 /convert=.\g4compressed\*.tif
 | 
			
		||||
							
								
								
									
										48
									
								
								ScanScripts/Windows/2 - Make manual.cmd
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										48
									
								
								ScanScripts/Windows/2 - Make manual.cmd
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,48 @@
 | 
			
		||||
@echo off
 | 
			
		||||
rem Author: Carsten Jensen (Tomse)
 | 
			
		||||
rem Copyright (c) 2013-2018 http://retro-commodore.eu
 | 
			
		||||
rem Requires ImageMagick and pdf tool kit commandline in path
 | 
			
		||||
 | 
			
		||||
setlocal EnableDelayedExpansion
 | 
			
		||||
set folder=%cd%
 | 
			
		||||
cd work\out
 | 
			
		||||
 | 
			
		||||
choice /m "Fix paging "
 | 
			
		||||
if %errorlevel%==1 (
 | 
			
		||||
copy D:\Retro-Work\correct_pages.php .\ /y
 | 
			
		||||
php -f correct_pages.php
 | 
			
		||||
cd newpages
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
choice /C LSN /m "Use large (L), small (S) or no (N) lastpage  "
 | 
			
		||||
if %errorlevel%==1 (
 | 
			
		||||
set page=brought_to_you_by.pdf
 | 
			
		||||
) else if %errorlevel%==2 (
 | 
			
		||||
set page=brought_to_you_by_[TABLET].pdf
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
if NOT EXIST output mkdir output
 | 
			
		||||
set thumb=1
 | 
			
		||||
 | 
			
		||||
for %%i in (*.tif) DO (
 | 
			
		||||
if !thumb!==1 (
 | 
			
		||||
convert %%i -resize 240x310^^! -quality 80%% "!folder!\thumb.jpg"
 | 
			
		||||
)
 | 
			
		||||
set thumb=2
 | 
			
		||||
convert %%i output\%%~ni.pdf
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
cd output
 | 
			
		||||
REM for %%i in (*.jpg) DO (
 | 
			
		||||
REM convert %%i %%~ni.pdf
 | 
			
		||||
REM )
 | 
			
		||||
 | 
			
		||||
REM del *.jpg /q
 | 
			
		||||
pdftk *.pdf "D:\Retro-Work\%page%" cat output "%folder%\_manual.pdf"
 | 
			
		||||
pdftk "%folder%\_manual.pdf" update_info D:\Retro-Work\metadata.txt output "%folder%\manual.pdf"
 | 
			
		||||
del *.pdf /q
 | 
			
		||||
REM del ..\*.* /q
 | 
			
		||||
del "%folder%\_manual.pdf" /q
 | 
			
		||||
 | 
			
		||||
pause
 | 
			
		||||
							
								
								
									
										9
									
								
								ScanScripts/Windows/3 - PdfToText.cmd
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								ScanScripts/Windows/3 - PdfToText.cmd
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,9 @@
 | 
			
		||||
@echo off
 | 
			
		||||
rem Author: Carsten Jensen (Tomse)
 | 
			
		||||
rem Copyright (c) 2013-2018 http://retro-commodore.eu
 | 
			
		||||
rem Requires pdf tool kit commandline in path
 | 
			
		||||
 | 
			
		||||
set workdir="D:\Retro-Work\"
 | 
			
		||||
 | 
			
		||||
pdftotext manual_recognized.pdf manual2.ocr.txt
 | 
			
		||||
pdftk "manual_recognized.pdf" update_info %workdir%\metadata.txt output "manual2.pdf"
 | 
			
		||||
							
								
								
									
										22
									
								
								ScanScripts/Windows/5 - hash_em.cmd
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								ScanScripts/Windows/5 - hash_em.cmd
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,22 @@
 | 
			
		||||
@echo off
 | 
			
		||||
rem Author: Carsten Jensen (Tomse)
 | 
			
		||||
rem Copyright (c) 2013-2018 http://retro-commodore.eu
 | 
			
		||||
rem Requires md5sum and sha1sum commandline tools in path
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
for %%i in (*.pdf) DO (
 | 
			
		||||
 | 
			
		||||
md5sum  %%i > %%i.md5
 | 
			
		||||
sha1sum %%i > %%i.sha1
 | 
			
		||||
)
 | 
			
		||||
for %%i in (*.ocr.txt) DO (
 | 
			
		||||
md5sum  %%i > %%i.md5
 | 
			
		||||
sha1sum %%i > %%i.sha1
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
for %%i in (*.zip) DO (
 | 
			
		||||
md5sum  %%i > %%i.md5
 | 
			
		||||
sha1sum %%i > %%i.sha1
 | 
			
		||||
)
 | 
			
		||||
							
								
								
									
										3
									
								
								ScanScripts/Windows/Info.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								ScanScripts/Windows/Info.txt
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,3 @@
 | 
			
		||||
If you want to use the scripts keep the directory structure from this level and save in your D: drive
 | 
			
		||||
 | 
			
		||||
otherwise just edit the scripts to fit your needs.
 | 
			
		||||
							
								
								
									
										65
									
								
								ScanScripts/Windows/correct_pages.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										65
									
								
								ScanScripts/Windows/correct_pages.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,65 @@
 | 
			
		||||
<?php
 | 
			
		||||
// Author Carsten Jensen aka Tomse
 | 
			
		||||
// Copyright (c) 2013-2018 Carsten Jensen
 | 
			
		||||
// Released under GNU GPL v2
 | 
			
		||||
 | 
			
		||||
// Corrects page numbers from scanned full-paper pages
 | 
			
		||||
// which has been split into 2, and been edited in scan tailor
 | 
			
		||||
 | 
			
		||||
$ext = '.tif';
 | 
			
		||||
$files = glob('*.tif');
 | 
			
		||||
 | 
			
		||||
// set to 0 if back page lies first, or 1 if frontpage lies first
 | 
			
		||||
$up = 0;
 | 
			
		||||
$down = count($files);
 | 
			
		||||
$dest = 'newpages';
 | 
			
		||||
$pad = strlen($down)+1;
 | 
			
		||||
@mkdir($dest);
 | 
			
		||||
 | 
			
		||||
$again = 1;
 | 
			
		||||
$back = true;
 | 
			
		||||
 | 
			
		||||
foreach($files as $k => $v)
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
	
 | 
			
		||||
	if($back === true)
 | 
			
		||||
	{
 | 
			
		||||
	
 | 
			
		||||
		copy($v, $dest . DIRECTORY_SEPARATOR . 'page' . padding($down, $pad) . $ext);
 | 
			
		||||
		$down--;
 | 
			
		||||
		if ($again > 2 OR $k == 0)
 | 
			
		||||
		{
 | 
			
		||||
			$again = 1;
 | 
			
		||||
			$back = false;
 | 
			
		||||
		}
 | 
			
		||||
		echo "$k => $down \n";
 | 
			
		||||
		$again++;
 | 
			
		||||
	}
 | 
			
		||||
	else
 | 
			
		||||
	{
 | 
			
		||||
		copy($v, $dest . DIRECTORY_SEPARATOR . 'page' . padding($up, $pad) . $ext);
 | 
			
		||||
		$up++;
 | 
			
		||||
		if ($again > 2)
 | 
			
		||||
		{
 | 
			
		||||
			$again = 1;
 | 
			
		||||
			$back = true;
 | 
			
		||||
		}
 | 
			
		||||
		echo "$k => $up \n";
 | 
			
		||||
		$again++;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Pads a number with zeroes to make a nice even lenghted result
 | 
			
		||||
 * Author Carsten Jensen
 | 
			
		||||
 * @param int $int number to be padded
 | 
			
		||||
 * @param int $length of padding
 | 
			
		||||
 * @return int padded number
 | 
			
		||||
*/
 | 
			
		||||
function padding($int, $length = 2)
 | 
			
		||||
{
 | 
			
		||||
	return str_pad($int, $length, 0, STR_PAD_LEFT);
 | 
			
		||||
}
 | 
			
		||||
?>
 | 
			
		||||
							
								
								
									
										20
									
								
								ScanScripts/Windows/file length.bat
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								ScanScripts/Windows/file length.bat
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,20 @@
 | 
			
		||||
@echo off
 | 
			
		||||
REM Script to be run from within dir with .dats (move script)
 | 
			
		||||
 | 
			
		||||
setlocal EnableDelayedExpansion
 | 
			
		||||
 | 
			
		||||
for %%i in (*.dat) do (
 | 
			
		||||
 | 
			
		||||
(echo %%~fi) > tempfile.txt
 | 
			
		||||
for  %%? IN (tempfile.txt) DO ( SET /A strlength=%%~z? - 2 )
 | 
			
		||||
echo !strlength!
 | 
			
		||||
if !strlength! GTR 256 echo "%%i is too large"
 | 
			
		||||
)
 | 
			
		||||
del tempfile.txt /q
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
endlocal
 | 
			
		||||
 | 
			
		||||
REM Create dir script can begin here
 | 
			
		||||
 | 
			
		||||
pause
 | 
			
		||||
							
								
								
									
										53
									
								
								ScanScripts/Windows/make_booklet.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										53
									
								
								ScanScripts/Windows/make_booklet.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,53 @@
 | 
			
		||||
<?php
 | 
			
		||||
// Author Carsten Jensen aka Tomse
 | 
			
		||||
// Copyright (c) 2013 Carsten Jensen
 | 
			
		||||
// Released under GNU GPL v2
 | 
			
		||||
 | 
			
		||||
// Corrects page numbers from scanned full-paper pages
 | 
			
		||||
// which has been split into 2, and been edited in scan tailor
 | 
			
		||||
 | 
			
		||||
$ext = '.tif';
 | 
			
		||||
$files = glob('*.tif');
 | 
			
		||||
 | 
			
		||||
// set to 0 if back page lies first, or 1 if frontpage lies first
 | 
			
		||||
$up = 0;
 | 
			
		||||
$down = count($files);
 | 
			
		||||
$odd = 'odd';
 | 
			
		||||
$even = 'even';
 | 
			
		||||
$pad = strlen($down)+1;
 | 
			
		||||
@mkdir ($odd);
 | 
			
		||||
@mkdir ($even);
 | 
			
		||||
 | 
			
		||||
$again = 1;
 | 
			
		||||
$back = true;
 | 
			
		||||
 | 
			
		||||
foreach($files as $k => $v)
 | 
			
		||||
{
 | 
			
		||||
	if ($up % 2)  // Even pages
 | 
			
		||||
	{
 | 
			
		||||
		copy($v, $even . DIRECTORY_SEPARATOR . 'page' . padding($up, $pad) . $ext);
 | 
			
		||||
		$up++;
 | 
			
		||||
		echo "$k => even\\ $up \n";
 | 
			
		||||
	}
 | 
			
		||||
	else
 | 
			
		||||
	{
 | 
			
		||||
		copy($v, $odd . DIRECTORY_SEPARATOR . 'page' . padding($down, $pad) . $ext);
 | 
			
		||||
		$up++;
 | 
			
		||||
		$down--;
 | 
			
		||||
		echo "$k => odd\\ $down \n";
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Pads a number with zeroes to make a nice even lenghted result
 | 
			
		||||
 * Author Carsten Jensen
 | 
			
		||||
 * @param int $int number to be padded
 | 
			
		||||
 * @param int $length of padding
 | 
			
		||||
 * @return int padded number
 | 
			
		||||
*/
 | 
			
		||||
function padding($int, $length = 2)
 | 
			
		||||
{
 | 
			
		||||
	return str_pad($int, $length, 0, STR_PAD_LEFT);
 | 
			
		||||
}
 | 
			
		||||
?>
 | 
			
		||||
		Reference in New Issue
	
	Block a user