Jp2 batch converter
From OpenSimulator
(Difference between revisions)
| Line 3: | Line 3: | ||
==Usage== | ==Usage== | ||
| − | Put the code in a file named jpg2jp2.pl, and copy it to the directory where your jpg's are. Call the script: | + | * Install OpenJPEG svn (if you have trouble compiling, you could try the binaries on their site) |
| + | svn co http://www.openjpeg.org/svn/trunk | ||
| + | cd trunk | ||
| + | mkdir bin | ||
| + | cd bin | ||
| + | cmake .. -DBUILD_EXAMPLES:BOOL=ON | ||
| + | make | ||
| + | make install | ||
| + | * Make sure that the binaries image_to_j2k and j2k_to_image can be executed from anywhere | ||
| + | |||
| + | * Put the code in a file named jpg2jp2.pl, and copy it to the directory where your jpg's are. Call the script: | ||
perl jpg2jp2.pl | perl jpg2jp2.pl | ||
Revision as of 00:33, 21 February 2008
Description
The jp2 files used by the Secondlife client, are actually j2k files. These can be encoded by image_to_j2k from openjpeg. The script checks for available tif-files in a root directory, and compresses those to j2k and renames them...
Usage
- Install OpenJPEG svn (if you have trouble compiling, you could try the binaries on their site)
svn co http://www.openjpeg.org/svn/trunk cd trunk mkdir bin cd bin cmake .. -DBUILD_EXAMPLES:BOOL=ON make make install
- Make sure that the binaries image_to_j2k and j2k_to_image can be executed from anywhere
- Put the code in a file named jpg2jp2.pl, and copy it to the directory where your jpg's are. Call the script:
perl jpg2jp2.pl
Code
######################################
#
# jpg2jp2.pl
#
# by: Phrearch
#
# Easily converts a batch of jpg files
# to jp2 files...
######################################
#!/usr/bin/perl
$iteration=1;
foreach my $file(`ls *.jpg`) {
chop($file);
system("jasper --input $file --output $iteration.jp2 -T jp2;");
$iteration++;
}