jpegtran lossless rotation module -- please test

mattdm

Joined: 2005-07-22
Posts: 181
Posted: Tue, 2006-09-26 04:01

Tada: at http://mattdm.org/misc/galleryhacks/, you will find jpegtran.tar.gz, a first cut at a module to do rotations without reencoding your jpegs.

Note that this does alter the file slightly, even if you do four 90 degree rotations to get back to your original. So you still may want to use the "don't alter originals" option. However, there will be no additional jpeg artifacts introduced -- the existing compression is simply rotated too. (This is not necessarily the case using ImageMagick or Netpbm.)

It should default to top priority by default, but double check.

Please let me know any bugs -- I put this together in about 2 hours by looking at code in the dcraw, imagemagick, and netpbm modules.

And, what's the next step towards getting this included in Gallery itself? This is feature request 1368463, by the way.

Edit by fryfrog: I've attached the module file, just in case.

AttachmentSize
jpegtran-0.0.1.tar_.gz6.52 KB
jpegtran-0.0.2.tar_.gz6.61 KB
 
mattdm

Joined: 2005-07-22
Posts: 181
Posted: Tue, 2006-09-26 11:59

Well, that's great; my server is temporarily down. Will restore as soon as I can.

 
fryfrog

Joined: 2002-10-30
Posts: 3236
Posted: Tue, 2006-09-26 13:23

Looks like valiant had some comments for you in your original thread. Also, I'll be giving your module a test as soon as I can.

I just want to also add that I hope you can meet the (tough) G2 coding standards cause this would be a fantastic addition to G2. It is so good, that I think I am going to have to make sure it is in the G1 vs. G2 comparison, with a Yes for G1 and No for G2 (currently).
_________________________________
Support & Documentation || Donate to Gallery || My Website

 
mattdm

Joined: 2005-07-22
Posts: 181
Posted: Tue, 2006-09-26 14:05

(Server is back up. Sorry about that.)

 
fryfrog

Joined: 2002-10-30
Posts: 3236
Posted: Tue, 2006-09-26 14:32

I grabbed your module and am trying to get it working. First of all, it doesn't like my jpegtran. When I hit save or test, I end up with these php errors at the top of my page. For information, I am using current svn (revision 14602). What did you develop this against?

Quote:
Warning: array_merge() [function.array-merge]: Argument #1 is not an array in /var/www/fryfrog.com/htdocs/gallery2/modules/jpegtran/classes/JpegtranToolkitHelper.class on line 86

Warning: Invalid argument supplied for foreach() in /var/www/fryfrog.com/htdocs/gallery2/modules/core/classes/GalleryPlatform/UnixPlatform.class on line 63

When I do the test, I get the below results

Quote:
Binary Name Pass/Fail
jpegtran
Failed
Error messages:

Output from binary:

0

And here is the debug output

Quote:
is_file(/usr/bin/jpegtran)
Loading plugin jpegtran
jpegtran plugin successfully instantiated
getParameter exec.beNice for core plugin
Executing: (nice ) 2>/var/www/fryfrog.com/g2data/tmp/g2dbgqUR9oL
getParameter exec.expectedStatus for core plugin
file_exists(/var/www/fryfrog.com/g2data/tmp/g2dbgqUR9oL)
filesize(/var/www/fryfrog.com/g2data/tmp/g2dbgqUR9oL)
unlink(/var/www/fryfrog.com/g2data/tmp/g2dbgqUR9oL)
Regular Output:
Error Output:
Status: 0 (expected 0)

And here is the version info for jpegtran

Quote:
Independent JPEG Group's JPEGTRAN, version 6b 27-Mar-1998
Copyright (C) 1998, Thomas G. Lane

_________________________________
Support & Documentation || Donate to Gallery || My Website

 
mattdm

Joined: 2005-07-22
Posts: 181
Posted: Tue, 2006-09-26 14:43
fryfrog wrote:
Warning: array_merge() [function.array-merge]: Argument #1 is not an array in /var/www/fryfrog.com/htdocs/gallery2/modules/jpegtran/classes/JpegtranToolkitHelper.class on line 86

Warning: Invalid argument supplied for foreach() in /var/www/fryfrog.com/htdocs/gallery2/modules/core/classes/GalleryPlatform/UnixPlatform.class on line 63

This is apparently a PHP5 vs. PHP4 issue. I'll fix.

 
mattdm

Joined: 2005-07-22
Posts: 181
Posted: Tue, 2006-09-26 14:54

Okay, try the 0.0.2 version (again at http://mattdm.org/misc/galleryhacks/). Sorry about that. As mentioned before, not a PHP coder. :)

 
fryfrog

Joined: 2002-10-30
Posts: 3236
Posted: Tue, 2006-09-26 14:57

Thanks, your change fixed it all up and it installs and detects jpegtran just fine.

I've not actually *used* it yet, but it's a good start eh? :)
_________________________________
Support & Documentation || Donate to Gallery || My Website

 
fryfrog

Joined: 2002-10-30
Posts: 3236
Posted: Tue, 2006-09-26 15:04

Did you happen to include the "-copy all" option yet? It seems that perhaps w/o this, people could lose their exif info.
_________________________________
Support & Documentation || Donate to Gallery || My Website

 
mattdm

Joined: 2005-07-22
Posts: 181
Posted: Tue, 2006-09-26 16:51

Yeah, I'd actually already included that in the first version.

 
kwanbis

Joined: 2006-11-08
Posts: 22
Posted: Thu, 2006-11-30 21:35

sorry, how do i install it?

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Sat, 2006-12-02 03:08

either with g2.2 via downloadable plugins (site admin -> plugins -> more plugins).

or download it from this forum topic (but that's an older version and less reliable).

 
etiennesky

Joined: 2005-09-28
Posts: 40
Posted: Thu, 2007-02-15 17:43

How do I manually download the version that's available in the "downloadable plugins" interface?

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Thu, 2007-02-15 18:04

there's no manual download for that version.
either use "downloadable plugins" in g2.2 or use subversion to get the files from the SVN code repository from sf.net/projects/gallery-contrib

--------------
Doumentation: Support / Troubleshooting | Installation, Upgrade, Configuration and Usage

 
etiennesky

Joined: 2005-09-28
Posts: 40
Posted: Thu, 2007-02-15 19:26

I must have missed that module when I checked the gallery-contrib folder. thanks