Wednesday, June 17, 2015

Adobe Photoshop and Lightroom CC 2015 Dehaze Control

Here are some examples of the newly introduced control in the latest versions of Photoshop CC 2015 and Lightroom CC 2015 Updates released on June 16 2015.

Dehaze = 0

Dehaze = +25

Dehaze = +50

Dehaze = +75

Dehaze = +100





Monday, October 01, 2012

Animated GIF in Photoshop

Create an Animated .GIF in Photoshop CS5 & CS6

June 29th, 2010 by Brian D'Alessandro
Let’s say you have a folder full of images that you want to sequence together as frames in an animated GIF. You can find special programs online to do this, but with some of the new features of Adobe Photoshop, it’s quite fast and simple.
  1. Gather the images you want to animate into one folder.
  2. Click File > Scripts > Load Files into Stack. When the “Load Layers” window pops up, click Browse to select & open your image files, and then click OK. This should import the files you selected as individual layers in your document. Rearrange the layers into the correct order, if necessary.
  3. Open the Animation palette (Window > Animation) if you have CS5. **Note! In Photoshop CS6, this is now known as the Timeline palette. So, go to (Window > Timeline) instead.**
  4. In the Animation/Timeline palette menu (found at the top right corner of the palette), click Make Frames From Layers. You can also click Reverse Frames if needed. This will take each layer in your document and set it as an individual frame in the animation.
  5. Now we will change the duration of each frame. Make sure you are in frame view, not timeline view. If you do not see thumbnail icons of all your layers in the Animation/Timeline palette, click the icon in the lower right corner (the hover text will say “Convert to Frame Animation”). Now, back in the Animation/Timeline palette menu, click Select All Frames.
  6. Click the drop down button just underneath each frame image (circled in red in the image below). This will bring up a menu where you can set a duration. Since all frames are selected, all frames will be set to the same time. Each frame can be changed individually, if desired.
  7. The drop down button circled in black in the image above will change how many times the animation will loop; either a fixed number of times, or forever.
  8. Once the frame order and timing as been set up, it is time to save the image! Click File > Save for Web & Devices, make sure the file format is set to GIF, change any other options if needed, and save the image!
You will now have an animated GIF taken from a folder full of the individual frames. In fact, as long as each frame exists as a separate layer in Photoshop, the Animation/Timeline palette can be used to create the GIF. But, with CS5 & CS6 it is easy to make separate layers from a folder of the individual frames as described.

Saturday, August 18, 2012

Working with ExIF Tools to Rename Files and Extract JPGs from RAW

Extract large JPEG images from all NEF's and write them in the same hierarchy in the destination folder.

exiftool -r -jpgfromraw -b -ext nef -w DSTDIR/%d%f.jpg SRCDIR

If you want to change the JPG filename, use any suffix you want on the commandline like this:

exiftool -r -jpgfromraw -b -ext nef -w DSTDIR/%d%f_anysuffix.jpg SRCDIR

Where SRCDIR is the base directory with your NEF's (without a drive specification!), and DSTDIR is a destination directory somewhere on a good disk. To extract all files in the current directory and place the extracted files in the same directory, use the following command: please note the "dot" at the end of the line meaning Present Working Directory


exiftool -r -jpgfromraw -b -ext nef -w %d%f.jpg .

Use ExIF Tool to rename files based on metatags.

exiftool.exe "-FileName<DSC_$filenumber.nef" -r c:\myimages

exiftool.exe -subsecdatetimeoriginal *.nef

The above command line will scan all files in c:\myimages (and sub-directories as well). For each valid image found, it will rename the file to DSC_xxxx.nef, where "xxxx" is the image number from the EXIF data. Change "c:\myimages" to the base directory of your images. Also I'm assuming your raw file prefix is the default "DSC_"; if not change the command line with whatever prefix you use.

If all your recovered NEFs are in a single directory you can use the following simplified command line:

exiftool.exe "-FileName<DSC_$filenumber.nef" .nef

List all files in a directory, display filenumber and sort by filenumber ExIF Field

exiftool.exe "-filenumber" -fileOrder filenumber *.nef
exiftool.exe -model "-filenumber" -fileOrder filenumber *.nef

D3

exiftool.exe "-FileName<D3G_$filenumber.nef" *.nef

exiftool.exe -if "$model =~ /Nikon D3/i" "-FileName<D3G_$filenumber.nef" *.nef

D800

exiftool.exe "-FileName<D80_$filenumber.nef" *.nef

exiftool.exe -if "$model =~ /Nikon D800/i" "-FileName<D80_$filenumber.nef" *.nef

Rename based on Offset of Shutter Count
Change via .ExifTool_config file. Using new Compound Tag
(thanks to Phil harvey for the tip)

This technique is useful for older cameras such as my old Nikon D2Xs that did not store the original file number in the ExIF data. Say you have a bunch of files recovered from a crashed drive. Files will be named randomly (e.g. 0007851.nef) on the recovery drive/folder. If you know what the file(s) original file name was (such as if they were cataloged in Lightroom) find the first file by earliest capture time order. Next, find out what the shutter count is for the frame:

exiftool -subsecdatetimeoriginal -shuttercount 0005104.nef

Take the resulting shutter count number and subtract the original file number from the shutter count number so you can come up with the proper offset. For example, if the original file name was DSC_4405.nef and the shutter count for that frame is 78820, the offset would be 74415. Exter this as your offset in the .ExifTool_config file

# override ShutterCount tag to use an offset of 74414
   ShutterCountMG => {
     Require => 'ShutterCount',
            ValueConv => '($val - 74415)', #set offset here

            PrintConv => 'sprintf("%.4d",$val)', #pad to 4 decimal places
   },    


...and the commandline to execute the renaming based on the above would be

exiftool -config .ExifTool_config -if "$model =~ /Nikon D2Xs/i" "-Filename<DSC_$ShutterCountMG.nef" *.nef

If the original file name is unknown or you do not care what the correct resulting file name should be, feel free to use whatever offset you want to arrive at a proper file name.

Complete .ExifTool_config file including above compound tag

#------------------------------------------------------------------------------
# File:         ExifTool_config  -->  ~/.ExifTool_config
#
# Description:  Sample user configuration file for Image::ExifTool
#
# Notes:        This example file shows how to define your own shortcuts and
#               add new EXIF, IPTC, XMP, PNG, MIE and Composite tags, as well
#               as how to specify preferred lenses for the LensID tag and
#               define default values for ExifTool options.
#
#               Note that unknown tags may be extracted even if they aren't
#               defined, but tags must be defined to be written.  Also note
#               that it is possible to override an existing tag definition
#               with a user-defined tag.
#
#               To activate this file, rename it to ".ExifTool_config" and
#               place it in your home directory or the exiftool application
#               directory.  (On Windows and Mac systems this must be done via
#               the command line since the GUI's don't allow filenames to begin
#               with a dot.  Use the "rename" command in Windows or "mv" on the
#               Mac.)  This causes ExifTool to automatically load the file when
#               run.  Your home directory is determined by the first defined of
#               the following environment variables:
#
#                   1. EXIFTOOL_HOME
#                   2. HOME
#                   3. HOMEDRIVE + HOMEPATH
#                   4. (the current directory)
#
#               Alternatively, the -config option of the exiftool application
#               may be used to load a specific configuration file (note that
#               it must be the first option on the command line):
#
#                   exiftool -config ExifTool_config ...
#
#               This sample file defines the following 16 new tags as well as a
#               number of Shortcut and Composite tags:
#
#                   1.  EXIF:NewEXIFTag
#                   2.  GPS:GPSPitch
#                   3.  GPS:GPSRoll
#                   4.  IPTC:NewIPTCTag
#                   5.  XMP-xmp:NewXMPxmpTag
#                   6.  XMP-exif:GPSPitch
#                   7.  XMP-exif:GPSRoll
#                   8.  XMP-xxx:NewXMPxxxTag1
#                   9.  XMP-xxx:NewXMPxxxTag2
#                  10.  XMP-xxx:NewXMPxxxTag3
#                  11.  XMP-xxx:NewXMPxxxStruct
#                  12.  PNG:NewPngTag1
#                  13.  PNG:NewPngTag2
#                  14.  PNG:NewPngTag3
#                  15.  MIE-Meta:NewMieTag1
#                  16.  MIE-Test:NewMieTag2
#
#               For detailed information on the definition of tag tables and
#               tag information hashes, see lib/Image/ExifTool/README.
#------------------------------------------------------------------------------

# Shortcut tags are used when extracting information to simplify
# commonly used commands.  They can be used to represent groups
# of tags, or to provide an alias for a tag name.
%Image::ExifTool::UserDefined::Shortcuts = (
    MyShortcut => ['exif:createdate','exposuretime','aperture'],
    MyAlias => 'FocalLengthIn35mmFormat',
);

# NOTE: All tag names used in the following tables are case sensitive.

# The %Image::ExifTool::UserDefined hash defines new tags to be added
# to existing tables.
%Image::ExifTool::UserDefined = (
    # All EXIF tags are added to the Main table, and WriteGroup is used to
    # specify where the tag is written (default is ExifIFD if not specified):
    'Image::ExifTool::Exif::Main' => {
        0xd000 => {
            Name => 'NewEXIFTag',
            Writable => 'int16u',
            WriteGroup => 'IFD0',
        },
        # add more user-defined EXIF tags here...
    },
    # the Geotag feature writes these additional GPS tags if available:
    'Image::ExifTool::GPS::Main' => {
        0xd000 => {
            Name => 'GPSPitch',
            Writable => 'rational64s',
        },
        0xd001 => {
            Name => 'GPSRoll',
            Writable => 'rational64s',
        },
    },
    # IPTC tags are added to a specific record type (ie. application record):
    # (Note: IPTC tag ID's are limited to the range 0-255)
    'Image::ExifTool::IPTC::ApplicationRecord' => {
        240 => {
            Name => 'NewIPTCTag',
            Format => 'string[0,16]',
        },
        # add more user-defined IPTC ApplicationRecord tags here...
    },
    # XMP tags may be added to existing namespaces:
    'Image::ExifTool::XMP::xmp' => {
        NewXMPxmpTag => { Groups => { 2 => 'Author' } },
        # add more user-defined XMP-xmp tags here...
    },
    # special Geotag tags for XMP-exif:
    'Image::ExifTool::XMP::exif' => {
        GPSPitch => { Writable => 'rational', Groups => { 2 => 'Location' } },
        GPSRoll  => { Writable => 'rational', Groups => { 2 => 'Location' } },
    },
    # new XMP namespaces (ie. xxx) must be added to the Main XMP table:
    'Image::ExifTool::XMP::Main' => {
        xxx => { # <-- must be the same as the NAMESPACE prefix
            SubDirectory => {
                TagTable => 'Image::ExifTool::UserDefined::xxx',
                # (see the definition of this table below)
            },
        },
        # add more user-defined XMP namespaces here...
    },
    # new PNG tags are added to the PNG::TextualData table:
    'Image::ExifTool::PNG::TextualData' => {
        NewPngTag1 => { },
        NewPngTag2 => { },
        NewPngTag3 => { },
    },
    # add a new MIE tag (MieTag1) and group (MIE-Test) to MIE-Meta
    # (Note: MIE group names must NOT end with a number)
    'Image::ExifTool::MIE::Meta' => {
        NewMieTag1 => {
            Writable => 'rational64u',
            Units => [ 'cm', 'in' ],
        },
        Test => {
            SubDirectory => {
                TagTable => 'Image::ExifTool::UserDefined::MIETest',
                DirName => 'MIE-Test',
            },
        },
    },
    # Composite tags are added to the Composite table:
    'Image::ExifTool::Composite' => {
        # Composite tags are unique:  The Require/Desire elements specify
        # tags that must/may exist, and the keys of these hashes are used as
        # indices in the @val array of the ValueConv expression to access
        # the numerical (-n) values of these tags.  All Require'd tags must
        # exist for the Composite tag to be evaluated.  If no Require'd tags
        # are specified, then at least one of the Desire'd tags must exist.
        # See the Composite table in Image::ExifTool::Exif for more
        # examples, and lib/Image/ExifTool/README for all of the details.
        BaseName => {
            Require => {
                0 => 'FileName',
            },
            # remove the extension from FileName
            ValueConv => 'my $name=$val[0]; $name=~s/\..*?$//; $name',
        },
        # the next few examples demonstrate simplifications which may be
        # used if only one tag is Require'd or Desire'd:
        # 1) the Require lookup may be replaced with a simple tag name
        # 2) "$val" may be used to represent "$val[0]" in the expression
        FileExtension => {
            Require => 'FileName',
            ValueConv => '$val=~/\.([^.]*)$/; $1',
        },
        # override CircleOfConfusion tag to use D/1750 instead of D/1440
        CircleOfConfusion => {
            Require => 'ScaleFactor35efl',
            Groups => { 2 => 'Camera' },
            ValueConv => 'sqrt(24*24+36*36) / ($val * 1750)',
            # an optional PrintConv may be used to format the value
            PrintConv => 'sprintf("%.3f mm",$val)',
        },
        # generate a description for this file type
        FileTypeDescription => {
            Require => 'FileType',
            ValueConv => 'GetFileType($val,1) || $val',
        },
        # override ShutterCount tag to use an offset of 74415
        ShutterCountMG => {
        Require => 'ShutterCount',
            ValueConv => '($val - 74415)', #set offset here
            PrintConv => 'sprintf("%.4d",$val)', #pad to 4 decimal places
            }, 
        # calculate physical image size based on resolution
        PhysicalImageSize => {
            Require => {
                0 => 'ImageWidth',
                1 => 'ImageHeight',
                2 => 'XResolution',
                3 => 'YResolution',
                4 => 'ResolutionUnit',
            },
            ValueConv => '$val[0]/$val[2] . " " . $val[1]/$val[3]',
            # (the @prt array contains print-formatted values)
            PrintConv => 'sprintf("%.1fx%.1f $prt[4]", split(" ",$val))',
        },
        # [advanced] select largest JPEG preview image
        BigImage => {
            Desire => {
                0 => 'JpgFromRaw',
                1 => 'PreviewImage',
                2 => 'OtherImage',
                # (DNG and A100 ARW may be have 2 PreviewImage's)
                3 => 'PreviewImage (1)',
            },
            # ValueConv may also be a code reference
            # Inputs: 0) reference to list of values, 1) ExifTool object
            ValueConv => sub {
                my $val = shift;
                my ($image, $bigImage, $len, $bigLen);
                foreach $image (@$val) {
                    next unless ref $image eq 'SCALAR';
                    # check for JPEG image (or "Binary data" if -b not used)
                    next unless $$image =~ /^(\xff\xd8\xff|Binary data (\d+))/;
                    $len = $2 || length $$image; # get image length
                    # save largest image
                    next if defined $bigLen and $bigLen >= $len;
                    $bigLen = $len;
                    $bigImage = $image;
                }
                return $bigImage;
            },
        },
    },
);

# This is a basic example of the definition for a new XMP namespace.
# This table is referenced through a SubDirectory tag definition
# in the %Image::ExifTool::UserDefined definition above.
# The namespace prefix for these tags is 'xxx', which corresponds to
# an ExifTool family 1 group name of 'XMP-xxx'.
%Image::ExifTool::UserDefined::xxx = (
    GROUPS => { 0 => 'XMP', 1 => 'XMP-xxx', 2 => 'Image' },
    NAMESPACE => { 'xxx' => 'http://ns.myname.com/xxx/1.0/' },
    WRITABLE => 'string',
    # replace "NewXMPxxxTag1" with your own tag name (ie. "MyTag")
    NewXMPxxxTag1 => { Writable => 'lang-alt' },
    NewXMPxxxTag2 => { Groups => { 2 => 'Author' } },
    NewXMPxxxTag3 => { List => 'Bag' },
    # example structured XMP tag
    NewXMPxxxStruct => {
        # the "Struct" entry defines the structure fields
        Struct => {
            # optional namespace prefix and URI for structure fields
            # (required only if different than NAMESPACE above)
            NAMESPACE => { 'test' => 'http://x.y.z/test/' },
            # optional structure name (used for warning messages only)
            STRUCT_NAME => 'MyStruct',
            # optional rdf:type property for the structure
            TYPE => 'http://x.y.z/test/xystruct',
            # structure fields (very similar to tag definitions)
            X => { Writable => 'integer' },
            Y => { Writable => 'integer' },
            # a nested structure...
            Things => {
                List => 'Bag',
                Struct => {
                    NAMESPACE => { thing => 'http://x.y.z/thing/' },
                    What  => { },
                    Where => { },
                },
            },
        },
        List => 'Seq', # structures may also be elements of a list
    },
    # Each field in the structure has an automatically-generated
    # corresponding flattened tag with an ID that is the concatenation
    # of the original structure tag ID and the field name (after
    # capitalizing the first letter of the field name if necessary).
    # The Name and/or Description of these flattened tags may be changed
    # if desired, but all other tag properties are taken from the
    # structure field definition.  When this is done, the "Flat" flag
    # must also be set in the tag definition.  For example:
    NewXMPxxxStructX => { Name => 'SomeOtherName', Flat => 1 },
);

# Adding a new MIE group requires a few extra definitions
use Image::ExifTool::MIE;
%Image::ExifTool::UserDefined::MIETest = (
    %Image::ExifTool::MIE::tableDefaults,   # default MIE table entries
    GROUPS      => { 0 => 'MIE', 1 => 'MIE-Test', 2 => 'Document' },
    WRITE_GROUP => 'MIE-Test',
    NewMieTag2  => { },     # new user-defined tag in MIE-Test group
);

# A special 'Lenses' list can be defined to give priority to specific lenses
# in the logic to determine a lens model for the Composite:LensID tag
@Image::ExifTool::UserDefined::Lenses = (
    'Sigma AF 10-20mm F4-5.6 EX DC',
    'Tokina AF193-2 19-35mm f/3.5-4.5',
);

# Specify default ExifTool option values
# (see the Options function documentation for available options)
%Image::ExifTool::UserDefined::Options = (
    CoordFormat => '%.6f',  # change default GPS coordinate format
    Duplicates => 1,        # make -a default for the exiftool app
    GeoMaxHDOP => 4,        # ignore GPS fixes with HDOP > 4
);

#------------------------------------------------------------------------------
1;  #end

Wednesday, May 31, 2006

Formula for shooting the Moon

t=f² * B/ASA

where
f = aperture
ASA = ISO
B = constant as follows
B=220 (full moon)
B=40 (half moon)
B=10 (thin crescent)
B=80 (three-quarter moon)

for example:
Nikkor 300/4 at ISO 800 and halfmoon will result in
t=(4*4) / (40*800) = 16/32000 = 0.0005sec = 1/2000 sec


Make 3 pictures from 1/1000 to 1/4000 sec and you will get at least one correct image (depends also on weather conditions like atmospheric dust, mist etc.).