Page 2 of 2

Re: Getting started with Fred's Scripts

Posted: 2012-06-24T13:20:04-07:00
by PaulAThompson
You make good points. I am trying to stay within the Fred's script area because his scripts seem to be designed to already do some functionality that I need.

Re: Getting started with Fred's Scripts

Posted: 2012-06-24T13:35:15-07:00
by PaulAThompson
You have a very good suggestion. I went and looked at the IM usage page and right there, immediately, a simple command to do what I want with less complexity. Thanks.

Re: Getting started with Fred's Scripts

Posted: 2012-06-24T14:25:15-07:00
by fmw42
PaulAThompson wrote:Fred:

I hacked the autolabel script to optionally position the text at a point of the user's desire. If you were interested, I could send you my modified script.
As user Bonzo says, the purpose of autolabel and autocaption was to find the first location that it would fit. If you want to specify location directly, then just use IM text creation commands such as -annotate or -draw. see

http://www.imagemagick.org/Usage/text/#draw
http://www.imagemagick.org/Usage/text/#annotate

You may also want to try autocaption if you want multiple lines

Re: Getting started with Fred's Scripts

Posted: 2012-06-24T16:40:58-07:00
by PaulAThompson
Thanks, Fred. I am doing that.

I am starting a large project. I have a bunch of family photos (stop me if you've heard this before), and wish to put them into good order.

1) What's the best format to convert .jpg photos into? It looks like .png would be a good choice.
2) Is there a good discussion somewhere about standardizing the image sizes? These come in many different sizes, making the captions that I am applying (I am using montage for the moment) to have a variety of effective font size to photo.

Re: Getting started with Fred's Scripts

Posted: 2012-06-24T16:50:02-07:00
by anthony
PaulAThompson wrote:OK, success!

I replaced
dir="/tmp"
with
dir="."
Typically temporary files is stored in either the directory specified by a TMPDIR environment variable (typically set in your .profile) or if unset "/tmp". The above script should be modified to use something like...

Code: Select all

  dir="${TMPDIR:-/tmp}"
Which says, use $TMPDIR, unless undefined in which case use "/tmp".

I myself like to use the following snippet of code...

Single Temporary File...

Code: Select all

umask 77
tmp=`mktemp "${TMPDIR:-/tmp}/$PROGNAME.XXXXXXXXXX"` ||
  { echo >&2 "$PROGNAME: Unable to create temporary file"; exit 10;}
trap 'rm -f "$tmp"' 0
trap 'exit 2' 1 2 3 15
Then use "$tmp". For example

Code: Select all

  command > "$tmp"
OR

Multiple Files (directory)...

Code: Select all

tmpdir=`mktemp -d "${TMPDIR:-/tmp}/$PROGNAME.XXXXXXXXXX"` ||
  { echo >&2 "$PROGNAME: Unable to create temporary directory"; exit 1;}
trap 'rm -rf "$tmpdir"' 0   # remove when finished (on end or exit)
trap 'exit 2' 1 2 3 15      # terminate script on signal (don't just die)
and wr8ite to any filename in "$tmpdir"
For example

Code: Select all

  command > "$tmpdir/A"
These code segments iar designed (using "trap" commands" to auto-cleanup any temporary files when the script exists.

Hmmm sorry rambling, and this is not imagemagick stuff, just shell scripting.

Re: Getting started with Fred's Scripts

Posted: 2012-06-24T17:09:50-07:00
by anthony
PaulAThompson wrote:1) What's the best format to convert .jpg photos into? It looks like .png would be a good choice.
For Export...
JPG for export to web or final image storage (keep a copy of the original)
PNG good general purpose non-lossy image format that is well understood.
GIF old lossy format but good for small 'icon' or cartoon like images, thumbnails, and line drawings

For Working Images...
MIFF the internal IM image file format (uncompressed). Good for temporary images between IM commands, templates, masks or image libraries.
MPC temporary image 'memory dump' for FAST re-reading of images (just paged into memory without parsing). Especially suitable for RAMDISK temporary files. Only use within a single script run as it only works for the current compilation of IM. Creates two files, so watch the temporary file cleanup
2) Is there a good discussion somewhere about standardizing the image sizes? These come in many different sizes, making the captions that I am applying (I am using montage for the moment) to have a variety of effective font size to photo.
No standards.
  • Images the size of common computer displays are are used: Wikipedia: Display Resolution EG: 800x600, 1600x1200, 1280x1024....
  • Images with aspect ratios of 4:3 are now very common,. For example: 800x600
  • This is especially the case from digital cameras. My own camera (now getting dated) is: 3264x2448
  • Square images (typically for image processing test images) tend to be a power of 2; EG: 512x512
    though 100x100 is also common for image examples.
  • For thumbnails I tend to like a standard height of 90 (so they for neat rows in web pages), so my thumbnail images tend to be sized: 120x90

Re: Getting started with Fred's Scripts

Posted: 2012-06-24T17:20:31-07:00
by fmw42
PaulAThompson wrote:Thanks, Fred. I am doing that.

I am starting a large project. I have a bunch of family photos (stop me if you've heard this before), and wish to put them into good order.

1) What's the best format to convert .jpg photos into? It looks like .png would be a good choice.
2) Is there a good discussion somewhere about standardizing the image sizes? These come in many different sizes, making the captions that I am applying (I am using montage for the moment) to have a variety of effective font size to photo.
JPG is a lossy format, but it has the advantage of smaller file sizes. PNG is a good choice if you want to maintain very high quality, but have plenty of space available for image storage.

Montage is a good way to label many images with filenames and the like that can be automatically extracted. It increases the image dimensions, though, to add the text. On the other hand, the text then never covers anything important. On the otherhand, you will be combining images into one montage resulting image unless you specify a 1x1 tile arrangement and process each image separately. Thus you are wasting the multi-image aspect of montage.

If all you want to do is add a label, you may want to look at mogrify. Though I am not sure what its capabilities are to extract the filename and other info for the labeling. But mogrify can process a whole folder of files at one time.

see
http://www.imagemagick.org/Usage/basics/#mogrify


The alternate is to write a script to loop over each image in a directory and add the label (via say -frame and then -annotate or -draw or by creating a new image of just the label and appending to your other image --- see label: or caption:) or you could just put the text into the meta data using -label.