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,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<6B>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<73>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<73>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<65>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