Skip to content
Snippets Groups Projects
Commit cada121b authored by Toke Eskildsen's avatar Toke Eskildsen
Browse files

Added tile support

parent 6685c474
No related branches found
No related tags found
No related merge requests found
...@@ -21,6 +21,7 @@ An enhanced [ALTO](http://www.loc.gov/standards/alto/)-viewer for Quality Assura ...@@ -21,6 +21,7 @@ An enhanced [ALTO](http://www.loc.gov/standards/alto/)-viewer for Quality Assura
* [openseadragon.min.js](http://openseadragon.github.io/) * [openseadragon.min.js](http://openseadragon.github.io/)
* A suitable beefy browser equipped machine for display, depending on image sizes and ALTO complexity * A suitable beefy browser equipped machine for display, depending on image sizes and ALTO complexity
* [deepzoom](http://search.cpan.org/~drrho/Graphics-DZI-0.05/script/deepzoom) (only if tile based display is enabled) * [deepzoom](http://search.cpan.org/~drrho/Graphics-DZI-0.05/script/deepzoom) (only if tile based display is enabled)
* Perl (required by deepzoom)
## Potential improvements ## Potential improvements
......
...@@ -94,14 +94,7 @@ ${ALTERNATIVES} ...@@ -94,14 +94,7 @@ ${ALTERNATIVES}
showNavigator: false, showNavigator: false,
wrapHorizontal: false, wrapHorizontal: false,
tileSources: { tileSources: {
type: 'legacy-image-pyramid', ${TILE_SOURCES}
levels:[
{
url: '${IMAGE}',
width: ${IMAGE_WIDTH},
height: ${IMAGE_HEIGHT}
},
]
}, },
${OVERLAYS} ${OVERLAYS}
}); });
......
...@@ -57,7 +57,10 @@ ALTO_EXT=".alto.xml" ...@@ -57,7 +57,10 @@ ALTO_EXT=".alto.xml"
export IMAGE_DISP_EXT="png" export IMAGE_DISP_EXT="png"
# If jpg is chosen for IMAGE_DISP_EXT, this quality setting (1-100) # If jpg is chosen for IMAGE_DISP_EXT, this quality setting (1-100)
# will be used when genrerating the images. # will be used when genrerating the images.
# Note: This does (unfortunately) not set the quality when tiles and
# jpg has been chosen.
export IMAGE_DISP_QUALITY="95" export IMAGE_DISP_QUALITY="95"
# The size of thumbnails in folder view.
export THUMB_IMAGE_SIZE="300x200" export THUMB_IMAGE_SIZE="300x200"
# These elements will be grepped from the ALTO-files and shown on the image pages # These elements will be grepped from the ALTO-files and shown on the image pages
ALTO_ELEMENTS="processingDateTime softwareName" ALTO_ELEMENTS="processingDateTime softwareName"
...@@ -82,6 +85,11 @@ SKIP_NEXT_ART=false ...@@ -82,6 +85,11 @@ SKIP_NEXT_ART=false
# is different from the rest of the image. Artifacts from rotations is an example. # is different from the rest of the image. Artifacts from rotations is an example.
# Suggested values are 85-95%. # Suggested values are 85-95%.
CROP_PERCENT="" CROP_PERCENT=""
# If true, tiles are generated for OpenSeadragon. This requires Robert Barta's
# deepzoom (see link in README.md) and will generate a lot of 260x260 pixel tiles.
# If false, a single image will be used with OpenSeadragon. This is a lot heavier
# on the browser but avoids the size and file-count overhead of the tiles.
TILE="false"
# End default settings. User-supplied overrides will be loaded from quack.settings # End default settings. User-supplied overrides will be loaded from quack.settings
pushd `dirname $0` > /dev/null pushd `dirname $0` > /dev/null
...@@ -180,16 +188,18 @@ function makeImageParams() { ...@@ -180,16 +188,18 @@ function makeImageParams() {
WHITE_IMAGE="${DEST_FOLDER}/${BASE}.white.png" WHITE_IMAGE="${DEST_FOLDER}/${BASE}.white.png"
BLACK_IMAGE="${DEST_FOLDER}/${BASE}.black.png" BLACK_IMAGE="${DEST_FOLDER}/${BASE}.black.png"
PRESENTATION_IMAGE="${DEST_FOLDER}/${BASE}.presentation.jpg" PRESENTATION_IMAGE="${DEST_FOLDER}/${BASE}.presentation.jpg"
TILE_FOLDER="${DEST_FOLDER}/${BASE}_files"
} }
# Creates a presentation image and a histogram for the given image # Creates a presentation image and a histogram for the given image
# srcFolder dstFolder image crop presentation_script # srcFolder dstFolder image crop presentation_script tile
function makeImages() { function makeImages() {
local SRC_FOLDER=$1 local SRC_FOLDER=$1
local DEST_FOLDER=$2 local DEST_FOLDER=$2
local IMAGE=$3 local IMAGE=$3
local CROP_PERCENT=$5 local CROP_PERCENT=$5
local PRESENTATION_SCRIPT=$6 local PRESENTATION_SCRIPT=$6
local TILE=$7
# echo "makeImages $SRC_FOLDER $DEST_FOLDER" # echo "makeImages $SRC_FOLDER $DEST_FOLDER"
...@@ -206,12 +216,15 @@ function makeImages() { ...@@ -206,12 +216,15 @@ function makeImages() {
local WHITE_IMAGE="${DEST_FOLDER}/${BASE}.white.png" local WHITE_IMAGE="${DEST_FOLDER}/${BASE}.white.png"
local BLACK_IMAGE="${DEST_FOLDER}/${BASE}.black.png" local BLACK_IMAGE="${DEST_FOLDER}/${BASE}.black.png"
local PRESENTATION_IMAGE="${DEST_FOLDER}/${BASE}.presentation.jpg" local PRESENTATION_IMAGE="${DEST_FOLDER}/${BASE}.presentation.jpg"
local TILE_FOLDER="${DEST_FOLDER}/${BASE}_files"
if [ ! -f $SOURCE_IMAGE ]; then if [ ! -f $SOURCE_IMAGE ]; then
echo "The source image $S does not exists" >&2 echo "The source image $S does not exists" >&2
exit exit
fi fi
# No matter what, we create the full main presentational image as it
# might be requested for download
if [ ! -f $DEST_IMAGE ]; then if [ ! -f $DEST_IMAGE ]; then
echo " - ${DEST_IMAGE##*/}" echo " - ${DEST_IMAGE##*/}"
gm convert "$SOURCE_IMAGE" -quality $IMAGE_DISP_QUALITY "$DEST_IMAGE" gm convert "$SOURCE_IMAGE" -quality $IMAGE_DISP_QUALITY "$DEST_IMAGE"
...@@ -224,6 +237,12 @@ function makeImages() { ...@@ -224,6 +237,12 @@ function makeImages() {
local CONV="$SRC_IMAGE" local CONV="$SRC_IMAGE"
fi fi
if [ ! -d "$TILE_FOLDER" ]; then
echo " - ${TILE_FOLDER##*/} (deepzoom)"
# TODO: Specify JPEG quality
deepzoom "$CONV" -format $IMAGE_DISP_EXT -path "${DEST_FOLDER}/"
fi
if [ ! -f $WHITE_IMAGE ]; then if [ ! -f $WHITE_IMAGE ]; then
echo " - ${WHITE_IMAGE##*/}" echo " - ${WHITE_IMAGE##*/}"
gm convert "$CONV" -black-threshold 255,255,255 -white-threshold 254,254,254 -negate -fill \#FF0000 -opaque black -transparent white -colors 2 "$WHITE_IMAGE" gm convert "$CONV" -black-threshold 255,255,255 -white-threshold 254,254,254 -negate -fill \#FF0000 -opaque black -transparent white -colors 2 "$WHITE_IMAGE"
...@@ -501,6 +520,29 @@ function makePreviewPage() { ...@@ -501,6 +520,29 @@ function makePreviewPage() {
IHTML=`template "$IHTML" "IMAGE" "$EDEST"` IHTML=`template "$IHTML" "IMAGE" "$EDEST"`
IHTML=`template "$IHTML" "IMAGE_WIDTH" "$IMAGE_WIDTH"` IHTML=`template "$IHTML" "IMAGE_WIDTH" "$IMAGE_WIDTH"`
IHTML=`template "$IHTML" "IMAGE_HEIGHT" "$IMAGE_HEIGHT"` IHTML=`template "$IHTML" "IMAGE_HEIGHT" "$IMAGE_HEIGHT"`
if [ "true" == "$TILE" ]; then
TILE_SOURCES=" Image: {\
xmlns: \"http://schemas.microsoft.com/deepzoom/2008\",\
Url: \"${TILE_FOLDER##*/}/\",\
Format: \"$IMAGE_DISP_EXT\",\
Overlap: \"4\",\
TileSize: \"256\",\
Size: {\
Width: \"$IMAGE_WIDTH\",\
Height: \"$IMAGE_HEIGHT\"\
}\
}"$'\n'
else
TILE_SOURCES=" type: 'legacy-image-pyramid',\
levels:[\
{\
url: '${IMAGE}',\
width: ${IMAGE_WIDTH},\
height: ${IMAGE_HEIGHT}\
},\
]"$'\n'
fi
IHTML=`template "$IHTML" "TILE_SOURCES" "$TILE_SOURCES"`
THUMB_LINK=${THUMB_IMAGE##*/} THUMB_LINK=${THUMB_IMAGE##*/}
IHTML=`template "$IHTML" "THUMB" "$THUMB_LINK"` IHTML=`template "$IHTML" "THUMB" "$THUMB_LINK"`
IHTML=`template "$IHTML" "THUMB_WIDTH" "$THUMB_WIDTH"` IHTML=`template "$IHTML" "THUMB_WIDTH" "$THUMB_WIDTH"`
...@@ -533,7 +575,7 @@ function makePreviewPage() { ...@@ -533,7 +575,7 @@ function makePreviewPage() {
} }
# up parent srcFolder dstFolder # Input: up parent srcFolder dstFolder
# #
function makeIndex() { function makeIndex() {
local UP=$1 local UP=$1
...@@ -573,7 +615,7 @@ function makeIndex() { ...@@ -573,7 +615,7 @@ function makeIndex() {
# Generate graphics # Generate graphics
# http://stackoverflow.com/questions/11003418/calling-functions-with-xargs-within-a-bash-script # http://stackoverflow.com/questions/11003418/calling-functions-with-xargs-within-a-bash-script
export -f makeImages export -f makeImages
echo "$IMAGES" | xargs -n 1 -I'{}' -P $THREADS bash -c 'makeImages "$@"' _ "$SRC_FOLDER" "$DEST_FOLDER" "{}" "$THUMB_IMAGE_SIZE" "$CROP_PERCENT" "$PRESENTATION_SCRIPT" \; echo "$IMAGES" | xargs -n 1 -I'{}' -P $THREADS bash -c 'makeImages "$@"' _ "$SRC_FOLDER" "$DEST_FOLDER" "{}" "$THUMB_IMAGE_SIZE" "$CROP_PERCENT" "$PRESENTATION_SCRIPT" "$TILE" \;
# Generate pages # Generate pages
local THUMBS_HTML="" local THUMBS_HTML=""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment