tiff-batch-convert: quality is now an argument
This commit is contained in:
parent
d9fd78cdee
commit
b8619f8d0b
|
@ -28,7 +28,12 @@ smartphone.
|
||||||
|
|
||||||
Usage:
|
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
|
`<DESTINATION>` is the base directory in which the converted albums will be
|
||||||
stored; each album will be in a separate sub-folder
|
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:
|
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`.
|
- Input files must have the extention `.tiff` (lowercase), not `.tif`.
|
||||||
- The albums provided on the command-line must contain TIFF images directly;
|
- The albums provided on the command-line must contain TIFF images directly;
|
||||||
sub-folders won't be searched.
|
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
|
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
|
original albums are stored in different places. It is easy to modify this
|
||||||
behaviour in the script if needed.
|
behaviour in the script if needed.
|
||||||
- To change the quality settings or the output format, you will have to edit
|
- To change the output format or the size of the generated pictures (for "low"
|
||||||
the script (see the `USER CONFIGURATION` section of the script).
|
and "medium" quality settings), you will have to edit the script (see the
|
||||||
|
"USER CONFIGURATION" section of the script).
|
||||||
|
|
||||||
Dependencies:
|
Dependencies:
|
||||||
|
|
||||||
|
|
|
@ -24,11 +24,6 @@ set -e
|
||||||
# Format to convert the TIFF images to (lowercase)
|
# Format to convert the TIFF images to (lowercase)
|
||||||
FORMAT="jpg"
|
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.
|
# Maximum size of the pictures for the "low" quality setting.
|
||||||
LOW_SCALE="800x800"
|
LOW_SCALE="800x800"
|
||||||
|
|
||||||
|
@ -39,6 +34,22 @@ MEDIUM_SCALE="2000x2000"
|
||||||
# END OF USER CONFIGURATION #
|
# 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?
|
# Should the pictures be resized, depending on the quality setting?
|
||||||
if [ "$QUALITY" = "low" ] ; then
|
if [ "$QUALITY" = "low" ] ; then
|
||||||
SCALE_OPT="-scale $LOW_SCALE"
|
SCALE_OPT="-scale $LOW_SCALE"
|
||||||
|
@ -52,18 +63,6 @@ else
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
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
|
# Convert the pictures
|
||||||
while [ $# -gt 0 ] ; do
|
while [ $# -gt 0 ] ; do
|
||||||
ALBUM="$1"
|
ALBUM="$1"
|
||||||
|
|
Loading…
Reference in New Issue