Using IrfanView on multiple images

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
kiwichick
Posts: 738
Joined: 08 Aug 2012 04:14
Location: Pahiatua, New Zealand

Using IrfanView on multiple images

Post by kiwichick »

Hi everyone, I have a script containing pieces of code that use IrfanView to work with image files. The problem is they only work for one file no matter how may are selected and I can't, for the life of me, figure out how to loop them for multiple files. Any help would be greatly appreciated. TIA :grin:

Code: Select all

"Convert To PNG"
   run """C:\PortableApps\IrfanView\i_view32.exe"" <curitem> /resample /convert=""<curpath>\<curbase>.png"" /killmesoftly",,1;

"Convert To JPG"
   run """C:\PortableApps\IrfanView\i_view32.exe"" <curitem> /resample /convert=""<curpath>\<curbase>.jpg"" /killmesoftly",,1;

"Convert To {input}"
   $format = input("Enter Format to be converted to.",,,s);
   run """C:\PortableApps\IrfanView\i_view32.exe"" <curitem> /resample /convert=""<curpath>\<curbase>.$format"" /killmesoftly",,1;

"Resize - maintain aspect ratio"
   $w = input("Enter new Width","Leave as 0 if new Height is to be entered.",0,s);
   $h = input("Enter new Height","Leave as 0 if new Width has already been entered.",0,s);
   run """C:\PortableApps\IrfanView\i_view32.exe"" <curitem> /resize=($w,$h) /resample /aspectratio /convert <curitem> /killmesoftly",,1;

"Resize - ignore aspect ratio"
   $w = input("New Width",,,s);
   $h = input("New Height",,,s);
   run """C:\PortableApps\IrfanView\i_view32.exe"" <curitem> /resize=($w,$h) /resample /convert <curitem> /killmesoftly",,1;
  
"Create multipage PDF from input files"
   copytext get("SelectedItemsNames", ",");
   run """C:\PortableApps\IrfanView\i_view32.exe"" /multipdf=(<curpath>\test.pdf,<clipboard>)";

"Slideshow"
   $imagesfolder = inputfolder("C:\ABBA\ABBA Pics\_Wallpaper\Wallpaper 1366x768", "Select folder for slideshow");
   run """C:\PortableApps\IrfanView\i_view32.exe"" /slideshow=""$imagesfolder""" /closeslideshow,,1;
   
"Get image info"
   $txt = "<curpath>\<curbase>info.txt";
   run """C:\PortableApps\IrfanView\i_view32.exe""<curitem> /info=$txt /killmesoftly",,1;
   open "$txt";
Windows 10 Pro 22H2
Scaling 150%

highend
Posts: 15016
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Using IrfanView on multiple images

Post by highend »

Code: Select all

    foreach($item, <get SelectedItemsPathNames>, <crlf>, "e") {
        $path = gpc($item, "path");
        $base = gpc($item, "base");
        run """C:\PortableApps\IrfanView\i_view32.exe"" ""$item"" /resample /convert=""$path\$base.png"" /killmesoftly",,1;
    }
One of my scripts helped you out? Please donate via Paypal

kiwichick
Posts: 738
Joined: 08 Aug 2012 04:14
Location: Pahiatua, New Zealand

Re: Using IrfanView on multiple images

Post by kiwichick »

highend wrote: ↑17 Aug 2021 07:25

Code: Select all

    foreach($item, <get SelectedItemsPathNames>, <crlf>, "e") {
        $path = gpc($item, "path");
        $base = gpc($item, "base");
        run """C:\PortableApps\IrfanView\i_view32.exe"" ""$item"" /resample /convert=""$path\$base.png"" /killmesoftly",,1;
    }
Thank you so much highend, I almost had it sorted myself but was obviously having a bit of a brain fart. I was changing the first <cur...> after the IrfanView path but forgot to change all the other <cur...> parts.
Windows 10 Pro 22H2
Scaling 150%

Post Reply