Autorotation of Pictures

Raptylos

Joined: 2004-05-01
Posts: 3
Posted: Fri, 2004-10-15 18:22

Hello fellows !

I'm missing the autorotation which was possible in G1. Is there a possibility to autorotate uploaded pics based on the exif-data ?

Best regards, Raptylos

P.s. I'm using g2Alpha3

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7985
Posted: Sat, 2004-10-16 22:48

It would be an easy thing to add to the EXIF module. Anybody interested in working on it?

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Sun, 2004-10-17 17:47

I added a task for this.

 
Raptylos

Joined: 2004-05-01
Posts: 3
Posted: Mon, 2004-10-18 14:03

Thank you for your quick reply, i'm very pleased !

Go on like this !

 
fryfrog

Joined: 2002-10-30
Posts: 3236
Posted: Tue, 2004-10-19 02:13

Btw, how exactly does the auto-rotate work? Does the camera have to have an orientation type sensor in it that can tell when its upside down or sideways?

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7985
Posted: Tue, 2004-10-19 06:59

Yes, that's exactly how it works.

 
jmullan
jmullan's picture

Joined: 2002-07-28
Posts: 974
Posted: Tue, 2004-10-19 15:55

Most cameras also have a feature where you can rotate the image in the camera - this just sets an exif tag.

 
treksler

Joined: 2004-10-18
Posts: 8
Posted: Tue, 2004-10-19 22:09

I just use a script to auto rotate b4 uploading
i am sure G2 could do something similar on the fly
(btw i have a canon camera, may not work for others)

#!/bin/bash
for e in "$@" ; do
# image size
imgsize=$(identify $e | tr ' ' '\n' | grep x) ;
imgx=$(echo $imgsize| cut -f1 -dx)
imgy=$(echo $imgsize| cut -f2 -dx|cut -f1 -d+)
# correct orientation
imgcorrectorient=$(exif $e | grep Orientation | cut -f2 -d'|' | cut -f2 -d-)
if echo $imgcorrectorient | grep -qs top ; then
imgcorrectorient="portrait"
else
imgcorrectorient="landscape"
fi
# current orientation
if [ $imgx -lt $imgy ] ; then
imgcurrentorient="portrait"
else
imgcurrentorient="landscape"
fi
# compare orientations
if [ "$imgcorrectorient" != "$imgcurrentorient" ] ; then
echo "Rotating $e 90 degrees"
jhead -cmd 'jpegtran -rotate 90 -outfile &o &i' "$e"
else
echo "Not rotating $e"
fi
done

 
trungie

Joined: 2004-08-24
Posts: 15
Posted: Mon, 2004-11-01 01:34

cool script! in bash too! :B

WD!

 
psjoberg

Joined: 2005-03-27
Posts: 1
Posted: Mon, 2005-03-28 00:19

That script looks a but complicated to me

   find photos  -name "*[jJpPgG]" -name "*[jJpeEPgG]" -exec jhead -autorot {} \;

or just

   jhead  -autorot *jpg

works fine also. You can fancy it up with [jJpPgG]

/ps

 
gabb

Joined: 2005-05-24
Posts: 2
Posted: Tue, 2005-05-24 20:49

I am a new gallery2 user. I have been using a different gallery software before (Apache::Gallery)

I haven't figured if autorotate is not implemented in g2 or if I don't know how to use it but for me I don't want to spend 30 minutes whenever I am uploading an album just going trough the whole thing and rotate the pictures manually nor I don't want to run scripts to do that. I haven't manually rotated a picture in more than 2 years, both my cameras where working fine with the other software.

can somebody please bring a light on this "autorotate" feature that is important for me ?

thanks allot !

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Tue, 2005-05-24 21:07

From Oct 2004:

bharat wrote:
It would be an easy thing to add to the EXIF module. Anybody interested in working on it?

 
maggard
maggard's picture

Joined: 2004-12-01
Posts: 24
Posted: Thu, 2005-05-26 18:24
gabb wrote:
can somebody please bring a light on this "autorotate" feature that is important for me ?

First Gabb, you did notice that G2 is *beta* software? If something is "important" to you then you're using the wrong tool, consider a stable version of Gallery 1.5 (which does offer autorotate).

Second it's pretty darn trivial to test if autorotation is working for you. Upload a picture that is displayed sideways but has an internal EXIF tag indicating otherwise. If G2 autorotates it for you it's working, if not then it isn't. This should require under a minute of effort on your part to help yourself out.

Finally it's quite simple to assure that all of your photos are pre-rotated correctly, before sending them to Gallery. You can even use the tools in this thread once to forevermore make the issue moot.

 
gabb

Joined: 2005-05-24
Posts: 2
Posted: Wed, 2005-06-01 00:03

hi maggarar,

I know this is beta software and I don't mind that. More people using it and we will end up with a better final version. The reason I wrote my previous posting was that I got a bit confused about this feature being in the old 1.5 version and not being in the v2 beta and I thought there must be some option I didn't see. I then read about the whole thing being rewritten from the ground up and it makes sense to me now. In any case since almost all newer cameras have this orientation sensor it would be nice to use it.

Anyway sorry if my initial message sounded rude or offended anybody

 
richlv

Joined: 2004-07-02
Posts: 20
Posted: Tue, 2005-08-30 13:21

gabb, as it was already told, there is a very effective method to automatically rotate all photos in a directory :
jhead -autorot *.jpg

if you have subdirectories, it's just a matter of wrapping it in find (check previous posts)

in sf task bharat mentions that it is a requirement for final release - will this functionality be in final g2 release ?

what are the chances that this functionality would allow to automaticaly rotate already added images (for example, for chosen album and all subalbums etc) ?

even though i try to use jhead's autorotating functionality, there are some collections that i have forgotten to do this or some older pictures that were not autorotated (and written to cds), so i either have to copy them to hdd, autorotate, add to gallery, or, hopefully, just add them and wait for an ability to automatically rotate them all in gallery ;)

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Tue, 2005-08-30 15:54

no one has developed this feature, so doesn't look like it will be in 2.0.

 
KnightShade

Joined: 2004-03-22
Posts: 13
Posted: Thu, 2005-09-08 13:15

mindless - that is disappointing.

This brings up a question - is there a document that compares the features of 1.5 and 2.0 and shows what other features have not (yet) been implemented in 2.0? (As well as what features are new.)

I would think that such a document would be useful for those that are considering upgrading. Better to have them informed prior to the upgrade than needing to back out after the fact if some feature they require is missing...

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Thu, 2005-09-08 23:47

no one has written such a document, so we don't have one :P
i agree such a doc would be nice, but you migrate G1 data to G2, you don't upgrade G1.. so to back out you just delete your G2.

Edit: ok, I started it.. please contribute: http://codex.gallery2.org/index.php/G1-G2_Comparison

 
richlv

Joined: 2004-07-02
Posts: 20
Posted: Tue, 2005-09-13 11:03

too bad this feature didn't make it into final g2...
if i had some understanding of programming, i would try to implement it myself :)

basically we need to hook something that would rotate images accordingly to exif information (easiest way - use jhed, probably more elegant and easier on server resources - extract rotation information from exif and use it in imagemgaick/netpbm command - easier on server because graphics toolkit will be used anyway - or maybe not ?)

then there should be an option that should be honoured with as little overhead as possible to not rotate images.

i can't think of any other needed functionality, is there any ?

sounds simple enough, probably because i have very little idea how it could be really done ;)