Many historical images, such as census records, and other data image files are much too big for me to view without my Zaurus crashing, so I have written a script that enables me, using command line image tools via ssh to a remote host box, to pick the piece of the file I want to read, called "crop.sh"
.
If you have not already done so, I recommend that you read the companion page to this one, which gives some background and discusses various other ways of modifying images to make them more PDA friendly.
Image cropping with "crop.sh" requires running it on a system which has both ImageMagick's "identify" and "convert" commands from http://www.imagemagick.org/ installed. If you wish to install ImageMagick on your Zaurus, you can read my page about ImageMagick for the Zaurus. However, at this point, I am having difficulty getting "crop.sh" to work properly on my Zaurus, so you can play with it on your Zaurus, but if you want to do any serious cropping, I recommend only using it on a remote system.
So, to use "crop.sh" successfully, you probably will need to ssh into a host box from your Zaurus to process the images on the host before downloading them via scp. "crop.sh" will not crop pdf files, you will need to convert the pdf to another format before processing it with "crop.sh" , and to do this conversion, you can use the persi script discussed on my other page about making images Zaurus friendly.
I have done my best to make "crop.sh" simple to use. You can ask for a half, one third, one fourth, one fifth, or one sixth of the height or width of the image. You also can request a piece from the left side, the center, the right side, or from the top, the middle, or the bottom of the image.
For example, if I want the top fourth of "firstimage.jpg", I would enter the command:
./crop.sh top fourth firstimage.jpg
and it would create a file called "firstimage-top-4th.jpg". I am not going to reproduce the console output here as it shows the progress of the script for debugging purposes, and is quite lengthy. |
|
If I want the left half of "another.tiff",
I would enter the command:
./crop.sh left half another.tiff
and it would create a file called "another-lt-half.tiff".
WARNING: Make your own backup copy of important images. I do not recommend processing irreplaceable image files with the script unless you make a backup first, until you are sure the script handles your chosen options properly. I think I have fixed it, but early versions of the script were accidentally over-writing and essentially erasing the original image file, so beware! I have not built making backup copies into the script as it could, on some systems, magnify the problems of limited memory which it was designed to resolve.
In fact, trying to run it on my sl6000, "crop.sh"
crashes with a Segmentation Fault,
so I think the script is unlikely to ever function properly unless is is run via ssh to a host box. Make sure to make backup copies of important images if you have installed ImageMagick on your Zaurus and decide to play with this script on the Z instead of remotely.
"crop.sh"
requires that the "identify"
and "convert"
commands have already been installed, through ImageMagick, on the host box. I have tested it using the ImageMagick Version:6.2.8 04/05/07 versions of "identify"
and "convert".
More information about these commands can be obtained at
http://www.imagemagick.org/script/convert.php
http://www.imagemagick.org/script/identify.php
You can obtain a copy of the most recent version of "crop.sh"
from http://www.sdjf.esmartdesign.com/files/crop.sh, or get a copy of the first public version here. The newest version adds more built in proportions and has bug fixes, but I am making the earlier version available in case anyone likes it better.
I am only testing combinations of options as I need them, so if you find a combination that does not give you the desired results when running it via ssh, save a copy of all command line and image input and output, and contact me, and I will do my best to fix it.
Here is the usage for "crop.sh,"
as generated by the script when entered without any arguments:
bash# ./crop.sh
ERROR: no arguments given
Usage: crop.sh [location] [amount] file
location: [top|middle|bottom|left|center|right]
amount: [half|third|fourth|fifth|sixth]
file: full filename for input file
bash#
I have also written a companion script called "split"
, which depends on "crop.sh"
and will automatically generate a complete set of horizontal slices of an image if I want to view the whole thing in pieces. At this point, since it was written to view handwritten or typewritten data files, it allows some overlap and will not cut an image into precise halves, thirds, etc.
If you want to get precisely cropped pieces, the percentages defined in "crop.sh"
would need to be hacked. You can obtain a copy of "split"
here.
Usage for "split"
is as follows:
Usage: split [amount] file
amount: [2|3|4|6|half|third|fourth|sixth]
file: full filename for input file
For example, to split "firstimage.tiff
" into four horizontal slices, I would enter the following command:
./split four firstimage.tiff
Again, I need to warn you that crop.sh
was written to be run on a full Linux operating system so the resulting smaller files can be downloaded to your Zaurus. I do not think it will work properly on the Zaurus, especially those with Sharp
and Sharp
compatible ROMs,
at least in part because of the massive memory requirements. But if you need to somehow get cropped images to view on your Zaurus and cannot get your hands on a GUI image editor that does what you need, I have found it an invaluable tool to use via ssh, and hope you will also find it helpful.
Have fun!
sdjf
Revised December 18, 2011