[Digikam-users] how to resize image to a new and smaller formate -

Martin Kaspar martin.kaspar at campus-24.com
Mon Apr 9 01:24:57 BST 2012


hello   dear guy

many thanks for the great explanation.

you helped me  alot and you deserve a monster congratulation-


greetings

matze

On Mon, Apr 9, 2012 at 2:10 AM, Guy Stalnaker <jimmyg521 at gmail.com> wrote:

> You should still be able to use his script with one slight modification.
> So you can do this two ways. Though I use the zsh shell which is quite
> similar, you likely use the bash shell, which is the default for nearly
> every Linux distribution.
>
>
> Way #1:
>
>
> for I in *.jpg ; do
>  convert -resize 800x600 $I ${I%.jpg}_resized.jpg ;
>  echo -n "." ;
> done
>
> Way #2
>
> for I in *.jpg ; do convert ${I} ${I%.jpg}_resized.jpg ; done
>
> I usually do this on a single line which is why I showed the second one :-)
>
> Note the change. The second $I becomes ${I%.jpg}_resized.jpg -- the %.jpg
> is the part that tells bash that the part of the filename that follows the
> % should be removed and then what follows the } will be added. Thus the
> .jpg in the first filename becomes _resized.jpg in the second one:
>
> DSCN_20120310T193618.jpg
> DSCN_20120310T193618_resized.**jpg
>
> I tested this and it works. Note how useful this is :-) You can convert
> from one type of file to another:
>
> ${I%.tif}.jpg
>
> Do bulk convert modifications for resizing, gamma correction, saturation
> mods to a group of files. The nice thing here is that you get to keep the
> first set of files unmodified if you add the }_modified.ext for each pass.
> It's usually good to keep the original unmodified files in case something
> goes awry. And things will go awry.
>
> Hope this helps.
>
> In case you wonder, for the zsh shell the command to resize is:
>
> for i in *.jpg ; do convert -resize 800x600 ${i} ${i:s/.jpg/_resized.jpg/}
> ; done
>
> This follows very closely conventions in the vi(m) editor where s/x/y/ is
> the search/replace command: s/what_to_find/change_what_to_**this/
>
> Guy
>
>
> On 04/08/2012 06:28 PM, Martin Kaspar wrote:
>
>>
>> hello dear list, hello dear Remco
>>
>> many thanks for the quick reply.
>>
>> i had a quick look at the machine - i have the necessary libraries to
>> performe the little script you suggested .
>>
>> ssee here the preliminary - i have the following preliminary things on
>> my machine.
>>
>> martin at linux-wyee:~> rpm -qf $(which convert)
>> ImageMagick-6.7.2.7-5.1.3.i586
>> martin at linux-wyee:~>
>>
>>
>> but this script does not run  - as target and sourcde are the same.
>>
>>
>> for I in *.jpg ; do
>>        convert -resize 800x600 $I $I ;
>>        echo -n "." ;
>>
>>
>> well - if all the  files are in one folder - how should i re-design the
>> script.
>> there have to be different names - ohterwise convert or bash will be
>> complaining..
>>
>> can you help out here -
>> note: all the files are in the same folder
>>
>>
>> look forward to hear from  you
>>
>> greetings
>> matze
>>
>>
>>
>> On Sun, Apr 8, 2012 at 2:09 PM, Remco Viëtor <remco.vietor at wanadoo.fr
>> <mailto:remco.vietor at wanadoo.**fr <remco.vietor at wanadoo.fr>>> wrote:
>>
>>    On Sunday 08 April 2012 12:46:33 jdd wrote:
>>     > Le 08/04/2012 13:04, Martin Kaspar a écrit :
>>     >
>>     > >   i have a bunch of photos that i want to show in a image slider
>> on
>>     > > the Web.
>>
>>     > or better, use a scrit like mine:
>>     >
>>     > for I in *.jpg ; do
>>     >       convert -resize 800x600 $I $I ;
>>     >       echo -n "." ;
>>     >
>>     > done
>>
>>    Just be aware that that script, as written, overwrites the original
>>    file,
>>    which might not be what you want
>>
>>    Remco
>>    ______________________________**_________________
>>    Digikam-users mailing list
>>    Digikam-users at kde.org <mailto:Digikam-users at kde.org>
>>    https://mail.kde.org/mailman/**listinfo/digikam-users<https://mail.kde.org/mailman/listinfo/digikam-users>
>>
>>
>>
>>
>>
>> ______________________________**_________________
>> Digikam-users mailing list
>> Digikam-users at kde.org
>> https://mail.kde.org/mailman/**listinfo/digikam-users<https://mail.kde.org/mailman/listinfo/digikam-users>
>>
>
> --
> "There is only love, and then oblivion. Love is all we have
> to set against hatred." (paraphrased) Ian McEwan
>
> Guy Stalnaker
> jimmyg521 at gmail.com
>
> ______________________________**_________________
> Digikam-users mailing list
> Digikam-users at kde.org
> https://mail.kde.org/mailman/**listinfo/digikam-users<https://mail.kde.org/mailman/listinfo/digikam-users>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/digikam-users/attachments/20120409/f70548c0/attachment.html>


More information about the Digikam-users mailing list