LebGeeks

A community for technology geeks in Lebanon.

You are not logged in.

#1 April 15 2009

mir
Member

How to Resize a set of pictures

I have a set of pictures... like 20 - 30 pics
i want to re size them in order to reduce their size in order to upload them faster and set them to standard width/height

your help is appreciated.. cuz uploading pic on a lebanese connection is causing me heart attacks ... ma2 dayen !

and i am not the type that will resize shi 50 pic maslan in photoshop 

hope u got what i need.
thanks for the help !

Offline

#2 April 15 2009

proners
Member

Re: How to Resize a set of pictures

Well in my opinion DO use photoshop  quite easy, ... if you insist on not using photoshop, download and install WAMP, make a script(form_to_script) using gd2 library functions to achieve your goal ... if i have some free time later, i'll write the script

Offline

#3 April 15 2009

rolf
Member

Re: How to Resize a set of pictures

there is scripting in photoshop. You can record a macro then apply it to a whole directory.
Of course there are other tools. Paint.NET is a freeware that can resize photos, but i dont know if it can do batch/script/macro resizing.
In my opinion, use photoshop, if you have it, because i think it will provide the best quality.
Look in the Window menu for Actions, and in the File menu for Automate. use these to create a macro to resize the photo at your specification (its easy, just a matter of clicking record, resizing the picture, then clicking stop).
Then use automate to apply on all photos in the directory.

Last edited by rolf (April 15 2009)

Offline

#4 April 15 2009

mir
Member

Re: How to Resize a set of pictures

*scratch mi head

oh thanks for the help guys ... it sounds scary a bit ... i will take a look at the whole automation stuff
I will try to learn doing it bl photoshop, cuz i can re-use this skill later

btw i know gimp has script fu as well.. i want to learn it to put it on CV as joke

so.. no external software , with resize all ... next ... next and finish ?

--EDIT :
thanks rolllff !! it worked !  YaY !
still if any external software ... next next finish will do it.. let me know.. cuz someone might be in charge of the resizing and it would be easier for me to explain

Last edited by mir (April 15 2009)

Offline

#5 April 15 2009

proners
Member

Re: How to Resize a set of pictures

so i've made a quick and dirty jab at resizing using wamp, this is just for one image, a few adjustments are needed to automate the process for multiple images

first page: html form

<head><title>form_to_supply_images_to_script</title></head>

<body>
	<form name="images_form" action="handle_images.php" method=POST enctype="multipart/form-data">
	<fieldset>
	
	<input type=file name=limage /> <br />;

	</fieldset>
	<input type="submit" value="Process" />
	</form>
</body>

</html>

now handle_images.php code:

<?php
$img = $_FILES['limage'];
//image attributes made simpler
$img_name = $img['name'];
$img_size = $img['size'];
$img_type = $img['type'];
$img_tmp = $img['tmp_name'];

$img_ext = substr(strrchr( $img_name, "."), 1); // get extension
$img_ext = strtolower($img_ext); // to avoid some bugs

// here i am supposing that we're only working with jpg images, if not, it destroys the file and stops the script
if(($img_ext != "jpg") && ($img_ext != "jpeg"))
{
unlink($img_tmp);
die("file supplied is not an image");
}


list($width, $height) = getimagesize($img_tmp); //get image with and height

$src = imagecreatefromjpeg($img_tmp); // create a source image to use, raw image!


$new_width = 100; //resized image width, change this value to the one required
$new_height = ($height/$width)*$new_width; // to keep the aspect ratio

$tmp = imagecreatetruecolor($new_width,$new_height); //temporary image where resized image will be put


imagecopyresampled($tmp,$src,0,0,0,0,$new_width,$new_height,$width,$height); // the main trick 


imagejpeg($tmp,$img_name,100); // create jpeg image from raw $tmp with the name $image_name with 100 percent quality, reduce quality to reduce size

Last edited by proners (April 15 2009)

Offline

#6 April 15 2009

proners
Member

Re: How to Resize a set of pictures

nice, i didn't know that photoshop had this feature ...

p.s.: weird, dates of posts got messed up if you notice

Offline

#7 April 15 2009

battikh
Member

Re: How to Resize a set of pictures

my sister advises pixresizer (http://bluefive.pair.com/pixresizer.htm), she's the uploading-pics-to-facebook freak...  (don't tell her i said that )

Offline

#8 April 15 2009

mir
Member

Re: How to Resize a set of pictures

really thank you so much proner for taking the time :) ... really appreciate :) it didn't go to waste

battikh.. me is downloading and checking.. don't speak of uploading-pics-to-facebook-freaks  3mol ma3rouf ! at least not on a lebanese forum.. almost everyone will be offended

well all ways are helpful in a way or another.. i like hte photoshop way , i like proner way and battikh way :)

appreciate the help guys.. you rock \m/ .. ma bta3rfo adeish wafarto 3layeh !

Offline

#9 April 15 2009

samer
Admin

Re: How to Resize a set of pictures

If you happen to be on a mac, you can use Automator to create custom macros quickly and easily :)

Offline

#10 April 15 2009

mir
Member

Re: How to Resize a set of pictures

thanks samer for suggestion..

battikh : tell ur sister ano her software ma bifout yibrom bl folders inside the folder  ano mush hal2ad sa3beh to do <pf> so u can't keep ur folder structure

but other than this.. it works great

Offline

#11 April 15 2009

battikh
Member

Re: How to Resize a set of pictures

^^ she7adeh w msharta <pf>

Offline

#12 April 15 2009

beezer
Member

Re: How to Resize a set of pictures

I use the standard Windows resizer powertoy when I don't care about quality of results. Select your files, right click, resize, enter resolution. Bam.

Offline

#13 January 24 2010

ijanawra
Member

Re: How to Resize a set of pictures

Hi, I'm on Mac, and I know (beginner level) how to use Automator, but I don't know how to resize pictures in batch, can you tell me how please?  Thanks

Offline

#14 January 24 2010

Georges
Member

Re: How to Resize a set of pictures

Microsoft Office Picture Manager is the fastest way to do the job !
just select the containing the photos. click the thumbnail icon [top left side of the application]

then, edit pictures --> resize

and Done.

As simple as it looks w "Bala Tfelsof chabeb" ;)

Last edited by Yorgi (January 24 2010)

Offline

#15 January 24 2010

BashLogic
Member

Re: How to Resize a set of pictures

there are two ways that i do it, either i use the microsoft powertoys image resize, or what i preffer to do is use
image magick. it really does amazing stuff beating all and it is fast. here is an example:

for i in `ls $1|grep JPG`; do echo converting $i;convert $1/$i -resize $2% $1/resized/$i;done

i have another one linder that uses more parameters which is more efficient but its on another pc which is not turned on right now so have to check it later and post it...

Offline

#16 January 24 2010

samer
Admin

Re: How to Resize a set of pictures

ijanawra wrote:

Hi, I'm on Mac, and I know (beginner level) how to use Automator, but I don't know how to resize pictures in batch, can you tell me how please?  Thanks

Drag/drop your items to the workflow, then search for an action called "Scale Images" - the rest should be easy :)

Offline

#17 January 25 2010

pikatore
Member

Re: How to Resize a set of pictures

Use Picasa.

Offline

#18 January 27 2010

richy
Member

Re: How to Resize a set of pictures

I don't believe how I wasted so much time resizing every picture on its own.

Offline

#19 January 27 2010

xterm
Moderator

Re: How to Resize a set of pictures

richy wrote:

I don't believe how I wasted so much time resizing every picture on its own.

Welcome to lebgeeks.

Offline

#20 January 28 2010

nablaux
Member

Re: How to Resize a set of pictures

Well I guess the easiest way is to write a for loop in c++ that reads all the images and then resize them. To do that, use a library called CImg.h it is just a header file that you include and that is it.
After that, read all images in the folder and put them in an imageList and then loop the imageList and invoke the function resize on each image then save it.

If you choose to take that path and found problems let me know I can post some code :)

Offline

#21 January 28 2010

arithma
Member

Re: How to Resize a set of pictures

There's also ImageMagick. I am using it right now to resize a set of pictures in hierarchical folders. I just hated C++ Win32 folders and ANSI/UNICODE difference so much that I couldn't take it and went hugging C#. Works like a charm. One thing is for sure, Win32 code is really a dog that Microsoft just hides away behind the pretty .Net interfaces. It's a shame.

Offline

#22 January 28 2010

Ayman
Member

Re: How to Resize a set of pictures

Win32 code is really a dog that Microsoft just hides away behind the pretty .Net interfaces. It's a shame.

True.

Offline

#23 January 28 2010

arithma
Member

Re: How to Resize a set of pictures

xterm wrote:
richy wrote:

I don't believe how I wasted so much time resizing every picture on its own.

Welcome to lebgeeks.

I wasted 10 hours figuring out how to resize images I could have done in 2 hours.. - well most of the time was setting up ImageMagick which is hell, but still: welcome to lebgeeks !

Offline

#24 January 28 2010

Joe
Member

Re: How to Resize a set of pictures

nablaux wrote:

Well I guess the easiest way is to write a for loop in c++ that reads all the images and then resize them. To do that, use a library called CImg.h it is just a header file that you include and that is it.
After that, read all images in the folder and put them in an imageList and then loop the imageList and invoke the function resize on each image then save it.

If you choose to take that path and found problems let me know I can post some code :)

I would still use a bash script over a C++ code. But still I'm interested. Where do I get CImg.h? Is it a standard library?

Offline

#25 January 29 2010

richy
Member

Re: How to Resize a set of pictures

Thank you.

xterm wrote:
richy wrote:

I don't believe how I wasted so much time resizing every picture on its own.

Welcome to lebgeeks.

Offline

Board footer