Add new comment

Want to support HowtoForge? Become a subscriber!
Submitted by vadiml (not registered) on Fri, 2008-09-19 18:51.
I created djvu from b/w tiff or jpeg
#!/usr/bin/perl -w
#
# pic2djvu
# vadim likhota, 2006

my $i = 0;

my @cmds = qw[ djvm -c output.djvu ];

foreach  ( <*.*> ) {
    if (/(.*)\.jpg$/ ){
        print "$_\n";
        system("cpaldjvu", $1.'.jpg', $1.'.djvu');
        # or
        # system("c44", '-crcbfull', $1.'.jpg', $1.'.djvu');
        $i++;
        push @cmds, $1.'.djvu';
    }
    if (/(.*)\.pnm$/ ){
        print "$_\n";
        system("c44 $1.pnm $1.djvu");
        $i++;
        push @cmds, $1.'.djvu';
    }
    elsif (/(.*)\.tif$/ ) {
        print "$_\n";

        system("cjb2", $1.'.tif', $1.'.djvu');
        # for set 300 dpi need writed before prev.string
        #system("tiffset", '-s 296 2', $1.'tiff');
        #system("tiffset", '-s 282 300.0', $1.'tiff');
        #system("tiffset", '-s 283 300.0', $1.'tiff');
        # or
        #system("cjb2", '-dpi', '300', '-losslevel', '100', $1.'.tiff', $1.'.djvu');
        $i++;
        push @cmds, $1.'.djvu';
    }
}
print "$i files renamed\n";
system(@cmds);
print "\n$cmds[2] created";
Please do not use the comment function to ask for help! If you need help, please use our forum.
Comments will be published after administrator approval.

Reply

*
*
The content of this field is kept private and will not be shown publicly.


*

  • Images can be added to this post.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <div>
  • Lines and paragraphs break automatically.