For Programmers: Free Programming Magazines  


Home > Archive > PHP Language > February 2007 > to reduce kb of images









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author to reduce kb of images
den

2007-02-12, 7:59 am

is there some functions or tips for minimize at max the quality and
the kb of a image already transformed in a thumb?

I have modified a photo with imagecopyresampled and imagecreatetruecolor in
to a thumb;
the result is a thumb with sides of 100px and file dimension 3-4kb;
is possible to reduce more the kb?
Rik

2007-02-12, 7:59 am

On Mon, 12 Feb 2007 11:53:26 +0100, den <spamnot@not.not> wrote:

> is there some functions or tips for minimize at max the quality and
> the kb of a image already transformed in a thumb?
>
> I have modified a photo with imagecopyresampled and imagecreatetruecolor
> in
> to a thumb;
> the result is a thumb with sides of 100px and file dimension 3-4kb;
> is possible to reduce more the kb?


http://www.php.net/imagejpeg

bool imagejpeg ( resource $image [, string $filename [, int $quality]] )

Quality

quality is optional, and ranges from 0 (worst quality, smaller file) to
100 (best quality, biggest file). The default is the default IJG quality
value (about 75).

--
Rik Wasmus
den

2007-02-12, 7:59 am

Il Mon, 12 Feb 2007 11:59:35 +0100, Rik ha scritto:

> On Mon, 12 Feb 2007 11:53:26 +0100, den <spamnot@not.not> wrote:
>
>
> http://www.php.net/imagejpeg
>
> bool imagejpeg ( resource $image [, string $filename [, int $quality]] )
>
> Quality
>
> quality is optional, and ranges from 0 (worst quality, smaller file) to
> 100 (best quality, biggest file). The default is the default IJG quality
> value (about 75).


this function is only for Jpeg ?
imagegif and imageong haven't this option quality;

I must tested but for your experience if I have a small image (thumb) of
only 3-4kb is possible to reduce further on the kb?

Rik

2007-02-12, 7:59 am

On Mon, 12 Feb 2007 12:02:50 +0100, den <spamnot@not.not> wrote:

> Il Mon, 12 Feb 2007 11:59:35 +0100, Rik ha scritto:
>
>
> this function is only for Jpeg ?
> imagegif and imageong haven't this option quality;


Once again, read the manual:
http://www.php.net/imagepng

bool imagepng ( resource $image [, string $filename [, int $quality [, int
$filters]]] )
quality
Compression level: from 0 (no compression) to 9.
(5.1.2 Added the quality parameter.)

> I must tested but for your experience if I have a small image (thumb) of
> only 3-4kb is possible to reduce further on the kb?


Yes, it's possible. The quality will suffer offcourse, it all depends on
your needs wether this is acceptable.
--
Rik Wasmus
shimmyshack

2007-02-12, 7:59 am

On 12 Feb, 10:59, Rik <luiheidsgoe...@hotmail.com> wrote:
> On Mon, 12 Feb 2007 11:53:26 +0100, den <spam...@not.not> wrote:
>
>
> http://www.php.net/imagejpeg
>
> bool imagejpeg ( resource $image [, string $filename [, int $quality]] )
>
> Quality
>
> quality is optional, and ranges from 0 (worst quality, smaller file) to
> 100 (best quality, biggest file). The default is the default IJG quality
> value (about 75).
>
> --
> Rik Wasmus


you could call imagmagick behind the scenes (cron or real time) to
further optimise any images you've made, it appears to be better
quality than gd

Steven Mocking

2007-02-12, 6:59 pm

den wrote:
> is there some functions or tips for minimize at max the quality and
> the kb of a image already transformed in a thumb?
>
> I have modified a photo with imagecopyresampled and imagecreatetruecolor in
> to a thumb;
> the result is a thumb with sides of 100px and file dimension 3-4kb;
> is possible to reduce more the kb?


Others have answered the question, but you might want to check:

Are you using the right image compression algo (PNG, JPEG, GIF) for the job?
Why would you want further compression? Perhaps a few pennies spent on
bandwidth instead would be worth it.
Would vector graphics like SVG perhaps be better suited?
Are there many unnecessary colors in the GIF image?
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com