is there a script to resize images?

Discuss and share scripts and script files...
little titty
Posts: 81
Joined: 15 Nov 2009 19:34

is there a script to resize images?

Post by little titty »

it could either have set sizes and resolutions or allow custom sizes or both'
I'm thinkign about when you make web sites and you need to resize pictures (downsize them) for the web so the resolution would be 72 or 75 ppi instead of a whopping 300 or so.
Why doesn't everybody have a great user name like mine?

admin
Site Admin
Posts: 66259
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: is there a script to resize images?

Post by admin »

If you find an imaging software with command line parameters... that could be wrapped in a script. But XY is a file manager...

xman
Posts: 133
Joined: 28 Nov 2009 22:57

Re: is there a script to resize images?

Post by xman »

I would recommend ImageMagick:
http://www.imagemagick.org

Open source, works form command line, has no problem with multi-gigabyte images (larger than available RAM), supports many image formats etc. You just need to invest some time to learning this beast.

j_c_hallgren
XY Blog Master
Posts: 5826
Joined: 02 Jan 2006 19:34
Location: So. Chatham MA/Clearwater FL
Contact:

Re: is there a script to resize images?

Post by j_c_hallgren »

admin wrote:If you find an imaging software with command line parameters... that could be wrapped in a script.
And I would suggest IrFanView which is free and I've been using it since my Win98 sys, though not in command line mode so my knowledge of those features is minimal...It's my primary program for converting BMP's to JPG's from scanner and renaming and such..
Still spending WAY TOO much time here! But it's such a pleasure helping XY be a treasure!
(XP on laptop with touchpad and thus NO mouse!) Using latest beta vers when possible.

cpusrvc
Posts: 56
Joined: 02 Jan 2010 06:51
Location: S. Florida, USA
Contact:

Re: is there a script to resize images?

Post by cpusrvc »

I second the suggestion to use Irfanview. It's to images what XYplorer is to files. It also has a large plug-in library, downloadable as a single file.

It has an extensive command line mode that can do just about anything you need.

serendipity
Posts: 3360
Joined: 07 May 2007 18:14
Location: NJ/NY

Re: is there a script to resize images?

Post by serendipity »

cpusrvc wrote:I second the suggestion to use Irfanview. It's to images what XYplorer is to files. It also has a large plug-in library, downloadable as a single file.

It has an extensive command line mode that can do just about anything you need.
There is already a IrfanView script:
http://www.xyplorer.com/xyfc/viewtopic. ... 457#p39457

j_c_hallgren
XY Blog Master
Posts: 5826
Joined: 02 Jan 2006 19:34
Location: So. Chatham MA/Clearwater FL
Contact:

Re: is there a script to resize images?

Post by j_c_hallgren »

serendipity wrote:There is already a IrfanView script:
http://www.xyplorer.com/xyfc/viewtopic. ... 457#p39457
:oops: Sorry! I never did a search here to see what existed for it, if any...and I'd not used that script so had totally forgotten about it...thanks!
Still spending WAY TOO much time here! But it's such a pleasure helping XY be a treasure!
(XP on laptop with touchpad and thus NO mouse!) Using latest beta vers when possible.

little titty
Posts: 81
Joined: 15 Nov 2009 19:34

Re: is there a script to resize images?

Post by little titty »

Thanks serendipity, thats exactly what I was wanting and extra!
Why doesn't everybody have a great user name like mine?

little titty
Posts: 81
Joined: 15 Nov 2009 19:34

Re: is there a script to resize images?

Post by little titty »

oh big problm with the script.
I have ifanview ver 4.2.50 so maybe that has something to do with it.
I tried to resize a picture and there was a fault as i hadnt set the path correctly. I fixed that but the problem is now the left side pane doesnt function at all! I mean it doesnt show any files. I have tried switching to one pane and back but cant get it to work again. The right pane works fine.
Also with resizing, it doesnt work. I mean I tried 300x300 and 500x 500 but both produce a 1x1pixel image!
Sorry the Pane issue is now fine, something to do with visual filters, now working fine.
xy version 8.80.08
Why doesn't everybody have a great user name like mine?

serendipity
Posts: 3360
Joined: 07 May 2007 18:14
Location: NJ/NY

Re: is there a script to resize images?

Post by serendipity »

little titty wrote:oh big problm with the script.
Also with resizing, it doesnt work. I mean I tried 300x300 and 500x 500 but both produce a 1x1pixel image!
Are you using the correct syntax? it should be (300 , 300).
Also, what image are you trying to resize?
I just tried with jpg and with IV version 4.2.50 and it works fine for me.

little titty
Posts: 81
Joined: 15 Nov 2009 19:34

Re: is there a script to resize images?

Post by little titty »

yes I am using the correct syntax - I think as the first 2 times I left the default of 300x300 and didnt type in anything just clicked ok after that didnt work i tried 500x500
The images I tried were normal .jpg will try again now that I know its working for you with the same ver of irfanview

ok tried a few more times, tried using default again (300 ,300) got the same 1px image
tried different sizes still not working. Strange.
the image I used was .jpg 2048x1536 rgb 24bit
the resize part of the script reads:

/*RESIZE SCRIPTS : START*/
"&4. RESIZE|i_view32 /2 : resize"
sub _assert;
load *, "resize;-;res;-;_back;can;"

"- Resize images : res"
sub _assert;
global $g_IrfanPath;
$count= getinfo("CountSelected");
IF ($count == 0) {
sub "_unselected";
}

ELSE {
$selected=getinfo("SelectedItemsNames", "|");
filter "$selected";
focus;
input $backup, "Before resizing original files will be backed up to <curpath>\originals (you can change this below)", "<curpath>\originals";
backupto "<curpath>\originals";
input $dimensions, "Convert files to what dimensions (width, height)? (Current files will not be overwritten)", "(300 ,300)";
sel 1;
$curpos=0;
WHILE ($count > $curpos) {
$curpos = getinfo ("FocusedPos");
run """$g_IrfanPath""<curitem> /resize=$dimensions /aspectratio /resample /convert <curitem> /killmesoftly",,1;
sel +1;
}
}
filter;
status "Conversion finished"

/*RESIZE SCRIPTS : END*/

have tried the script to do other things
rotate right, works but the oringinal image (not the one that gets backed up) the thumbnail just has "bad image" written on it, but if you go out of the folder and back - then it looks fine.
I also tried rotate, upside down
the first time xyplorer crashed, but on restarting it the picture had indeed been turned but 180 not 360.
The second time I tried rotate upside down xy didnt crash but even if you go out of the folder and then back to it the imge is still unchanged i.e. not rotated - at least it seems but if you open info panel and the preview tab it is upside down. So the thumnails are not been updated somehow.
rotate left works fine and the thumbnail is show correctly immediately - you dont have to go out of the folder and back. Curious though the file size gets changed a lot from 1.5mb to .8 though the image dimensions stay the same! according to preview info panel anyway
Why doesn't everybody have a great user name like mine?

PeterH
Posts: 2827
Joined: 21 Nov 2005 20:39
Location: DE W11Pro 24H2, 1920*1200*100% 3840*2160*150%

Re: is there a script to resize images?

Post by PeterH »

@little titty
Perhaps you should write code in a code-box?
Just mark the text of the code, and click the Code-button above the input field.
The code will be much better to read then...

little titty
Posts: 81
Joined: 15 Nov 2009 19:34

Re: is there a script to resize images?

Post by little titty »

Code: Select all

/*RESIZE SCRIPTS : START*/ 
"&4. RESIZE|i_view32 /2 : resize"
  sub _assert;
    load *, "resize;-;res;-;_back;can;"
  
"- Resize images : res"
    sub _assert;
    global $g_IrfanPath;
    $count= getinfo("CountSelected");
   IF ($count == 0) {
   sub "_unselected";
   }
   
   ELSE {
   $selected=getinfo("SelectedItemsNames", "|");
   filter "$selected";
   focus;
   input $backup, "Before resizing original files will be backed up to <curpath>\originals (you can change this below)", "<curpath>\originals";
   backupto "<curpath>\originals";
   input $dimensions, "Convert files to what dimensions (width, height)? (Current files will not be overwritten)", "(300 ,300)";
   sel 1;
   $curpos=0;
   WHILE ($count > $curpos) {
   $curpos = getinfo ("FocusedPos");
   run """$g_IrfanPath""<curitem> /resize=$dimensions /aspectratio /resample /convert <curitem> /killmesoftly",,1;
   sel +1;
   }
   }
   filter;
   status "Conversion finished"   
   
/*RESIZE SCRIPTS : END*/
Why doesn't everybody have a great user name like mine?

serendipity
Posts: 3360
Joined: 07 May 2007 18:14
Location: NJ/NY

Re: is there a script to resize images?

Post by serendipity »

little titty wrote:yes I am using the correct syntax - I think as the first 2 times I left the default of 300x300 and didnt type in anything just clicked ok after that didnt work i tried 500x500
The images I tried were normal .jpg will try again now that I know its working for you with the same ver of irfanview

ok tried a few more times, tried using default again (300 ,300) got the same 1px image
tried different sizes still not working. Strange.
the image I used was .jpg 2048x1536 rgb 24bit
Hmmm, I have the exact same code as you do. So you say you do not get any errors, but the end result is 1x1 pix image? right?

Just to be sure,
1) You select bunch of files
2) run the script and select Resize.
3) You get couple of options before the actual script, like backup originals etc.
4) when script runs you see a wait popup and then it ends.
5) you see a new image now with 1px.

Is that right?
If not, Can you send me the image by any chance? I can see if thats the problem.

little titty
Posts: 81
Joined: 15 Nov 2009 19:34

Re: is there a script to resize images?

Post by little titty »

yes thats right for resize but rotate left works fine
I will try and send you one of the images - although I did try it on 3 or 4 different one.
here is a link to one
http://cid-7fdf15eb29fd8b2f.skydrive.li ... %20002.jpg

here is another - I only tried to resize it (although it need rotating) and got a 1px dot!
http://cid-7fdf15eb29fd8b2f.skydrive.li ... %20006.jpg

but realy it works for you and not for me so what we need is a 3rd party? to try it
Why doesn't everybody have a great user name like mine?

Post Reply