Multi window pane
Multi window pane
I have 9 pictures hanging on my wall close together. I want to take a large picture and crop it so it looks like i'm looking out 9 small windows. Not sure how to do this? I want to make this very accurate. pleas help with this.. thanks..
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Multi window pane
I think an exmple of the image may be needed.
Also what will you be looking through the windows AT?
Also what will you be looking through the windows AT?
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: Multi window pane
If you want a looking out the widow effect you could just draw white bars on the lrger photo as this will obscure some areas ?
There is a similar discussion here: viewtopic.php?f=1&t=13632&hilit=crop
I have done something using php that you could probably change if you want to use the crop method:
There is a similar discussion here: viewtopic.php?f=1&t=13632&hilit=crop
I have done something using php that you could probably change if you want to use the crop method:
Code: Select all
<?php
// Original image
$image = '../original_images/sunflower.jpg';
// Amount of images in x
$qty_x = '4';
// Amount of images in y
$qty_y = '3';
// Get the size of the original image
$size = getimagesize($image);
// Size to crop the images to
// code modified as per sugestion of Dave to prevent problems with left over parts of the divided image).
$crop_x = round( $size[0]/$qty_x + 0.5);
$crop_y = round( $size[1]/$qty_y + 0.5 );
// Canvas for combined images - it will be trimmed to the finished image size in the code
$width = ( $size[0] * 1.5 );
$height = ( $size[1] *1.5 );
// Crop the image
exec("convert $image -crop {$crop_x}x{$crop_y} image-%d.jpg");
// Remove the .jpg from the filenames
foreach (glob("*.jpg") as $filename) {
$file = str_replace('.jpg', '', $filename );
exec("convert $filename -background black +polaroid $file.png");
}
// Delete tempory images
foreach (glob("*.jpg") as $filename) {
unlink($filename);
}
// Set $command variable
$command = "";
// Loop through generating the image layout
for ($j = 0; $j < $qty_y; $j++) {
for ($i = 0; $i < $qty_x; $i++) { $n = $j>0 ? $qty_x*($j)+$i : $i;
$offset_x= ( ($crop_x * $i ) + rand(2, 25));
$offset_y=( ($crop_y * $j ) + rand(2, 25));
$command .= " image-$n.png -geometry +$offset_x+$offset_y -composite" ; }
}
// Produce the combined image
exec( "convert -size {$width}x{$height} xc:#262b38 $command -trim combined.jpg");
// Delete tempory images
foreach (glob("*.png") as $filename) {
unlink($filename);
}
?>