Image orientation using g-Thumb
Nio Wiklund
nio.wiklund at gmail.com
Tue Feb 3 13:58:53 UTC 2015
Den 2015-02-03 14:08, Andre Rodovalho skrev:
> On 14.04 (gPicView) does not work properly to rotate. It does rotate,
> but does not save (It crashes if I remember well...)
>
> I use Fotoxx for this purpose. There is also some functions to rotate
> several images automatically (for images with special tag, e.g. photos
> taken from cellphone).
>
>
>
> 2015-02-03 7:29 GMT-02:00 Steven Duckworth <literati69 at gmail.com
> <mailto:literati69 at gmail.com>>:
>
> Dear Lubuntu users,
>
> Perhaps some of you have come across the problem of the orientation
> of images stored using gThumb.
> If I use "Tools" and "rotate right/left" to make the image vertical,
> it then appears vertical, but it still uploads (using Firefox) in
> the sideways (horizontal) position (but not always).
>
> Should I be storing the pics in a special "Pictures" file, rather
> than uploading them directly from gThumb?
> These are images taken from my LG cellphone.
>
> Thanks in advance,
> Steve
>
>
> --
> Lubuntu-users mailing list
> Lubuntu-users at lists.ubuntu.com <mailto:Lubuntu-users at lists.ubuntu.com>
> Modify settings or unsubscribe at:
> https://lists.ubuntu.com/mailman/listinfo/lubuntu-users
>
>
>
>
Hi Steven,
Some tools and or cameras make non-standard tricks for rotation. Some
tools can rotate loss-less, some do it lossy. If a jpeg picture's width
and height can be divided by 16 (without any remainder), jhead can be
used for lossless rotation. Some years ago I made the script
autorot
for auto rotation, which uses jhead (and when it cannot be used,
imagemagick convert for lossy rotation). I'll attach the script file.
Try it with some copies (not on the original files) until you know that
it works with the pictures from your camera.
Calling autorot from a command line or another script I can recurse over
a directory tree to 'fix' the rotation of all the picture files in that
directory tree.
I would be happy if you can use it or use some of the idea behind it :-)
Best regards
Nio
-------------- next part --------------
#!/bin/bash
if [ "$1" == "" ]
then
echo "Usage: $0 <jpeg-file> [lossy]"
echo "Auto-rotate *lossless* with jhead,"
echo "or optionally, if bad image dimensions,"
echo "auto-orient *lossy* with convert"
exit
fi
typeset name=$(echo "$1"|sed "s/\..*//")
if [ "$1" == "$name".jpg ] || [ "$1" == "$name".JPG ]
then
echo hej>/dev/null
else
echo "Bad! $1 not a jpeg-file"
exit
fi
typeset dimkonica=2112x2816
typeset dimcanon=3264x2448
typeset dim=$(identify -ping "$1"|sed -e s/.*JPEG\ // -e s/\ .*//)
typeset gw0=$(echo "$dim"|sed s/x.*//)
typeset gw1=$((gw0/16*16))
typeset gh0=$(echo "$dim"|sed s/.*x//)
typeset gh1=$((gh0/16*16))
if [ "$dim" == "$dimkonica" ] || [ "$dim" == "$dimcanon" ]
then
echo "jhead: Original dimension for jhead: $1: $dim"
jhead -autorot "$1"
else
if [ "$gw0" == "$gw1" ] && [ "$gh0" == "$gh1" ]
then
echo "jhead: Good dimension for jhead: $1: $gw0"x"$gh0"
jhead -autorot "$1"
else
if [ "$2" == "lossy" ]
then
echo "convert: Bad dimension for jhead: $1: $dim"
while [ "$ans" != "yes" ] && [ "$ans" != "n" ] && [ "$ans" != "no" ]
do
echo -n "make a lossy rotation the image? (yes/no) "
read ans
if [ "$ans" == "yes" ]
then
echo Converted: original saved, rotated copy named "$name"_r.jpg
convert -auto-orient "$1" "$name"_r.jpg
fi
done
else
echo "Bad dimension for jhead: $1: $dim"
fi
fi
fi
More information about the Lubuntu-users
mailing list