On Wednesday 23 June 2004 22:43, Gary Montalbine wrote:
> I have been searching for a way to print 4 photos at the same time
> on a sheet of photo paper using gimp and gimp print. I find that if
> I print them one at a time the mechanical part of the printer
> scratches the photos already printed.
>
> Is there any possible solution?
>
> Gary
> _______________________________________________


Gary,

I hacked a perl program I found in the net  working as a module (you need the 
gimp-perl stuff to use it under linux). It puts how many pictures you want on 
a single piece of paper.

Here you are the entire code (dialogue are in Italian):

#!/usr/bin/perl -w
#
#  This script joins two pictures on a single sheet putting them one on top 
#  of the other.
#  You can set the distance (space) between the two pictures
#  This script is the result of a light manipulation of the original
#  
#  DOV GROBGELD's script
#
#  Thanks to Dov!!!!!
# 
#  Vittorio De Martino - [EMAIL PROTECTED]
#
use Gimp ":auto";
use Gimp::Fu;

sub join2pics {
    
    my($img1, $drw1, $drw2, $space, $toggle) = @_;

#    my $space=10;      
    $space= $space > 0 ? $space : 0;
    # Get image 2
    $img1 = $drw1->image();
    
    my $img2 = gimp_drawable_image($drw2);
    
    # Get sizes through OO syntax
    my($w1, $h1) = ($drw1->width, $drw1->height);
    my($w2, $h2) = ($drw2->width, $drw2->height);

if ($toggle == 0) # It's vertical 
{ 
    # The new height is the maximum height of the images
    my $wmax = $w1 > $w2 ? $w1 : $w2;

    # Create an undo group
    gimp_undo_push_group_start($img1);
    
    # Resize the drawable layer to make room for the img
    
    gimp_image_resize($img1, $wmax, $h1+$h2+$space, ($wmax-$w1)/2, 0);

    gimp_layer_resize($drw1, $wmax, $h1+$h2+$space, ($wmax-$w1)/2, 0);

    # Copy $drawable2 and paste it into the new space of $drawable1
    # select all of img2
    gimp_selection_all($img2);

    # copy it to the clipboard
    gimp_edit_copy($drw2);

    # make a selection in img 1 in the position where it is to be pasted
        
gimp_rect_select($img1, ($wmax-$w2)/2, $h1+$space, $w2, $h2, 0,0,0);
    # paste and then anchor it
    my $floating_layer = gimp_edit_paste($drw1, 0);
    gimp_floating_sel_anchor($floating_layer);

    # Close the undo group
    gimp_undo_push_group_start($img1);
    
    # Update the display
    gimp_displays_flush();
}

else     #it's horizontal
{
   # The new height is the maximum height of the images
    my $hmax = $h1 > $h2 ? $h1 : $h2;

    # Create an undo group
    gimp_undo_push_group_start($img1);
    
    # Resize the drawable layer to make room for the img
    gimp_image_resize($img1, $w1+$w2+$space, $hmax, 0, ($hmax-$h1)/2);
    gimp_layer_resize($drw1, $w1+$w2+$space, $hmax, 0, ($hmax-$h1)/2);

    # Copy $drawable2 and paste it into the new space of $drawable1
    # select all of img2
    gimp_selection_all($img2);

    # copy it to the clipboard
    gimp_edit_copy($drw2);

    # make a selection in img 1 in the position where it is to be pasted
    gimp_rect_select($img1, $w1+$space, ($hmax-$h2)/2, $w2, $h2, 0,0,0);

    # paste and then anchor it
    my $floating_layer = gimp_edit_paste($drw1, 0);
    gimp_floating_sel_anchor($floating_layer);

    # Close the undo group
    gimp_undo_push_group_start($img1);
    
    # Update the display
    gimp_displays_flush();
 
}    

    return undef;
}
register
    "join2pics",                 # fill in name
    "Joins two pictures vertically/horizontally",  # a small description
    "",       # a help text
    "Vittorio De Martino",            # Your name
    "2002, V.De Martino",        # Your copyright
    "Oct. 2002",              # Date
   "<Image>/Image/Join2pics", 
    "*",                       # Image types
    [
        [PF_DRAWABLE,   "drawable",     "Drawable to concatinate",   undef],
        [PF_INT,   "space", "Vert. space between pictures", 10],
        [PF_RADIO       , 'position', "position", 0, [Vertical => 0, Horizontal => 
1]]
    ],
    \&join2pics;

exit main();
 
_______________________________________________
Gimp-user mailing list
[EMAIL PROTECTED]
http://lists.xcf.berkeley.edu/mailman/listinfo/gimp-user

Reply via email to