Getting started with Fred's Scripts

A plethora of command-line scripts that perform geometric transforms, blurs, sharpens, edging, noise removal, and color manipulations.
PaulAThompson
Posts: 26
Joined: 2012-06-23T10:50:36-07:00
Authentication code: 13

Re: Getting started with Fred's Scripts

Post 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.
PaulAThompson
Posts: 26
Joined: 2012-06-23T10:50:36-07:00
Authentication code: 13

Re: Getting started with Fred's Scripts

Post 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.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Getting started with Fred's Scripts

Post 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
PaulAThompson
Posts: 26
Joined: 2012-06-23T10:50:36-07:00
Authentication code: 13

Re: Getting started with Fred's Scripts

Post 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.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Getting started with Fred's Scripts

Post 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.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Getting started with Fred's Scripts

Post 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
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Getting started with Fred's Scripts

Post 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.
Post Reply