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