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
c61dcebf
Commit
c61dcebf
authored
11 years ago
by
Toke Eskildsen
Browse files
Options
Downloads
Patches
Plain Diff
Further improvements to optional force regeneration
parent
b3dca271
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
quack.sh
+16
-22
16 additions, 22 deletions
quack.sh
with
16 additions
and
22 deletions
quack.sh
+
16
−
22
View file @
c61dcebf
...
...
@@ -218,18 +218,22 @@ function makeImageParams() {
# If force is true and image does not exist, true is returned
# If force is false and image exists, false is returned
# If force is false and image does not exists, true is returned
# Input: force image
# Output: true/false. Use with 'if should
_g
enerate true dummy; then'
should
_g
enerate
()
{
# Input: force image
designation
# Output: true/false. Use with 'if should
G
enerate true dummy; then'
should
G
enerate
()
{
local
FORCE
=
"
$1
"
local
IMG
=
"
$2
"
local
DES
=
"
$3
"
if
[
"true"
==
"
$FORCE
"
-a
-e
"
$IMG
"
]
;
then
if
[
"
.
true"
==
"
.
$FORCE
"
-a
-e
"
$IMG
"
]
;
then
rm
-rf
"
$IMG
"
fi
if
[
!
-e
"
$IMG
"
-a
"."
!=
".
$DES
"
]
;
then
echo
" -
${
IMG
##*/
}
(
$DES
)"
fi
[
!
-e
"
$IMG
"
]
}
export
-f
should
_g
enerate
export
-f
should
G
enerate
# Creates a presentation image and a histogram for the given image
# srcFolder dstFolder image crop presentation_script tile
...
...
@@ -265,8 +269,7 @@ function makeImages() {
# Even if TILE="true", we create the full main presentational image as it
# might be requested for download
if
should_generate
"
$FORCE_QAIMAGE
"
"
$DEST_IMAGE
"
;
then
echo
" -
${
DEST_IMAGE
##*/
}
"
if
shouldGenerate
"
$FORCE_QAIMAGE
"
"
$DEST_IMAGE
"
"QA"
;
then
gm convert
"
$SOURCE_IMAGE
"
-quality
$IMAGE_DISP_QUALITY
"
$DEST_IMAGE
"
fi
...
...
@@ -277,34 +280,26 @@ function makeImages() {
local
CONV
=
"
$SRC_IMAGE
"
fi
if
should_generate
"
$FORCE_TILES
"
"
$TILE_FOLDER
"
;
then
echo
" -
${
TILE_FOLDER
##*/
}
(deepzoom)"
if
shouldGenerate
"
$FORCE_TILES
"
"
$TILE_FOLDER
"
"tiles"
;
then
# TODO: Specify JPEG quality
deepzoom
"
$CONV
"
-format
$IMAGE_DISP_EXT
-path
"
${
DEST_FOLDER
}
/"
fi
if
should_generate
"
$FORCE_BLOWN
"
"
$WHITE_IMAGE
"
;
then
echo
" -
${
WHITE_IMAGE
##*/
}
"
if
shouldGenerate
"
$FORCE_BLOWN
"
"
$WHITE_IMAGE
"
"overlay"
;
then
gm convert
"
$CONV
"
-black-threshold
255,255,255
-white-threshold
254,254,254
-negate
-fill
\#
FF0000
-opaque
black
-transparent
white
-colors
2
"
$WHITE_IMAGE
"
fi
if
should_generate
"
$FORCE_BLOWN
"
"
$BLACK_IMAGE
"
;
then
echo
" -
${
BLACK_IMAGE
##*/
}
"
if
shouldGenerate
"
$FORCE_BLOWN
"
"
$BLACK_IMAGE
"
"overlay"
;
then
gm convert
"
$CONV
"
-black-threshold
1,1,1
-white-threshold
0,0,0
-fill
\#
0000FF
-opaque
black
-transparent
white
-colors
2
"
$BLACK_IMAGE
"
fi
if
[
"true"
==
"
$FORCE_PRESENTATION
"
-a
-f
"
$PRESENTATION_IMAGE
"
]
;
then
rm
-f
"
$PRESENTATION_IMAGE
"
fi
if
[
!
-f
$PRESENTATION_IMAGE
]
;
then
echo
" -
${
PRESENTATION_IMAGE
##*/
}
"
if
shouldGenerate
"
$FORCE_PRESENTATION
"
"
$PRESENTATION_IMAGE
"
"presentation"
;
then
$PRESENTATION_SCRIPT
"
$CONV
"
"
$PRESENTATION_IMAGE
"
fi
if
should
_g
enerate
"
$FORCE_HISTOGRAM
"
"
$HIST_IMAGE
"
;
then
if
should
G
enerate
"
$FORCE_HISTOGRAM
"
"
$HIST_IMAGE
"
"histogram"
;
then
# Remove "-separate -append" to generate a RGB histogram
# http://www.imagemagick.org/Usage/files/#histogram
echo
" -
${
HIST_IMAGE
##*/
}
"
if
[
"."
==
".
$CROP_PERCENT
"
]
;
then
convert
"
$CONV
"
-separate
-append
-define
histogram:unique-colors
=
false
-write
histogram:mpr:hgram +delete mpr:hgram
-negate
-strip
"
$HIST_IMAGE
"
else
...
...
@@ -312,8 +307,7 @@ function makeImages() {
fi
fi
if
should_generate
"
$FORCE_THUMBNAILS
"
"
$THUMB_IMAGE
"
;
then
echo
" -
${
THUMB_IMAGE
##*/
}
"
if
shouldGenerate
"
$FORCE_THUMBNAILS
"
"
$THUMB_IMAGE
"
"thumbnail"
;
then
gm convert
"
$CONV
"
-sharpen
3
-enhance
-resize
$THUMB_IMAGE_SIZE
"
$THUMB_IMAGE
"
fi
...
...
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