round dpi value correctly

This commit is contained in:
fritz-hh
2014-01-06 22:32:11 +01:00
parent 6a9f38d31e
commit 414c4e3f3c
+3 -2
View File
@@ -79,8 +79,9 @@ getImgInfo() {
colorspaceCurImg=`echo "$propCurImg" | cut -f3 -d" "`
[ $VERBOSITY -ge $LOG_DEBUG ] && echo "Page $page: Size ${heightCurImg}x${widthCurImg} (in pixel)"
# compute the resolution of the image (making the assumption that x & y resolution are equal
dpi=`echo "scale=5;sqrt($widthCurImg*72*$heightCurImg*72/$widthPDF/$heightPDF)" | bc`
# compute the resolution of the image (making the assumption that x & y resolution are equal)
# and round it to the nearest integer
dpi=`echo "scale=5;sqrt($widthCurImg*72*$heightCurImg*72/$widthPDF/$heightPDF)+0.5" | bc`
dpi=`echo "scale=0;$dpi/1" | bc`
# save the image characteristics