Page 1 of 2

is there a script to resize images?

Posted: 30 Dec 2009 12:22
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.

Re: is there a script to resize images?

Posted: 30 Dec 2009 12:59
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...

Re: is there a script to resize images?

Posted: 30 Dec 2009 14:49
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.

Re: is there a script to resize images?

Posted: 30 Dec 2009 15:23
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..

Re: is there a script to resize images?

Posted: 02 Jan 2010 09:29
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.

Re: is there a script to resize images?

Posted: 02 Jan 2010 09:34
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

Re: is there a script to resize images?

Posted: 02 Jan 2010 09:54
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!

Re: is there a script to resize images?

Posted: 03 Jan 2010 12:22
by little titty
Thanks serendipity, thats exactly what I was wanting and extra!

Re: is there a script to resize images?

Posted: 05 Jan 2010 12:28
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

Re: is there a script to resize images?

Posted: 05 Jan 2010 13:45
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.

Re: is there a script to resize images?

Posted: 05 Jan 2010 14:41
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

Re: is there a script to resize images?

Posted: 05 Jan 2010 17:55
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...

Re: is there a script to resize images?

Posted: 05 Jan 2010 18:33
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*/

Re: is there a script to resize images?

Posted: 05 Jan 2010 18:59
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.

Re: is there a script to resize images?

Posted: 05 Jan 2010 19:06
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