Automate image resizing

Having discovered that my Pixel 3a sometimes takes photos in Multi-Picture mode, resulting in enormous sizes (up to 20-30MB), I’d like to know if it is feasible to automate reducing them to a reasonable size.

Using FastStone, I took one 29MB file, reduced it to 1600x1200 and 702KB, and can barely tell the difference. That is, PXL_20201004_235229663.**MP.**jpg saved as PXL_20201004_235229663.jpg.

With a text file list of all the Multi-Picture photos, it seems I should be able to automate this process. Can PowerShell invoke FastStone to do the resizing? If not, how do I accomplish that?

Grateful for any suggestions.

Dave,
welcome to the forum.

If FastStone has an API or some command line options to accomplish this it should be easy to automate this.

But there are other (easier) options I think. IrfanView has the ability to do batch jobs for converting and/or renaming. There you can do size conversions as well. So no need to do any scripting at all.

The reason I mentioned a text file list is that these photos are scattered over dozens of directories and there are non-MP photos in those directories also.

So it doesn’t look like IrfanView will work.

How do you identify those photos?

You’ll never know if you never try. :wink: Of course the developer of IrfanView included the option to load the files from a text file.

Why don’t you take a look before you judge it? :wink: :wink:

2 Likes

+1 for using IrfanView for this task.

i_view32.exe /filelist=c:\mypics.txt /resize=(1600,1200) /aspectratio /resample /convert=d:\temp\*.jpg

1 Like

The file name contains ‘.mp.’

Thanks so much for referring me to IrfanView. My photos are on a locally mapped drive so I had to do some research to find that cd didn’t work but H: does.

I would have liked to strip .MP from the name and save them in the same directory but just having a folder of the resized files is a huge plus.

This shouldn’t really be a question - it’s been meant as more food for thought. :wink: If you have a particular file type you can set up a file type filter in IrfanView. This way you don’t need to create a list of the files in advance.

Why shouldn’t that work? You just have to do it right. The proper command is

cd H:\

The trailing backslash is important in this case. :wink:

But actually you don’t need a command line at all. You can do everything from the IrfanView GUI.

That can be done after the fact with PowerShell:

In PowerShell, cd to the folder where you’ve saved the files and run this:

Get-ChildItem -filter *.mp.* | foreach {Rename-Item $_.Name -NewName ($_.Name -replace '.mp')}

That does assume that the file names are like this:
PXL_20201004_235229663.MP.jpg

In your original post, you have asterisks which usually represent wildcards so if the filename is actually something like PXL_20201004_235229663.abcd123MP.jpg then it will need to be modified.

Thanks for that. The asterisks were meant for bold type that didn’t work. I used Total Commander to do the renaming.

It’s too late now, but could either PowerShell or IrfanView scan a top-level directory, find .MP files in sub-folders, resize, rename by stripping .MP, and store back in the same folder?

Why don’t you try it yourself? IrfanView is free for personal use and it takes only a few minutes to install and to figure out what’s possible with its batch job capabilities.

It’s possible from the Irfanview GUI but the command line options are more limited as far as I can tell. There’s no option to do a replace-text rename which can be done under the batch rename options in the GUI, and it doesn’t look like it’s possible to overwrite files when using the command line either.

You can find the full list of options in the i_options.txt file in the Irfanview installation folder.

No reason why you can’t combine PowerShell and Irfanview for the task though.