Page 1 of 1
Unable to open image error 2695 & 3983
Posted: 2016-09-08T08:34:01-07:00
by tylernol
I'm trying to build a powershell script to resize all photos in a directory including the sub-directory. It appears to work, but it doesn't seem to want to open the photos. I've researched the error codes but most of them are for batch files or other command languages I'm not familiar with.
Code: Select all
Get-ChildItem C:\folder2shrink |
where {$_.PsIsContainer} |
foreach {mogrify -resize 1024x768 *.png}
Can anyone shine light on why this isn't working?
Re: Unable to open image error 2695 & 3983
Posted: 2016-09-08T09:15:32-07:00
by fmw42
I suspect it is in your powershell and not Imagemagick. I do not think those codes are Imagemagick codes. Try running your mogrify command in a terminal window outside your powershell. If that works, then the issue is your powershell script.
Often when running a script, it does not know where to find Imagemagick. Try putting the full path to mogrify. Does that work?
In the future please always provide your IM version and platform, though I see you are on Windows.
Re: Unable to open image error 2695 & 3983
Posted: 2016-09-08T12:03:09-07:00
by snibgo
I suspect the poster hasn't us given the entire error message.
I suspect the problem is that there are no *.png files in the current directory.
Re: Unable to open image error 2695 & 3983
Posted: 2016-09-08T12:38:44-07:00
by tylernol
I tried the full path to mogrify and it still threw the same error but I figured out why it was throwing it. I needed to provide Powershell.exe -Command first. Anyway, the folder I'm pointed to contains nothing but png files and a sub-folder holding more png files.. The code now looks like this:
Code: Select all
Powershell.exe -Command Get-ChildItem C:\folder2shrink |
where {$_.PsIsContainer} |
foreach {mogrify -resize 1024x768 *.png}
It follows through with no visible errors, however it doesn't run the mogrify script.
Re: Unable to open image error 2695 & 3983
Posted: 2016-09-08T12:41:52-07:00
by snibgo
Instead of mogrify, what happens if you have "dir *.png"? Do you get files listed?
Re: Unable to open image error 2695 & 3983
Posted: 2016-09-08T12:51:25-07:00
by tylernol
It still follows through but doesn't print anything, but that line typed into powershell works fine. So I guess its something with my syntax and not imagemagick.
Re: Unable to open image error 2695 & 3983
Posted: 2016-09-08T15:30:13-07:00
by fmw42
Are you sure you are changing directories to the directory that contains the png images. If you are not in the correct directory, mogrify will not have any png images to process.
I also recommend that you backup your images or use -path with mogrify to some existing empty directory where the output results should be placed.
Also note that mogrify does not traverse subdirectories.
Re: Unable to open image error 2695 & 3983
Posted: 2016-09-08T15:36:36-07:00
by snibgo
Yes. I don't know Powershell, but I think the command shown loops through directories but then does a dir or mogrify in the original directory, because there is no reference in the command to a loop variable.