Answer the question
In order to leave comments, you need to log in
What are sessions used for in Django?
What are sessions used for in Django?
PS If it's not difficult, please, a detailed answer or a link to a good answer.
Answer the question
In order to leave comments, you need to log in
If in linux'e/*bsd, then you can use the imagemagick package. You get something along the lines of:
for IMAGE in *jpg ; do convert $IMAGE -resize 100x100 ${IMAGE/.jpg/}_small.jpg ; done
If the process does not need to be automated, you can try the free Faststone image viewer
www.faststone.org/
It is possible like this:
<?php
function image_resize($src, $dst, $width, $height, $crop=0)
{
if(!list($w, $h) = getimagesize($src))
return false;// "Unsupported picture type!";
$type = strtolower(substr(strrchr($src,"."),1));
if($type == 'jpeg') $type = 'jpg';
switch($type)
{
case 'bmp': $img = imagecreatefromwbmp($src); break;
case 'gif': $img = imagecreatefromgif($src); break;
case 'jpg': $img = imagecreatefromjpeg($src); break;
case 'png': $img = imagecreatefrompng($src); break;
default : return false; // "Unsupported picture type!"
}
// resize
if($crop)
{
if($w < $width or $h < $height)
return false; // "Picture is too small!"
$ratio = max($width/$w, $height/$h);
$h = $height / $ratio;
$x = ($w - $width / $ratio) / 2;
$w = $width / $ratio;
} else {
if($w < $width and $h < $height)
return false // "Picture is too small!"
$ratio = min($width/$w, $height/$h);
$width = $w * $ratio;
$height = $h * $ratio;
$x = 0;
}
$new = imagecreatetruecolor($width, $height);
// preserve transparency
if($type == "gif" or $type == "png")
{
imagecolortransparent($new,
imagecolorallocatealpha($new, 0, 0, 0, 127));
imagealphablending($new, false);
imagesavealpha($new, true);
}
imagecopyresampled($new, $img, 0, 0, $x, 0, $width, $height, $w, $h);
switch($type)
{
case 'bmp': imagewbmp($new, $dst); break;
case 'gif': imagegif($new, $dst); break;
case 'jpg': imagejpeg($new, $dst); break;
case 'png': imagepng($new, $dst); break;
}
return true;
}
If Windows:
I use XnView. There is also batch processing with a bunch of settings.
no heavyweights needed. under Windows there is an excellent Resize Pictures utility from Microsoft itself. Embedded in the context menu.
If you need for Windows, then there are a lot of programs:
Free
- PIXresizer
Paid -
Light Image Resizer
Batch Image Resizer
Picture Resize Genius
I can recommend a good program for Macintosh. It's called Resize. One negative, since OS X Lion (10.7) it is not supported.
How to use:
1. Open the program;
2. Select a folder with pictures;
3. Set the resolution;
4. Start the process and wait for the result.
You can also use online services, or native iPhoto. But for mass resizing, I still advise you to use the Resize program.
irfan view can resize by a bunch of parameters, + watermarks and a million other goodies, the function is called batch.
Try the free IrfanView.
There is a special tool with quite flexible settings for both resizing and renaming.
If that File -> Batch Conversion/Rename
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question