tiff-batch-convert: quality is now an argument
Этот коммит содержится в:
родитель
d9fd78cdee
Коммит
b8619f8d0b
|
@ -28,7 +28,12 @@ smartphone.
|
|||
|
||||
Usage:
|
||||
|
||||
tiff-batch-convert.sh <DESTINATION> <ALBUM1> [ALBUM2 [...]]
|
||||
tiff-batch-convert.sh <QUALITY> <DESTINATION> <ALBUM1> [ALBUM2 [...]]
|
||||
|
||||
<QUALITY> impacts the resolution of the converted pictures; it can be "low",
|
||||
"medium" or "high". Use "high" for no rescaling. The actual size of the
|
||||
pictures for "low" and "medium" is hard-coded in the script (see "Limitations
|
||||
and bugs" below).
|
||||
|
||||
`<DESTINATION>` is the base directory in which the converted albums will be
|
||||
stored; each album will be in a separate sub-folder
|
||||
|
@ -41,7 +46,7 @@ For example, this will convert every album under
|
|||
|
||||
Limitations and bugs:
|
||||
|
||||
- Existing destination files will be **OVERWRITEN WITHOUT WARNING**!
|
||||
- Existing destination files will be **OVERWRITTEN WITHOUT WARNING**!
|
||||
- Input files must have the extention `.tiff` (lowercase), not `.tif`.
|
||||
- The albums provided on the command-line must contain TIFF images directly;
|
||||
sub-folders won't be searched.
|
||||
|
@ -49,8 +54,9 @@ Limitations and bugs:
|
|||
album will be generated as a subfolder of `<DESTINATION>`, even if the
|
||||
original albums are stored in different places. It is easy to modify this
|
||||
behaviour in the script if needed.
|
||||
- To change the quality settings or the output format, you will have to edit
|
||||
the script (see the `USER CONFIGURATION` section of the script).
|
||||
- To change the output format or the size of the generated pictures (for "low"
|
||||
and "medium" quality settings), you will have to edit the script (see the
|
||||
"USER CONFIGURATION" section of the script).
|
||||
|
||||
Dependencies:
|
||||
|
||||
|
|
|
@ -24,11 +24,6 @@ set -e
|
|||
# Format to convert the TIFF images to (lowercase)
|
||||
FORMAT="jpg"
|
||||
|
||||
# Resolution of the converted pictures: low, medium or high.
|
||||
# Use "high" for no rescaling. The actual size of the pictures for "low" and
|
||||
# "medium" depends on the next two options below.
|
||||
QUALITY="medium"
|
||||
|
||||
# Maximum size of the pictures for the "low" quality setting.
|
||||
LOW_SCALE="800x800"
|
||||
|
||||
|
@ -39,6 +34,22 @@ MEDIUM_SCALE="2000x2000"
|
|||
# END OF USER CONFIGURATION #
|
||||
#############################
|
||||
|
||||
# Do we have at least a quality setting, an input album and a destination
|
||||
# folder?
|
||||
if [ $# -lt 3 ] ; then
|
||||
echo "Usage:" >&2
|
||||
echo " $0 <QUALITY> <DESTINATION> <ALBUM1> [ALBUM2 [...]]" >&2
|
||||
echo '<QUALITY> can be "high" (no rescaling), "medium" or "low".' >&2
|
||||
echo '<DESTINATION> is the base directory in which the converted albums will be stored.' >&2
|
||||
echo 'Each <ALBUM> is a directory containing TIFF files.' >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
QUALITY="$1"
|
||||
shift
|
||||
ALBUM_DEST="$1"
|
||||
shift
|
||||
|
||||
# Should the pictures be resized, depending on the quality setting?
|
||||
if [ "$QUALITY" = "low" ] ; then
|
||||
SCALE_OPT="-scale $LOW_SCALE"
|
||||
|
@ -52,18 +63,6 @@ else
|
|||
exit 1
|
||||
fi
|
||||
|
||||
# Do we have at least an input album and a destination folder?
|
||||
if [ $# -lt 2 ] ; then
|
||||
echo "Usage:" >&2
|
||||
echo " $0 <DESTINATION> <ALBUM1> [ALBUM2 [...]]" >&2
|
||||
echo "DESTINATION is the base directory in which the converted albums will be stored." >&2
|
||||
echo "Each ALBUM is a directory containing TIFF files." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ALBUM_DEST="$1"
|
||||
shift
|
||||
|
||||
# Convert the pictures
|
||||
while [ $# -gt 0 ] ; do
|
||||
ALBUM="$1"
|
||||
|
|
Загрузка…
Ссылка в новой задаче