Hello,
I use php and imagemagick to create some thumbnails.
passthru("convert -gemetry 60x40 -quality 70 -densety 72x72 $inPic $outPic");
Everything is working fine, but there filesize of the result ist very different. If I upload an jpg my result pic is something about 2 kb, if a friend uploads an file the result pic is near 30 kb up to 50 kb. The first idear I had was the dpi resulution. My pictures are already in 72 dpi before uploading. His pictures 300 dpi for upload. So I searched for changing dpi with -densety but the result of the file size is still the same. His pictures are in the right pixel size with 60x40 but his uploaded pictures are more then 10 times bigger than mine. The quality of the result is not different.
How can I change the file size.
Greetings
Lars
very different filesize after jpg upload with convert
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: very different filesize after jpg upload with convert
use -resize not -geometry to change file sizes
see
http://www.imagemagick.org/script/comma ... php#resize
also you should be reading the input before your options
convert $inPic -resize 6040 -quality 70 -density 72x72 $outPic
see
http://www.imagemagick.org/Usage/basics/#cmdline
unless you are reading in a very large jpg and then you can do some processing while reading it
see
http://www.imagemagick.org/Usage/formats/#jpg_read
see
http://www.imagemagick.org/script/comma ... php#resize
also you should be reading the input before your options
convert $inPic -resize 6040 -quality 70 -density 72x72 $outPic
see
http://www.imagemagick.org/Usage/basics/#cmdline
unless you are reading in a very large jpg and then you can do some processing while reading it
see
http://www.imagemagick.org/Usage/formats/#jpg_read
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: very different filesize after jpg upload with convert
And you should use -thumbnail instead of resize to strip out the unwanted image profiles, which is probably the cause of the excessive thumbnail size.
This strips all profiles as part of the resize. However in the latest IM releases (from v6.5.4-7), -thumbnail strips all profiles except any color profile!, you may be better off using -strip as well!
This strips all profiles as part of the resize. However in the latest IM releases (from v6.5.4-7), -thumbnail strips all profiles except any color profile!, you may be better off using -strip as well!
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/