magazines scripts

This commit is contained in:
tomse 2023-12-21 02:01:29 +01:00
parent c9b25e6672
commit 3d31705696
53 changed files with 941 additions and 0 deletions

View File

@ -0,0 +1,5 @@
@echo off
mkdir output
for %%i in (*.tif) DO (
convert %%i -quality 85%% output\%%~ni.jpg
)

View File

@ -0,0 +1,9 @@
@echo off
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
)

View File

@ -0,0 +1,47 @@
@echo off
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
)
if NOT EXIST output mkdir output
set thumb=1
if NOT EXIST audiomedia mkdir audiomedia
for %%i in (*.tif) DO (
if !thumb!==1 (
convert %%i -resize 240x310^^! -quality 75%% !folder!\thumb.jpg
)
set thumb=2
convert -units pixelsperinch %%i -resample 150 audiomedia\%%~ni.jpg
convert %%i -quality 95%% output\%%~ni.jpg
)
rem 300dpi mag
cd output
for %%i in (*.jpg) DO (
convert %%i %%~ni.pdf
)
del *.jpg /q
pdftk *.pdf cat output "%folder%\mag.pdf"
del *.pdf /q
cd ..
rem Tablet
cd audiomedia
for %%i in (*.jpg) DO (
convert %%i %%~ni.pdf
)
del *.jpg /q
pdftk *.pdf output "%folder%\audiomedia.pdf"
del *.pdf /q
pause

View File

@ -0,0 +1,44 @@
@echo off
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
)
"c:\Program Files (x86)\IrfanView\i_view32.exe" .\*.tif /convert=.\output\*.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

View File

@ -0,0 +1,57 @@
@echo off
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
if NOT EXIST tablet mkdir tablet
for %%i in (*.tif) DO (
if !thumb!==1 (
convert %%i -resize 240x310^^! -quality 75%% "!folder!\thumb.jpg"
)
set thumb=2
convert -units pixelsperinch %%i -resample 150 tablet\%%~ni.jpg
convert -units pixelsperinch %%i -resample 300 -quality 95%% output\%%~ni.jpg
)
rem 300dpi mag
cd output
for %%i in (*.jpg) DO (
convert %%i %%~ni.pdf
)
del *.jpg /q
pdftk *.pdf D:\Retro-Work\brought_to_you_by.pdf cat output "!folder!\_mag.pdf"
pdftk "!folder!\_mag.pdf" update_info D:\Retro-Work\metadata.txt output "!folder!\mag.pdf"
del *.pdf /q
del "!folder!\_mag.pdf"
cd ..
rem Tablet
cd tablet
for %%i in (*.jpg) DO (
convert %%i %%~ni.pdf
)
del *.jpg /q
pdftk *.pdf D:\Retro-Work\brought_to_you_by_[TABLET].pdf cat output _tablet.pdf
pdftk _tablet.pdf update_info D:\Retro-Work\metadata.txt output "!folder!\_tablet.pdf"
del *.pdf /q
pause

View File

@ -0,0 +1,42 @@
@echo off
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
)
if NOT EXIST output mkdir output
if NOT EXIST tablet mkdir tablet
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
convert -units pixelsperinch %%i -resample 150 tablet\%%~ni.pdf
)
cd output
pdftk *.pdf "D:\Retro-Work\brought_to_you_by.pdf" cat output "%folder%\_manual.pdf"
cd ..\tablet
pdftk *.pdf "D:\Retro-Work\brought_to_you_by_[TABLET].pdf" cat output "%folder%\_tablet.pdf"
cd ..
del output\*.pdf /q
del tablet\*.pdf /q
rd output
rd tablet
cd %folder%
start _manual.pdf
start _tablet.pdf
pause

View File

@ -0,0 +1,28 @@
@echo off
pdftotext manual_recognized.pdf manual2.ocr.txt
pdftotext _manual_recognized.pdf manual2.ocr.txt
pdftotext mag_recognized.pdf manual2.ocr.txt
pdftk "manual_recognized.pdf" update_info D:\Retro-Work\metadata.txt output "manual2.pdf"
pdftk "_manual_recognized.pdf" update_info D:\Retro-Work\metadata.txt output "manual2.pdf"
pdftk "mag_recognized.pdf" update_info D:\Retro-Work\metadata.txt output "[300dpi][ocr].pdf"
pdftk "_manual_recognized.pdf" update_info D:\Retro-Work\metadata.txt output "[600dpi][ocr].pdf"
pdftk "_tablet_recognized.pdf" update_info D:\Retro-Work\metadata.txt output "[150dpi][ocr].pdf"
pdftk "audiomedia_recognized.pdf" update_info D:\Retro-Work\metadata.txt output "Privat_Computer_199x_-_xx.pdf"
start [600dpi][ocr].pdf
start [150dpi][ocr].pdf
choice /m "Delete old files?"
if %ERRORLEVEL% EQU 1 goto delete
goto end
:delete
del _manual.pdf
del _manual_recognized.pdf
del _tablet.pdf
del _tablet_recognized.pdf
:end

View File

@ -0,0 +1,37 @@
@echo off
REM setlocal EnableDelayedExpansion
REM for "%%i" in (*_recognized.pdf) DO (
REM set file=%%i
REM set output=!file:recognized=ocr!
REM pdftk "%%i" update_info "D:\Retro-Work\metadata.txt" output !output!
REM del "%%i
REM )
REM endlocal
for %%i in (*.pdf) DO (
md5sum "%%i" > "%%i.md5"
sha1sum "%%i" > "%%i.sha1"
)
for %%j in (*.ocr.txt) DO (
md5sum "%%j" > "%%j.md5"
echo 2
sha1sum "%%j" > "%%j.sha1"
)
for %%k in (*.zip) DO (
md5sum "%%k" > "%%k.md5"
echo 3
sha1sum "%%k" > "%%k.sha1"
)
cd work\out
rd cache /s /q
rd newpages /s /q
rd output /s /q
pause

View File

@ -0,0 +1,7 @@
@echo off
mkdir work
mkdir origs
for %%i in (*.tif) DO (
convert %%i -level 11%%,86%% work\%%i
move %%i origs
)

View File

@ -0,0 +1,7 @@
@echo off
mkdir audiomedia
for %%i in (*.tif) DO (
convert -units pixelsperinch %%i -resample 150 audiomedia\%%i
)

View File

@ -0,0 +1,5 @@
@echo off
mkdir tablet
for %%i in (*.tif) DO (
convert %%i -resize 1024x4096 -quality 85%% tablet\%%~ni.jpg
)

View File

@ -0,0 +1,11 @@
@echo off
mkdir out
for %%i in (*.tif) DO (
convert -units pixelsperinch %%i -resample 150 out\%%i
)
for %%i in (*.png) DO (
convert -units pixelsperinch %%i -resample 150 out\%%i
)

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

View File

@ -0,0 +1,4 @@
url: COMPuter_Issue_003_1985-12.pdf
title: COMputer 09/89
date: 1989 Sep
resolution: 0

View File

@ -0,0 +1,32 @@
Scriptet kræver php.exe samt php.dll (medlagt denne zip fil) for at kunne køres.
Runme.cmd er en fil man kan dobbelt klikke på så man bliver fri for at skulle skrive
kommanoen fra kommando prompten i Windows.
Scriptet går ud fra at
1. siderne har været scannet ved at føde scanneren med papirsiderne fra et blad hvor
klipsen har været fjernet, dvs for- bagside er scannet til 1 billede, og papiret vendt om så
side 2 og andensidste side er scannet som nr 2 osv. Dette kan gøres fra en almindelig flatbed-
scanner eller fra en dokument scanner. Scannes siderne som de læses, fx side 2,3,4,5 skal
dette script ikke benyttes.
2. Inputfilerne har været behandlet ved at skære siderne i 2. fx fra ScanTailor.
3. For- og bagsiderne er de første sider der er scannet ind, midtersiderne er de sidste.
Fx siderne er scannet i dokumentscanneren med forsiden opad.
[Vejledning]
de 4 filer: correct_pages.php, php.dll, php.exe og runme.cmd lægges i mappen
med filerne der er i uorden.
Input filerne skal være med fil extension tif, som outputtes fra Scan Tailor programmet.
Dobbelt klik på "runme.cmd" filen.
Der popper en sort skærm op ved kørsels start, og beder om at trykke en tast når
jobbet er færdigt.
Der ligger nu en kopi -i sorteret rækkefølge- i en undermappe "newpages".
Der bliver ikke lavet noget ved input/original filerne.
Filerne fra newpages mappen kan nu kopieres ind i Adobe Acrobat.

View File

@ -0,0 +1,65 @@
<?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);
$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);
}
?>

View File

@ -0,0 +1,5 @@
@echo off
php.exe -f correct_pages.php
echo Job is finished!
pause

View File

@ -0,0 +1,5 @@
for %%i in (*.tif) DO (
convert.exe %%i -type Grayscale pages\%%i.png
)
pause
rename pages\*.tif.png pages\*.png

View File

@ -0,0 +1,5 @@
@echo off
for %%i in (*.png) DO (
convert "%%i" -quality 85%% "pages\%%~ni.jpg"
)
pause

View File

@ -0,0 +1,6 @@
@echo off
mkdir pages
for %%i in (*.tif) DO (
convert "%%i" -quality 85%% "pages\%%~ni.jpg"
)
pause

View File

@ -0,0 +1,65 @@
<?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);
$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);
}
?>

View File

@ -0,0 +1,20 @@
if not exist cropped mkdir cropped
setlocal enabledelayedexpansion enableextensions
rem start coords
set /a cy=33
set /a cx=0
rem size
set x=4045
set y=6865
for %%i in (*.tif) DO (
set /A cy=%cy%-4
rem convert %%i -crop %x%x%y%+%cx%+!cy! +repage -type Grayscale cropped\%%i.png
convert %%i -crop %x%x%y%+%cx%+!cy! +repage cropped\%%i.png
)
endlocal
rem convert *.jpg -crop 1600x2490+213+2450 +repage pages/even/even.jpg

View File

@ -0,0 +1,20 @@
if not exist cropped mkdir cropped
setlocal enabledelayedexpansion enableextensions
rem start coords
set /a cy=0
set /a cx=0
rem size
set x=4473
set y=6167
for %%i in (*.tif) DO (
rem set /A cy=%cy%-3
rem convert %%i -crop %x%x%y%+%cx%+!cy! +repage -type Grayscale cropped\%%i.png
convert %%i -crop %x%x%y%+%cx%+!cy! +repage cropped\%%i.png
)
endlocal
rem convert *.jpg -crop 1600x2490+213+2450 +repage pages/even/even.jpg

View File

@ -0,0 +1,3 @@
for %%i in (*.png) DO (
convert %%i -resize 4840x3444 small\%%i
)

View File

@ -0,0 +1,4 @@
if not exist rotated mkdir rotated
for %%i in (*.png) DO (
convert %%i -rotate 90 rotated\%%i
)

View File

@ -0,0 +1,18 @@
@echo off
setlocal enabledelayedexpansion enableextensions
rem 0 = rotate right the first time, then alternate
set left=0
IF NOT EXIST pages mkdir pages
for %%i in (*.tif) DO (
IF !left! equ 1 (
convert %%i -rotate -90 pages/%%~ni.png
set left=0
) else (
convert %%i -rotate 90 pages/%%~ni.png
set left=1
)
)
endlocal

View File

@ -0,0 +1,4 @@
IF NOT EXIST pages mkdir pages
for %%i in (*.tif) DO (
convert %%i -rotate -90 pages/%%i.png
)

View File

@ -0,0 +1,2 @@
php.exe -f correct_pages.php
pause

View File

@ -0,0 +1,9 @@
@echo off
mkdir work
cd origs
for %%i in (*.tif) DO (
convert %%i -level 19%%,58%% ..\work\%%i
)
for %%i in (*.png) DO (
convert %%i -level 19%%,58%% ..\work\%%i
)

View File

@ -0,0 +1,4 @@
mkdir indexed
for %%i in (*.tif) DO (
convert %%i +dither -remap D:\Retro-Work\3col.png indexed\%%~ni.png
)

View File

@ -0,0 +1,4 @@
mkdir pages
for %%i in (*.tif) DO (
convert %%i -grayscale rec709luma pages\%%i
)

View File

@ -0,0 +1,9 @@
@echo off
cd work/out
mkdir resample
for %%i in (*.tif) DO (
convert -units PixelsPerInch "%%i" -density 400 "resample\%%i"
)
for %%i in (*.png) DO (
convert -units PixelsPerInch "%%i" -density 400 "resample\%%i"
)

View File

@ -0,0 +1,9 @@
@echo off
cd work/out
mkdir resample
for %%i in (*.tif) DO (
convert -units PixelsPerInch "%%i" -density 600 "resample\%%i"
)
for %%i in (*.png) DO (
convert -units PixelsPerInch "%%i" -density 600 "resample\%%i"
)

View File

@ -0,0 +1,4 @@
@echo off
mkdir work\out\g4compressed
cd work\out
"c:\Program Files (x86)\IrfanView\i_view32.exe" .\*.tif /tifc=4 /convert=.\g4compressed\*.tif

View File

@ -0,0 +1,73 @@
@echo off
rem *****************************
rem * 2015 Carsten Jensen / DDHF
rem * Script til behandling af
rem * indscannede sider
rem *****************************
setlocal EnableDelayedExpansion
set folder=%cd%
cd work\out
echo tryk CTRL-C hvis du vil afbryde processen.
choice /m "Ret side orden "
if %errorlevel%==1 (
REM Rediger nedenstående stå så den passer med dit setup.
copy ..\correct_pages.php .\ /y
php -f correct_pages.php
cd newpages
)
if NOT EXIST output mkdir output
set thumb=1
choice /C SF /m "S/H (S) eller Farver (jpg komprimering) (F)"
echo.
echo Arbejder vent venligst...
echo.
if %errorlevel%==2 (
REM Opret Farve Dokument (jpg komprimering)
for %%i in (*.tif) DO (
if !thumb!==1 (
convert %%i -resize 240x310^^! -quality 75%% "!folder!\thumb.jpg"
)
set thumb=2
convert %%i -quality 95%% output\%%~ni.jpg
)
cd output
for %%i in (*.jpg) DO (
convert %%i %%~ni.pdf
)
del *.jpg /q
) else if %errorlevel%==1 (
REM Opret S/H Dokument (ingen jpg komprimering)
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
) else goto error
pdftk *.pdf cat output %folder%\dokument.pdf
del *.pdf /q
:success
Echo PDF + Thumb oprettet
goto end
:error
Echo der opstod en fejl, evt i dit valg.
goto end
:end
pause

View File

@ -0,0 +1,9 @@
@echo off
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
)

View File

@ -0,0 +1,13 @@
#!/bin/bash
mkdir work
cd origs
for i in *.tif
do
convert $i -level 11%%,86% ../work/$i
done
for i in *.png
do
convert $i -level 11%%,86% ../work/$i
done

View File

@ -0,0 +1,7 @@
mkdir pages
for %%i in (*.tif) DO (
convert %%i -grayscale rec709luma pages\%%i
)
for %%i in (*.png) DO (
convert %%i -grayscale rec709luma pages\%%i
)

View File

@ -0,0 +1,11 @@
#!/bin/bash
mkdir pages
for i in *.tif
do
convert $i -grayscale rec709luma pages/$i
done
for i in *.png
do
convert $i -grayscale rec709luma pages/$i
done

View File

@ -0,0 +1,47 @@
@echo off
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
)
if NOT EXIST output mkdir output
set thumb=1
if NOT EXIST audiomedia mkdir audiomedia
for %%i in (*.tif) DO (
if !thumb!==1 (
convert %%i -resize 240x310^^! -quality 75%% !folder!\thumb.jpg
)
set thumb=2
convert -units pixelsperinch %%i -resample 150 audiomedia\%%~ni.jpg
convert %%i -quality 95%% output\%%~ni.jpg
)
rem 300dpi mag
cd output
for %%i in (*.jpg) DO (
convert %%i %%~ni.pdf
)
del *.jpg /q
pdftk *.pdf cat output "%folder%\mag.pdf"
del *.pdf /q
cd ..
rem Tablet
cd audiomedia
for %%i in (*.jpg) DO (
convert %%i %%~ni.pdf
)
del *.jpg /q
pdftk *.pdf output "%folder%\audiomedia.pdf"
del *.pdf /q
pause

View File

@ -0,0 +1,57 @@
@echo off
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
if NOT EXIST tablet mkdir tablet
for %%i in (*.tif) DO (
if !thumb!==1 (
convert %%i -resize 240x310^^! -quality 75%% "!folder!\thumb.jpg"
)
set thumb=2
convert %%i -resize 1024x4096 -quality 95%% tablet\%%~ni.jpg
convert %%i -quality 95%% output\%%~ni.jpg
)
rem 300dpi mag
cd output
for %%i in (*.jpg) DO (
convert %%i %%~ni.pdf
)
del *.jpg /q
pdftk *.pdf D:\Retro-Work\brought_to_you_by.pdf cat output "!folder!\_mag.pdf"
pdftk "!folder!\_mag.pdf" update_info D:\Retro-Work\metadata.txt output "!folder!\mag.pdf"
del *.pdf /q
del "!folder!\_mag.pdf"
cd ..
rem Tablet
cd tablet
for %%i in (*.jpg) DO (
convert %%i %%~ni.pdf
)
del *.jpg /q
pdftk *.pdf D:\Retro-Work\brought_to_you_by_[TABLET].pdf cat output _tablet.pdf
pdftk _tablet.pdf update_info D:\Retro-Work\metadata.txt output "!folder!\_tablet.pdf"
del *.pdf /q
pause

View File

@ -0,0 +1,37 @@
#!/bin/sh
cd work/out
mkdir output
mkdir audiomedia
for i in *.tif
do
convert -units pixelsperinch $i -resample 150 audiomedia/$i.jpg
convert $i -quality 95% output/$i.jpg
done
rem 300dpi mag
cd output
for i in *.jpg
do
convert $i $i.pdf
done
rm *.jpg
pdftk *.pdf cat output ../../../mag.pdf
rm *.pdf
cd ..
rem Tablet
cd audiomedia
for i in *.jpg
do
convert $i $i.pdf
done
rm *.jpg
pdftk *.pdf output ../../../audiomedia.pdf
rm *.pdf

View File

@ -0,0 +1,57 @@
@echo off
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
if NOT EXIST tablet mkdir tablet
for %%i in (*.tif) DO (
if !thumb!==1 (
convert %%i -resize 240x310^^! -quality 75%% "!folder!\thumb.jpg"
)
set thumb=2
convert %%i -resize 1024x4096 -quality 95%% tablet\%%~ni.jpg
convert %%i -quality 95%% output\%%~ni.jpg
)
rem 300dpi mag
cd output
for %%i in (*.jpg) DO (
convert %%i %%~ni.pdf
)
del *.jpg /q
pdftk *.pdf D:\Retro-Work\brought_to_you_by.pdf cat output "!folder!\_mag.pdf"
pdftk "!folder!\_mag.pdf" update_info D:\Retro-Work\metadata.txt output "!folder!\mag.pdf"
del *.pdf /q
del "!folder!\_mag.pdf"
cd ..
rem Tablet
cd tablet
for %%i in (*.jpg) DO (
convert %%i %%~ni.pdf
)
del *.jpg /q
pdftk *.pdf D:\Retro-Work\brought_to_you_by_[TABLET].pdf cat output _tablet.pdf
pdftk _tablet.pdf update_info D:\Retro-Work\metadata.txt output "!folder!\_tablet.pdf"
del *.pdf /q
pause

Binary file not shown.

View File

@ -0,0 +1,32 @@
<?php
$forward = glob('./forward/*.tif');
$backward = glob('./backward/*.tif');
rsort($backward);
$output = './output/';
$fcount = 1;
$bcount = 2;
if(!file_exists($output)) mkdir($output, 0777, true);
foreach($forward as $fk => $fv)
{
echo $fk . ' => ' . $fv . "\n";
copy($fv, $output . str_pad($fcount, 4, 0, STR_PAD_LEFT) . '.tif');
$fcount += 2;
}
foreach($backward as $bk => $bv)
{
if ($bk % 2 != 0)
{
echo $bk . ' => ' . $bv . "\n";
copy($bv, $output . str_pad($bcount, 4, 0, STR_PAD_LEFT) . '.tif');
$bcount += 2;
}
}
?>

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,2 @@
php.exe -f forward.php
pause