Click to See Complete Forum and Search --> : Best ways to lower image file sizes?
Ben Rogers
05-28-2004, 06:46 PM
I was wondering if there are any programs that could crunch down file sizes without losing too much quality. My own Photodeluxe doesn't squash file sizes down all too much, and I need to make the images load faster (or, in my Dial up case, at all.)
If it matters, the images (http://projep.t35.com/ren/header.jpg) in question (http://projep.t35.com/ren/splash.jpg) are JPEGs, and T35 (http://www.t35.com/) is very weird in some ways... one of those ways being the lack of support for PNGs. Go figure.
Note: I ran a few searches, and I couldn't find any results matching what I wanted.
Thanks in advance. :D
Your links are dead...
Does the PHP install on t35 support the GD Design Libray? I've noticed that PHP can compress images better than photoshop for the most part. Note this (http://web20.omnis.com/samin001/pics/102_thumb.jpg) image compressed with photoshop (15kb), and this (http://web20.omnis.com/samin001/pics/101_thumb.jpg) image compressed with the PHP GD (2kb). The photoshop image couldn't be compressed any more without pixelating
Ben Rogers
05-28-2004, 07:24 PM
Sorry about that... it has to do with T35's restrictions on hotlinking. Would you mind showing me the code you used to compress those images? T35 doesn't have GD Design Libray compatibilities I don't think, but I could use the script on my own server, and then save the resulting compressed image... Ah, the beauty of server side scripting ;)
Thanks again.
well, the script that created those actually just auto-thumbed a directory, but here's the script:
Important! Make sure you put the thumbs in a different directory than the pics (a directory below the pics would be best), otherwise you'll throw yourself into an infinite loop.
<?php
$dir="/path/to/www/pics/";
$i=0;
if (is_dir($dir))
{
if ($dh = opendir($dir))
{
while (($file = readdir($dh)) !== false)
{
1if($i<2)
{
$i++;
}
else
{
$im = @imagecreatefromjpeg($dir . $file);
$xsize = imagesx($im);
$ysize = imagesy($im);
$finalx = 100;
$finaly = ($finalx/$xsize)*$ysize;
$newim = imagecreatetruecolor($finalx, $finaly);
$file1=explode(".",$file);
imagecopyresampled($newim, $im, 0, 0, 0, 0, $finalx, $finaly, $xsize, $ysize);
ImageJpeg ($newim,$dir . $file1[0] . '_thumb.jpg',75);
ImageDestroy ($newim);
ImageDestroy ($im);
echo "/path/to/www/thumbs" . $file . '<br />';
echo '<img src="/pics/' . $file1[0] . '_thumb.jpg" alt="' . $file1[0] . '" /><br />';
}
}
closedir($dh);
}
}
?>
The Cheat
05-28-2004, 07:33 PM
you could try the
gimp (http://www2.arnes.si/~sopjsimo/gimp/)
and/or
irfanview (http://www.irfanview.com/)
(ifanview is an excellent general image viewer for windows, it loads extrememely fast and loads practicly all image file types. It also comes with a few goodies and one of them is that it can convert file types)
The Cheat
05-28-2004, 07:35 PM
ImageJpeg ($newim,$dir . $file1[0] . '_thumb.jpg',75);
The 75 on that line, that's the compression quality right? The lower the number the more it compresses, but also the lower the quality. Correct?
It is indeed. I didn't try with any lower or higher, but 75 seems suiting.
Ben Rogers
05-28-2004, 08:11 PM
I have irfanview, but it doesn't seem to lower file sizes. I'll download GIMP though, it looks promising. And, Sam, I'll try out that script.
Thanks again. :D
Ben Rogers
05-28-2004, 08:21 PM
Note... I don't think I have GD compatibilites at all, unless I screwed up THAT badly when modding that script to only create smaller file sized duplicates...
try this:
<?php
if(function_exists('ImageJpeg')
{
echo "GD Supported";
}
?>
If you don't have the GD, you won't get the echo. If that is the case, you can download the GD here (http://www.boutell.com/gd/)
Aronya1
05-29-2004, 12:42 PM
Originally posted by omega
I have irfanview, but it doesn't seem to lower file sizes.
I've been using Irfanview for a long time. It definitely does reduce file size as well as, or better than, anything else I've ever seen. You need to adjust settings. That's all. Why don't you post one of your images to the thread?
Ben Rogers
05-29-2004, 01:36 PM
I have, in my first post, but they don't show up when you click on the link because of T35's hotlinking rules, I think anyways. As for irfanview, I actually downloaded it for that reason, but it never seemed to do much. Could you maybe give me an example of the settings that I'd need to change? I'm downloading GD now, btw...
Thanks. (I really should just put "Thanks" in my siggy. :rolleyes: )
Aronya1
05-29-2004, 01:56 PM
If you attach a file to your post, it gets uploaded to the website, not hotlinked, so I don't understand the issue there. But anyway...
Open an image in Irfanview.
Click on Image, Resize/Resample
First of all (just to be anal about it & cover the bases), smaller image size will mean a smaller file size, so if your images are large, reduce the size. Remember to keep 'Preserve aspect ratio' checked.
Check the DPI setting. Web standard is 72. If the number is higher, reduce it.
Click OK & save your image with a new name.
Compare with the original. If there's not much difference, use this method:
Open image
Click on File, Batch Conversion/Rename
Navigate to your image
Select the image(s) you want to use
Click Add
Set your output directory. If you use one other than where the originals are kept, you do not need to worry about renaming the files.
Set your Output format (usually .jpg)
Click Options
Set Save Quality to 70%. That will usually give you a greatly reduced file size, with little-to-no loss of image quality. Experiment.
Use the Set Advanced Options area with care.
When you have finished configuring your settings, click Start. The process will take no time at all.
Good luck.
Ben Rogers
05-29-2004, 02:20 PM
Apologies... I must still be tired... I wasn't thinking, at all. Period. I don't know why I didn't notice the changes in file size... it might have something to do with not working with large files before. What probably happened was I used to have very small images in ifranview, and then try to optimize them, and irfranview couldnt do anything for them. Or maybe I'm making up excuses for my general laziness and stupidity. Who knows? :p Well anyways, i would actually reccomend about 55%.. it didn't seem to do any harm to image quality, and the end file size was 30kb, from a 274kb image (Around 10% of the original image). I just find it strange that the image doesn't look like junk after all that...
but if its over 10k (15 maybe), it won't let you attach it, and if its that small, you probably don't have compression issues
Aronya1
05-29-2004, 02:23 PM
No problem. If you're that tired, maybe you should drop in to the Coffee Lounge & have a cappucino... :p
Aronya1
05-29-2004, 02:25 PM
Originally posted by Sam
but if its over 10k (15 maybe), it won't let you attach it, and if its that small, you probably don't have compression issues Max file size is 100k, I believe.
Ben Rogers
05-29-2004, 11:44 PM
No, I just never thought to attach it at all.
Paul Jr
05-30-2004, 12:53 AM
Wow, Sam's right. I just took an image (that I had already created and “optimized” ), duplicated it and compressed it with PHP, then put it up next to the original, and I can't see (with my bad sight) any difference--the filesize was cut by about 23.3K
I'll see if I can't attach both images.
Aronya1
05-30-2004, 01:16 PM
Here's Irfanview's result compressed at 70% quality.
Ben Rogers
05-30-2004, 02:16 PM
Here's Aronya's pic compressed at 65%. Lost a few KB. :D
Aronya1
05-30-2004, 02:19 PM
Hard to tell the difference. Goes to show, you just have to play around a little with the settings on things. Some images would start to look grainy at 65%. Others can go substantially lower without much noticeable difference.
Ben Rogers
05-30-2004, 02:32 PM
Actually it'd be 65% of 70%, which was 75% of 100%, right? So it's like 45% of the original file size... or did I flukk up?
Aronya1
05-30-2004, 02:41 PM
I think you're right. Here it is at 45% from the original.
Ben Rogers
05-30-2004, 02:59 PM
No, it must've been more, because that image is much smaller than mine.
Originally posted by Paul Jr
Wow, Sam's right. I just took an image (that I had already created and “optimized” ), duplicated it and compressed it with PHP, then put it up next to the original, and I can't see (with my bad sight) any difference--the filesize was cut by about 23.3K
I'll see if I can't attach both images.
Yeah, its quite nice. Look at this zip file too, it was able to compress the original by 18%, but wasn't able to compress the compressed one any more.
Aronya1
05-30-2004, 04:01 PM
I don't know, Sam. It's so small now, I can't even find it! :p
yes, but there's definately quality loss on the ifranview, I put them up together and alt tabbed back and forth, a lot of the detail in the lettering goes away
Ben Rogers
05-30-2004, 04:08 PM
It's not that noticable IMO. And the lowered file size is worth it.
Aronya1
05-30-2004, 04:09 PM
Originally posted by Aronya1
I don't know, Sam. It's so small now, I can't even find it! :p Ahh, that was supposed to be a joke... There's no zip file attached to your previous post...Look at this zip file too, it was able to compress the original by 18%, but wasn't able to compress the compressed one any more.
Ben Rogers
05-30-2004, 04:23 PM
Heh... I got that... really....
I was talking about paul's zip (Note the quote)