Gentoo Archives: gentoo-user

From: Mick <michaelkintzios@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] resizing multiple images with adding a frame as needed
Date: Wed, 24 Jun 2015 05:35:48
Message-Id: 201506240635.30932.michaelkintzios@gmail.com
In Reply to: Re: [gentoo-user] resizing multiple images with adding a frame as needed by wabenbau@gmail.com
1 On Wednesday 24 Jun 2015 01:02:35 wabenbau@×××××.com wrote:
2 > hw <hw@×××××××××××××××××××××.de> wrote:
3 > > Hi,
4 > >
5 > > suppose I have a number of images that need to be displayed side by
6 > > side in a nice layout. The images are of different sizes and have
7 > > different aspect ratios.
8 > >
9 > > To fit the images into the layout, I can scale the images either by
10 > > height or width or by percantage, and they will look messy in the
11 > > layout because I need to keep their aspect ratio when scaling them.
12 > >
13 > > So what I need to do is put a frame around each image just as needed
14 > > when scaling it so that I will end up with all the images having the
15 > > same size while maintaining their aspect ratio.
16 > >
17 > > I guess 'convert' (from imagemagick) or 'ffmpeg' can do this, yet I
18 > > couldn't find out how.
19 > >
20 > >
21 > > (In this particular case, I would set a default size to scale all
22 > > images to rather than doing something more complicated like examine
23 > > all images in advance to compute a good size to use from the largest
24 > > or smallest one or from their average dimensions.)
25 > >
26 > >
27 > > Any ideas how to do this?
28 >
29 > Look here:
30 >
31 > http://stackoverflow.com/questions/1787356/use-imagemagick-to-place-an-imag
32 > e-inside-a-larger-canvas
33 >
34 > You must add a resize paremeter as this example is only for placing an
35 > image inside a larger canvas. :-)
36 >
37 > You can easily find more examples in the Internet.
38 >
39 > --
40 > Regards
41 > wabe
42
43 Give this a spin, or modify accordingly to suit your needs:
44
45 ============================================
46 #!/bin/bash
47 for i in *.JPG; do
48 name=${i%.JPG}
49 convert -resize 900x675 ${i} ${name}_s.jpg
50 done
51 ============================================
52
53 --
54 Regards,
55 Mick

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies

Subject Author
Re: [gentoo-user] resizing multiple images with adding a frame as needed hw <hw@×××××××××××××××××××××.de>