Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
Quack
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
commul
Zeit.shift
Quack
Commits
f1da85e4
Commit
f1da85e4
authored
11 years ago
by
Toke Eskildsen
Browse files
Options
Downloads
Patches
Plain Diff
Added simple script for generating presentational images with name-based conditional enhancements
parent
fd939d58
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
presentation.sh
+62
-0
62 additions, 0 deletions
presentation.sh
with
62 additions
and
0 deletions
presentation.sh
0 → 100755
+
62
−
0
View file @
f1da85e4
#!/bin/bash
#
# Generates presentational copies for scanned pages.
# Intended to be called from quack.sh to generate images to shown on the QA page.
#
# Override settings by creating "presentation.settings" and specifying DEFAULT_COMMANDS
# and/or get_commands
#
SETTINGS
=
"presentation.settings"
# geometry resizes to 50% (the > is redundant with percents <= 100, but we keep it
# as it is a fine default as we never want to enlarge).
# unsharp is for a high quality 300 DPI scan with no previous sharpen applied.
# level is highly source-specific. The default is a conservative starker contrast.
# no intensities > 240.
# Quality is for JPEG output. This needs to be quite high as JPEG artifacts are
# very visible with tiny text.
DEFAULT_COMMANDS
=
"-geometry 50%x> -unsharp 0.8x0.1+0.8+2.0 -level 10,1.0,245 -quality 90"
# Input: source
# Output: COMMANDS (GraphicsMagick options)
function
get_commands
()
{
local
SOURCE
=
"
$1
"
if
[
"."
!=
".
`
echo
\"
$SOURCE
\"
|
grep
-o
inesta
`
"
]
;
then
# This provider has very dark scans with no intensities > 240
COMMANDS
=
"-geometry 50%x> -unsharp 0.8x0.1+0.8+2.0 -level 0,1.0,230 -quality 90"
return
fi
if
[
"."
!=
".
`
echo
\"
$SOURCE
\"
|
grep
-o
pex
`
"
]
;
then
# This provider has scans practically without any blown high- or low-lights
COMMANDS
=
"-geometry 50%x> -unsharp 0.8x0.1+0.8+2.0 -level 15,1.0,240 -quality 90"
return
fi
COMMANDS
=
"
$DEFAULT_COMMANDS
"
}
pushd
`
dirname
$0
`
>
/dev/null
ROOT
=
`
pwd
`
if
[
-e
"
$SETTINGS
"
]
;
then
echo
"Sourcing settings from
$SETTINGS
"
source
"
$SETTINGS
"
fi
popd
>
/dev/null
SOURCE
=
"
$1
"
DESTINATION
=
"
$2
"
if
[
!
-f
"
$SOURCE
"
]
;
then
echo
"The image '
$SOURCE
' does not exist"
exit
2
fi
if
[
"."
==
".
$DESTINATION
"
]
;
then
echo
"Usage: ./presentation.sh source destination"
exit
2
fi
get_commands
"
$SOURCE
"
gm convert
"
$SOURCE
"
$COMMANDS
"
$DESTINATION
"
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment