Convert jpg to png
This commit is contained in:
parent
5cd389fe70
commit
278f091aa2
15
xkcdlock
15
xkcdlock
@ -23,7 +23,6 @@
|
||||
#
|
||||
# TODO:
|
||||
# - Make sure we do not exceed screen boundaries in x and y
|
||||
# - Convert non-png to png
|
||||
# - Improve tooltip text border overflow prevention
|
||||
# wrt display resolution (and font size?)
|
||||
# - Add support for other screen lockers
|
||||
@ -164,11 +163,15 @@ xkcd_get_all_images() {
|
||||
continue
|
||||
fi
|
||||
|
||||
log "Downloading ${i} ${img_url_hotlink} (${img_name})"
|
||||
log "Downloading #${i} ${img_url_hotlink} (${img_name})"
|
||||
$(curl -s $img_url_hotlink -o $img_name)
|
||||
if (( 0 != "$?" )); then
|
||||
error "Failed to download ${i}"
|
||||
fi
|
||||
|
||||
if [ "${img_name: -3}" == "jpg" ]; then
|
||||
convert_image $img_name
|
||||
fi
|
||||
done
|
||||
|
||||
echo 0
|
||||
@ -231,6 +234,14 @@ get_random_image() {
|
||||
echo "$img_fn"
|
||||
}
|
||||
|
||||
convert_image() {
|
||||
local img_name_len=$((${#img_name} - 4))
|
||||
local img_name_png=${img_name:0:$img_name_len}".png"
|
||||
log "Converting $img_name to $img_name_png"
|
||||
$(convert $img_name $img_name_png)
|
||||
$(rm -f $img_name)
|
||||
}
|
||||
|
||||
image_add_text() {
|
||||
local tmp_file=$(mktemp)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user