Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Suggestions for image resizing

147 views
Skip to first unread message

Cyberdine

unread,
Apr 22, 2006, 9:52:17 PM4/22/06
to
To: alt.msdos.batch
I need to batch resize a group of images from the command line. I'm not
having any luck finding a program that can do this without keeping the
original aspect ratio. Any suggestions?
--- Synchronet 3.13a-Win32 NewsLink 1.83
Cyberdine Systems BBS -[ telnet://cyberdine.servegame.com]-

foxidrive

unread,
Apr 23, 2006, 1:17:13 AM4/23/06
to
On Sun, 23 Apr 2006 01:52:17 GMT, Cyberdine wrote:

> To: alt.msdos.batch
> I need to batch resize a group of images from the command line. I'm not
> having any luck finding a program that can do this without keeping the
> original aspect ratio. Any suggestions?

Irfanview?

Timo Salmi

unread,
Apr 23, 2006, 7:27:59 AM4/23/06
to
foxidrive wrote:
> On Sun, 23 Apr 2006 01:52:17 GMT, Cyberdine wrote:
>> I need to batch resize a group of images from the command line.
>> I'm not

> Irfanview?

A good suggestion, but I even if I have it installed myself, I have
no knowledge if it can resize from the command line. And if so, how.
Anybody?

All the best, Timo

--
Prof. Timo Salmi ftp & http://garbo.uwasa.fi/ archives 193.166.120.5
Department of Accounting and Business Finance ; University of Vaasa
mailto:t...@uwasa.fi <http://www.uwasa.fi/~ts/> ; FIN-65101, Finland
Useful batch files and tricks ftp://garbo.uwasa.fi/pc/link/tsbat.zip

foxidrive

unread,
Apr 23, 2006, 7:44:41 AM4/23/06
to
On Sun, 23 Apr 2006 14:27:59 +0300, Timo Salmi wrote:

> foxidrive wrote:
>> On Sun, 23 Apr 2006 01:52:17 GMT, Cyberdine wrote:
>>> I need to batch resize a group of images from the command line.
>>> I'm not
>
>> Irfanview?
>
> A good suggestion, but I even if I have it installed myself, I have
> no knowledge if it can resize from the command line. And if so, how.
> Anybody?
>
> All the best, Timo

Here's a quick and dirty batch I had laying around - Lines will wrap.

There is a file in the irfanview folder outlining the command line options.

@echo off
if [%1]==[/?] echo. Purpose: convert/recompress graphic files with Irfanview
if [%1]==[/?] echo.
if [%1]==[/?] echo. Syntax: %0 [filespec.ext extension]
if [%1]==[/?] echo.
if [%1]==[/?] echo. example: %0 *.gif jpg
if [%1]==[/?] echo.
if [%1]==[/?] echo. with no parameters it defaults to all JPG in the current directory
if [%1]==[/?] echo. with ! as a parameter it resamples all JPG to 1024*768
if [%1]==[/?] echo. with !! as a parameter it resamples all JPG to 800*600
if [%1]==[/?] echo.
if [%1]==[/?] echo. (files are saved in .\!convert folder)
if [%1]==[/?] echo.
if [%1]==[/?] goto :EOF

if not [%2]==[] start "" /w "c:\Program Files\Iview32\i_view32.exe" .\%1 /convert=!convert\*.%2
if not [%2]==[] echo Done! & goto :EOF

if not [%1]==[!] if not [%1]==[!!] if not [%1]==[] %0 /?

echo processing *.JPG in the current directory
if [%1]==[!!] start "" /w "c:\Program Files\Iview32\i_view32.exe" .\*.jpg /resample=(800,600) /aspectratio /jpgq=80 /convert=!convert\*.jpg
if [%1]==[!] start "" /w "c:\Program Files\Iview32\i_view32.exe" .\*.jpg /resample=(1024,768) /aspectratio /jpgq=80 /convert=!convert\*.jpg
if [%1]==[] start "" /w "c:\Program Files\Iview32\i_view32.exe" .\*.jpg /jpgq=80 /convert=!convert\*.jpg

echo Done!

Sjouke Burry

unread,
Apr 23, 2006, 10:40:28 AM4/23/06
to
"Graphics workshop" does nice batch conversion/scaling etc.

Alchemy Mindworks
Creator of graphic and desktop applications for business, school and
home. Software to edit and manage image files and TruType fonts.
www.mindworkshop.com/alchemy/alchemy.html

I am just a (retired) user for some years.

Ted Davis

unread,
Apr 23, 2006, 12:23:41 PM4/23/06
to
On Sun, 23 Apr 2006 01:52:17 GMT, "Cyberdine"
<cybe...@cyberdine.servegame.com.remove-v9b-this> wrote:

> To: alt.msdos.batch
>I need to batch resize a group of images from the command line. I'm not
>having any luck finding a program that can do this without keeping the
>original aspect ratio. Any suggestions?

ImageMagick (<http://www.imagemagick.org/script/index.php>). There
isn't much you *can't* do with images from the command line using the
tools in this package. It's free and open source.

convert -resize 5% foo bar

will make a 5% thumbnail of foo as bar - the format can be changed in
the process. Note: when running multiple processes on JPEGs, have the
first convert command also convert to a bitmapped format such as PSD
and the last one convert back to JPEG to avoid loosing too much
picture quality.

You can also specify an absolute image size

convert -resize 200x300 foo bar

to change the aspect ratio.

I use utilities from the package with batch files and gawk scripts
to rotate, resize, add date/time stamps, and add comments (JPEGs).
The latest work can be seen by clicking on the "Toomey Hall
construction pictures" link on my WildBlue home page:
<http://users.wildblue.net/daviste/>. (Avoid the "Annex" link because
it has over 300 images on it - the "Toomey" page has only 85 as of
last Friday.)

--
T.E.D. (tda...@gearbox.maem.umr.edu)

Timo Salmi

unread,
Apr 23, 2006, 2:30:59 PM4/23/06
to
foxidrive wrote:
> On Sun, 23 Apr 2006 14:27:59 +0300, Timo Salmi wrote:
>> foxidrive wrote:
>>> Irfanview?

>> A good suggestion, but I even if I have it installed myself, I
>> have no knowledge if it can resize from the command line. And if
>> so, how.

> Here's a quick and dirty batch I had laying around - Lines will


> wrap. There is a file in the irfanview folder outlining the
> command line options.

Excellent. Thank you. This was exactly the kind of information I
needed to get going. Your posting made me look again at the Irfanview
help and I then saw the list of the Command Line Options. I had
missed it earlier. That was crucial.

Timo Salmi

unread,
Apr 24, 2006, 12:21:01 AM4/24/06
to
Timo Salmi wrote:
> foxidrive wrote:
>> On Sun, 23 Apr 2006 14:27:59 +0300, Timo Salmi wrote:
>>> foxidrive wrote:
>>>> Irfanview?
(snip)

> Your posting made me look again at the Irfanview help and I then
> saw the list of the Command Line Options. I had missed it earlier.
> That was crucial.

Below is what I subsequently wrote to make 80x60 images from a set of
digicam photos. I am including alt.msdos.batch.nt and redirecting
followups since my solution is for the XP.

@echo off & setlocal enableextensions
::
echo +----------------------------------------------------------+
echo : IRSCALED.CMD Resize a set of .jpg images to 80x60 pixels :
echo : By Prof. Timo Salmi, Last modified Sun 23-Apr-2006 :
echo +----------------------------------------------------------+
echo.
::
:: Set the defaults
set ir="C:\Program Files\IrfanView\i_view32.exe"
set sourceDir=C:\_L\VALITYS
set targetDir=C:\_L\VALITYS\SCALED
set sourceDir=C:\_M
set targetDir=C:\_M\SCALED
set pixW=80
set pixH=60
::
:: Is help needed
if "%~1"=="?" goto _help
if "%~1"=="/?" goto _help
if /i "%~1"=="/help" goto _help
::
:: If necessary, create the target folder
if not exist %targetDir% mkdir %targetDir%
::
:: Convert with Irfanview command line
rem Add /aspectratio if you want to force keeping the image
proportions
for %%f in (%sourceDir%\*.JPG) do (
start "" /wait %ir% %%~ff /resample=^(%pixW%,%pixH%^) /jpgq=75
/convert=%targetDir%\%%~nf.scaled%%~xf
)
::
:: Show the results
dir %targetDir%
goto _out
::
:_help
echo Usage: IRSCALED
echo.
echo Default source folder: %sourceDir%
echo Default target folder: %targetDir%
::
:_out
endlocal & goto :EOF

All the best, Timo

--
Prof. Timo Salmi ftp & http://garbo.uwasa.fi/ archives 193.166.120.5
Department of Accounting and Business Finance ; University of Vaasa
mailto:t...@uwasa.fi <http://www.uwasa.fi/~ts/> ; FIN-65101, Finland

Useful script files and tricks ftp://garbo.uwasa.fi/pc/link/tscmd.zip

charles

unread,
Apr 24, 2006, 12:35:43 PM4/24/06
to
On Sun, 23 Apr 2006 01:52:17 GMT, "Cyberdine"
<cybe...@cyberdine.servegame.com.remove-v9b-this> wrote:

> To: alt.msdos.batch
>I need to batch resize a group of images from the command line. I'm not
>having any luck finding a program that can do this without keeping the
>original aspect ratio. Any suggestions?

Take a look at NConvert from Pierre Gougelet who also produces XnView

<http://perso.wanadoo.fr/pierre.g/xnview/en_nconvert.html>

Not open source but it is free (non-commercial use).

0 new messages