View Full Version : Sequence of images
MDuv2000
09-09-2004, 04:46 PM
I've been looking for this (or how to script it) for a while...
Has anyone run across a program or script where you can view a sequence of images as a consolidated entry in your Terminal or Finder window... Exactly how you see it in Shake or Combustion.... This would be killer for Apple to implement in there push for the pro video/effect user.
Example...
(normal)
FileSequence.0001.iff
FileSequence.0002.iff
FileSequence.0003.iff
FileSequence.0004.iff
FileSequence.0005.iff
(better)
FileSequence.[1-5].iff
I don't know if you've tried to work with osX in the finder when you have a folder with 600 images in it... it's not pretty. You toss that idea out the door quickly and open up a terminal window...
Thanks,
Mark.
bramley
09-09-2004, 06:01 PM
I think you will have to tell us what you mean by "consolidated entry" Is that like a movie (you talk of pro video/effects) or a panel of separate images or a slide show?
All of these are possible. QT player (may need to the Pro version) will stick a numbered sequence of images together to give a movie. You could also store an image sequence in there as a slide show.
If you want a panel of images there is iPhoto. iPhoto will also do slide shows.
yellow
09-09-2004, 06:05 PM
I think the OP means within the Finder.
Instead of seeing 100 files all named:
image001.jpg
image002.jpg
etc..
The OP wants to see 1 file:
image[1-100].jpg
Is this correct? And if so, how do you select one particular file from the bunch?
MDuv2000
09-09-2004, 06:19 PM
Yellow, you've got the idea... It would only be in the Finder or a Terminal window. But it would only be for viewing purposes and manipulation only... A good reason to have it is if you have multiple sequences in the same folder...
Example...
SequenceA.0001.iff
SequenceA.0002.iff
SequenceA.0003.iff
SequenceA.0004.iff
SequenceB.0081.iff
SequenceB.0082.iff
SequenceB.0083.iff
SequenceC.0011.iff
SequenceC.0012.iff
SequenceC.0013.iff
SequenceC.0014.iff
Would show up in the Terminal as...
SequenceA.[1-4].iff
SequenceB.[81-83].iff
SequenceC.[11-14].iff
Or if you view it in the Finder, there would be plus sign (or arrow) that expands the sequence for modification of individual frames.
It would be best used for viewing, copying, or deleting sequences...
What do you think?
Mark.
blubbernaut
09-09-2004, 10:17 PM
Or if you view it in the Finder, there would be plus sign (or arrow) that expands the sequence for modification of individual frames.
Similar to the download pane in XFactor or Poisoned, where the same files from different sources are shown as one title with a triangle that when you click on it expands to an indented list showing all the separate files and the different sources' details.
However in this circumstance, it would be concantating (right word?) totally different files with partially matched names into one listing that indicates a range....mmm I wonder how they did that in those apps?
[EDIT] Perhaps you should just file things under multiple nested folders. It's a good work practice anyway. See attached pic
rotero
09-09-2004, 10:26 PM
... it would be concantating (right word?) ...
concatenate: [tr. v] 1. to connect or link in a series or chain
2. to arrange (strings of characters) into a chained list (computer science)
I definitely had to look that one up. You learn something new every day.
blubbernaut
09-09-2004, 10:29 PM
Nearly spelt it right :)
Maybe this should go into scripting Unix newcomers or somethign? I'm sure it would be possible somehow.
MDuv2000
09-09-2004, 10:58 PM
Similar to the download pane in XFactor or Poisoned, where the same files from different sources are shown as one title with a triangle that when you click on it expands to an indented list showing all the separate files and the different sources' details.
However in this circumstance, it would be concantating (right word?) totally different files with partially matched names into one listing that indicates a range....mmm I wonder how they did that in those apps?
[EDIT] Perhaps you should just file things under multiple nested folders. It's a good work practice anyway. See attached pic
Yeah... you got it. That would be a extremely useful tool to implement into osX (or script in the Terminal window)...
As for working in nested folders... It's just not viable when you work with Maya (which will only render into it's own images folder)... Imagine you have 5 computers rendering overnight to the same folder over the network. You come back in the morning and you have sometimes thousands of files which would need to be organized into separate folders, it can be very painfully slow in osX's Finder just to open a folder with a thousand images in it. I usually have to organize it in a terminal window, and even then it can be a pain just to see what's in the folder because of the immense amount of files.
I think you can see why this would be a very useful tool...
Does anybody have any ideas?
Mark.
bramley
09-10-2004, 03:04 AM
You come back in the morning and you have sometimes thousands of files which would need to be organized into separate folders, it can be very painfully slow in osX's Finder just to open a folder with a thousand images in it. I usually have to organize it in a terminal window, and even then it can be a pain just to see what's in the folder because of the immense amount of files.
Ah! This sounds a lot simpler than I had thought.
It sounds like the issue is the backbreaking job of organising all the images. How about using a folder action, that operates on files placed in the rendered images folder, and moves them into sub-folders based on which sequence they belong to. You could come in to work in the morning with everything already organised into folders.
If you need all images to actually stay in one big folder then the script could create an alias file, which is stored in a separate folder, pointing to each image.
Both of these are trivial to script.
MDuv2000
09-10-2004, 04:18 AM
Ah! This sounds a lot simpler than I had thought.
It sounds like the issue is the backbreaking job of organising all the images. How about using a folder action, that operates on files placed in the rendered images folder, and moves them into sub-folders based on which sequence they belong to. You could come in to work in the morning with everything already organised into folders.
If you need all images to actually stay in one big folder then the script could create an alias file, which is stored in a separate folder, pointing to each image.
Both of these are trivial to script.
Now that sounds interesting... I'll have to look into "Folder Actions"... Thank you very much... If anybody has any info on this or a good place to look for info on this, I'll definitely have to look into it even though it might not be exactly what I was originally looking for.
It would be nice though to still see if anybody has any other ideas. In most companies I work for they have added scripts so that within your terminal window you can type a command like "mls" or "seqls" that would list your files in a condensed view like the one I was speaking of before. If anybody has any lead on that type of script for osX, I would love to hear about it...
Thanks guys (and maybe girls),
Mark.
bramley
09-10-2004, 06:14 AM
When I mentioned "Folder Actions" I should have said that Folder Actions is a feature of Applescript. You can find some sample scripts in /Library/Scripts/Folder Action Scripts on your machine.
Basic info on setting them up is here: http://www.apple.com/applescript/folderactions/01.html
hayne
09-10-2004, 11:15 AM
Here's a Perl script that does the sort of file listing you have been asking for. (Save this script into a file in a convenient spot on your filesystem, and make it executable with 'chmod +x')
By default, the script lists the current directory/folder but you can give it the name of a directory/folder to list on the command line if you want.
E.g. (assuming you saved it into the file "listdir_seq" on your Desktop):
~/Desktop/listdir_seq name_of_your_folder
#!/usr/bin/perl -w
use strict;
# This script lists the files in the specified directory
# but shows numerical sequences as one item.
# E.g. the files file1.txt, file2.txt, file3.txt would show as file[1-3].txt
# Cameron Hayne (macdev@hayne.net), September 2004
# If no command-line argument, use the current directory
my $dirname = scalar(@ARGV) >= 1 ? $ARGV[0]: ".";
# function declarations
sub read_directory($);
sub group_files(@);
sub print_groups(%);
MAIN:
{
my @filenames = read_directory($dirname);
print_groups(group_files(@filenames));
}
exit;
#----- FUNCTIONS -----
sub read_directory($)
{
my ($dirname) = @_;
my @filenames = ();
opendir(DIR, $dirname) or die "can't opendir $dirname: $!";
while (defined(my $filename = readdir(DIR)))
{
next if $filename =~ /^\.\.?$/; # skip . and ..
push(@filenames, $filename);
}
closedir(DIR);
return @filenames;
}
sub group_files(@)
{
my (@filenames) = @_;
my %groups = ();
foreach my $name (@filenames)
{
if ($name =~ /^(.*\D)(\d+)(\D*)$/)
{
my $start = $1;
my $number = $2;
my $end = $3;
my $key = "$start$end";
my $group = $groups{$key};
unless ($group)
{
my @numbers = ();
$group =
{
start => $start,
end => $end,
numbers => \@numbers,
};
$groups{$key} = $group;
}
my $numbers_ref = $group->{numbers};
push(@$numbers_ref, $number);
}
else # filenames without a number in them
{
my $group =
{
start => $name,
end => "",
numbers => undef,
};
$groups{$name} = $group;
}
}
return %groups;
}
sub get_number_ranges(@)
{
my (@numbers) = @_;
my @ranges = ();
my $low = undef;
my $prev = undef;
my $range = undef;
foreach my $n (sort {$a <=> $b} @numbers)
{
if (!defined($prev) or $n != ($prev + 1))
{
push(@ranges, $range) if defined($range);
$low = $n;
$range = "$n";
}
else
{
$range = "[$low-$n]";
}
$prev = $n;
}
push(@ranges, $range) if defined($range);
return @ranges;
}
sub print_groups(%)
{
my (%groups) = @_;
foreach my $key (sort keys %groups)
{
my $group = $groups{$key};
my $start = $group->{start};
my $end = $group->{end};
my $numbers_ref = $group->{numbers};
if (defined($numbers_ref))
{
my @ranges = get_number_ranges(@$numbers_ref);
foreach my $range (@ranges)
{
print "$start$range$end\n";
}
}
else
{
print "$start$end\n";
}
}
}
There is a bug in the above script - I have put the bug-fixed version on my web site: http://hayne.net/MacDev/Perl/listdir_seq
MDuv2000
09-10-2004, 11:07 PM
Here's a Perl script that does the sort of file listing you have been asking for. (Save this script into a file in a convenient spot on your filesystem, and make it executable with 'chmod +x')
By default, the script lists the current directory/folder but you can give it the name of a directory/folder to list on the command line if you want.
Bramley & Hayne
Thank you both for pointing me in good directions... I havn't had a chance yet to try out your script, but I will this weekend. Both options sound like they could be very useful...
If anybody else has any ideas, or updated scripts, please post them...
Thanks to all...
Mark.
yellow
09-10-2004, 11:12 PM
Works like a charm, Hayne. Nice script.
vBulletin® v3.8.1, Copyright ©2000-2009, Jelsoft Enterprises Ltd.