Spectacular failure of convert

convert is part of ImageMagick package for image manipulation. It does have a lot of features. I use it most of time for post processing photo images.

$ convert --version
Version: ImageMagick 6.7.7-10 2012-07-30 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2012 ImageMagick Studio LLC
Features: OpenMP

I’ve had a lot of fun learning digital photography, especially time lapse photograph that captures long period of events is fascinating.

Yesterday I tested how many photos my Canon camera could take till battery runs out. I set up the interval at one second on SmaTrig remote switch, let the camera shoot images. It took 6555 photos between 18:09 and 21:49. What surprised me was the battery was alive. How could it possible? Only setup change of the camera was to turn completely off LCD screen.

Thousands of photos for touch up to produce a HD 720p video. I’ve been building the tool chain for time lapse video. I’m strongly against using commercial software to do any work. Virtually everything I do in computer is based on Free or Open source software license.

I understand the philosophy of Open Source Software and Hardware movement is to expand and secure freedom of end user and developer. Both parties are free from any legal issues. Honestly conventional software license is second worst business practice in modern economy. The user can’t have ownership of the product he/she buy. What the fuck is that?

Looking at Microsoft’s success is a good example how present society beyond nations is rotten to the core. I heard years ago if any government applies similar reliability policy in automotive industry to software business sector, Microsoft ran out of business decades ago.

Stupid users, companies, and organizations spend huge amount of money periodically. They hopelessly join the band wagon of upgrade scheme to solve serious problems the software companies supposedly fix.

I believe in when human being stuck, stop progressing, or no choice to do what one desire or wish, the life become empty existence. Human is now just organic machine that repeats little more complex tasks given by the system or mindless zombie which eat their own fellows.

Back to the subject.
convert -verbose 'IMG_*.JPG' -brightness-contrast 10,30 -crop 2816x1400+0+480 i%4d.jpg

-verbose: display status
IMG_*.JPG: 6,549 files from IMG_0007.IMG to IMG_6555
-brightness-contrast 10,30: increase brightness to 10, contrast to 30
-crop 2816×1400+0+480: the image resolution is 2816×1880. Remove upper part of image to 480 pixels. I did it to get rid of dull open sky scene from images.
i%4d.jpg: create output JPEG files starting from i0001.jpg to i6549.jpg in sequence.

When I ran above powerful command, it hung up at 2111th file after failing to generate a single JPEG file. What a spectacular failure! convert was trying to create one big memory space to process 6,549 files in one shot. 7G of free system memory out of 8G became full, 9G of free swap memory reduced to 5G. Hard disk reached to 139G out of 141G by thousands of magic-* files in /tmp/ directory.

I finished the image file process running a rudimentary bash script, which is lack of sequencing file name. I dislike exploring bash programming deeper because its informal(?) coding environment. I’m trying to get comfortable with Python programming again. Next conversion script will be a python script.

$ ~/bin/run-convert
#!/bin/sh

for f in "$@";
do
echo $f
# ifile=$(basename "$f")
ofile=r_"${f%.*}".jpg
echo $ofile
# convert -verbose $f -brightness-contrast 10,30 -crop 2816x1400+0+480 $ofile
convert -verbose $f -resize 1280x720 $ofile
done

I use feh to view image files.
$ feh -F -d [files]

To create MP4 video displaying each image for half second (-r 1/0.5).

$ cat *.jpg | ffmpeg -f image2pipe -r 1/0.5 -vcodec mjpeg -i – -vcodec libx264
scenes4.mp4

About janpenguin

Email: janpenguin [at] riseup [dot] net Every content on the blog is made by Free and Open Source Software in GNU/Linux.
This entry was posted in GNU/Linux, Photography and tagged , , , , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s