sjh - mountain biking running linux vegan geek spice - mtb / vegan / running / linux / canberra / cycling / etc

Steven Hanley hackergotchi picture Steven
Hanley

About

email: sjh@svana.org

web: https://svana.org/sjh
twitter: https://twitter.com/sjhmtb
instagram: https://instagram.com/sjhmtb

Other online diaries:

Aaron Broughton,
Andrew Pollock,
Anthony Towns,
Chris Yeoh,
Martijn van Oosterhout,
Michael Davies,
Michael Still,
Tony Breeds,

Links:

Linux Weekly News,
XKCD,
Girl Genius,
Planet Linux Australia,
Bilbys,
CORC,

Canberra Weather: forecast, radar.

Subscribe: rss, rss2.0, atom

July
Mon Tue Wed Thu Fri Sat Sun
       
25

2005
Months
Jul

Categories:

Archive by month:

Mon, 25 Jul 2005

Monday night inner tube blogging. - 22:19

Fixed tubes (full size)
I guess one of the things that can get on your nerves from time time is fixing inner tubes. Sure you can get 5 tubes (road or mtb) for AUD $20 from Kerry so it almost seems not worth the time to fix them. However unless they are trashed beyond repair I feel wasteful if I do not reuse inner tubes to death.

The photo is of 5 of them, post repair I fixed them up on Friday, left them in my office over the weekend and they were all still inflated them. Good to go. Now if only I can get rid of this cold and get back out on the bike I will be much happier.

I suppose I would be much happier also if I did not have three mtb tyres in the shed with huge holes from sidewall failures or sticks lancing through the tread that has made them useless while there is still a lot of tread left on the tyre, ahh well time to buy more tyres I guess, at least the tubes were easily recovered, and I can try sewing up the tyres with sidewall failures and see how they hold up too.

[/mtb] link

Faster exif - 21:57
So I notice Michael is trying to use ImageMagick to extract exif tags and he finds it kind of slow. Strange that, using perl and yet forking processes to learn stuff turns out to be slow. So I had a look through apt-cache search exif perl output and found the libimage-exif-perl library, not native perl, there is c code there to make it go faster, based on the exiftags utility. This is likely however to be a lot faster than forking a process and relying on the implementation in ImageMagick being fast.

I installed the library, had a look around for a photo I was unlikely to have modified at all (and thus would still have all its tags) and found my 2004 Triple Tri photos. Using the following snippet of perl code.

time perl -e 'use Image::EXIF; use Data::Dumper; my $exif = new Image::EXIF \
("img_0869.jpg"); my $all_info = $exif->get_all_info(); print $exif->error ? \
$exif->errstr : Dumper($all_info);'

I get the following output.

$VAR1 = {
          'unknown' => {
                         'Min Focal Length' => 'num 24, val 0x00AD',
                         'Focal Units/mm' => 'num 25, val 0x0020',
                         'Manufacturer Notes' => '942',
                         'Canon Tag1 Unknown' => 'num 06, val 0x0000',
                         'Interoperability IFD Pointer' => '1540',
                         'Comment' => '614',
                         'Canon Tag4 Unknown' => 'num 01, val 0x0000',
                         'Canon Unknown' => '1448',
                         'Flash Activity' => 'num 28, val 0x0000',
                         'Max Focal Length' => 'num 23, val 0x0207',
                         'Autofocus Point' => 'num 14, val 0x0000',
                         'Canon Tag4 Offset' => '1224',
                         'Supported FlashPix Version' => '808464688',
                         'Flash Details' => 'num 29, val 0x0000',
                         'Unknown' => '1600',
                         'Canon Tag1 Offset' => '1116'
                       },
          'other' => {
                       'Vertical Resolution' => '180 dpi',
                       'Canon Tag1 Length' => '92',
                       'White Balance' => 'Auto',
                       'Exif Version' => '2.20',
                       'Resolution Unit' => 'i',
                       'Focal Plane Res Unit' => 'i',
                       'Image Digitized' => '2004:11:20 17:58:35',
                       'Canon Tag4 Length' => '68',
                       'Shutter Speed' => '1/807 sec',
                       'Focal Plane Vert Resolution' => '7741 dpi',
                       'Image Generated' => '2004:11:20 17:58:35',
                       'Bytes of JPEG Data' => '5141',
                       'Metering Mode' => 'Pattern',
                       'Chrominance Comp Positioning' => 'Centered',
                       'Compression Scheme' => 'JPEG Compression (Thumbnail)',
                       'Horizontal Resolution' => '180 dpi',
                       'Image Type' => 'IMG:PowerShot A60 JPEG',
                       'Digital Zoom Ratio' => '1',
                       'Offset to JPEG SOI' => '2036',
                       'Image Compression Mode' => '3',
                       'Digital Zoom' => 'None',
                       'Sequence Number' => '0',
                       'Focal Plane Horiz Resolution' => '7766 dpi',
                       'Flash Bias' => '0 EV',
                       'Base Zoom Resolution' => '1600',
                       'Meaning of Each Comp' => 'Unknown',
                       'Self-Timer Length' => '0 sec',
                       'Zoomed Resolution' => '1600',
                       'File Source' => 'Digital Still Camera',
                       'Owner Name' => '',
                       'Exif IFD Pointer' => '196'
                     },
          'camera' => {
                        'Firmware Version' => 'Firmware Version 1.00',
                        'Camera Model' => 'Canon PowerShot A60',
                        'Equipment Make' => 'Canon',
                        'Lens Size' => '5.41 - 16.22 mm',
                        'Maximum Lens Aperture' => 'f/2.8',
                        'Sensing Method' => 'One-Chip Color Area'
                      },
          'image' => {
                       'Vertical Resolution' => '180 dpi',
                       'White Balance' => 'Auto',
                       'Contrast' => 'Normal',
                       'Rendering' => 'Normal',
                       'Compression Setting' => 'Fine',
                       'Image Height' => '1200',
                       'Image Orientation' => 'Top, Left-Hand',
                       'Color Space Information' => 'sRGB',
                       'Macro Mode' => 'Normal',
                       'Focus Mode' => 'Single',
                       'Exposure Mode' => 'Easy Shooting',
                       'Exposure Time' => '1/800 sec',
                       'F-Number' => 'f/2.8',
                       'ISO Speed Rating' => 'Auto',
                       'Image Width' => '1600',
                       'Scene Capture Type' => 'Standard',
                       'Image Size' => 'Large',
                       'Drive Mode' => 'Single',
                       'Lens Aperture' => 'f/2.8',
                       'Sharpness' => 'Normal',
                       'Metering Mode' => 'Evaluative',
                       'Horizontal Resolution' => '180 dpi',
                       'Shooting Mode' => 'Full Auto',
                       'Image Number' => '108-0869',
                       'Saturation' => 'Normal',
                       'Flash' => 'No Flash, Auto',
                       'Image Created' => '2004:11:20 17:58:35',
                       'Focus Type' => 'Auto',
                       'Flash Mode' => 'Red-Eye Reduction (Auto)',
                       'Focal Length' => '5.41 mm',
                       'Exposure Bias' => '0 EV',
                       'Subject Distance' => '2.720 m'
                     }
        };

real    0m0.068s
user    0m0.034s
sys     0m0.002s

All this, including the time to load the libraries (Data::Dumper and Image::EXIF), the perl interpreter, the image file from disk. Executing on my 1.4 GHz laptop. Admittedly that was the second time I ran the code snippet, though I used a different image filename, so the libraries and interpreter were likely already hot in memory, it may blow out to all of 0.1 of a second if it has to do all that.

Use native perl and available libraries to make things fast, it makes a lot of sense. It seems I often think of the perl bridge building quote in this sort of situation. Of course it kind of sucks if you are trying to write a book about using ImageMagick and find you have to use other tools because it is not as fast as you want or something.

I notice Brad (the guy who started livejournal) often gets heavily into making perl go fast, worth reading sometimes just to make you think about what he is doing.

[/comp/software] link


home, email, rss, rss2.0, atom