473,397 Members | 2,056 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

FYI: Test Results Comparing Different Methods of Resizing Images

I posted this in alt.php, but as a reply, so now I'm posting it here for
people
who might have missed it but still could find it useful. Thanks to Andy
Hassall for
giving me good information.

I compared the smooth image resampling used in PHP to create good quality
thumbnails of large images, used commonly in image galleries. i compared
ImageMagick and PHP (with GD2) and compiled some statistics below.
I ran two test. Both used a set of 10 photos around 3MP in size. On the
first
test, I created two thumbnails for each photo, one 700 pixels in width and
another at 120 pixels in width. On the second test, I created just one
thumbnail, 120 pixels in width. Time was counted in "minutes.seconds."
TEST#1 -- IMAGEMAGICK*
-----------------------------------------------------------
METHOD TIME IMAGE QUALITY
thumbnail 1.33 good
sample 0.24 bad
resize 1.33 good
size/geometry 0.42 good

TEST #1 -- GD2 (PHP)
-----------------------------------------------------------
METHOD TIME IMAGE QUALITY
Imagecopyresampled 1.57 good
TEST#2 -- IMAGEMAGICK*
-----------------------------------------------------------
METHOD TIME IMAGE QUALITY
thumbnail 0.26 good
sample 0.19 bad
resize 1.13 good
size/geometry 0.06 good

TEST #2 -- GD2 (PHP)
-----------------------------------------------------------
METHOD TIME IMAGE QUALITY
Imagecopyresampled 0.56 good
*ImageMagick Command Methods:
thumbnail : convert -thumbnail $destSize $sourceFile $targetFile
sample : convert -sample $destSize $sourceFile $targetFile
resize : convert -resize $destSize $sourceFile $targetFile
size/geometry : convert -size $destSize $sourceFile -geometry $destSize
$targetFile

CONCLUSIONS:
-----------------------------------------------------------
There were four different imagemagick commands I tried out in all. Overall,
the winner came out to be the imagemagick command. This
method beat out PHP by a good margin, creating thumbnails in about 1/3 the
time it took PHP with similar quality in the first test, and then taking the
cake
in the second test by creating thumbnails in about 1/10 the time as PHP.

Imagemagick seems to increase in performance compared to PHP when creating
a smaller thumbnail versus a relatively large thumbnail, as seen by test #2
versus test #1. This means that a site creating small thumbnails will see
even more of an advantage by using Imagemagick.

The fraction of the time it takes for imagemagick to create smaller
thumbnails makes it almost necessary to use for dynamically created
thumbnail galleries that need to trim resources.

MR

Jul 17 '05 #1
0 1868

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Alex Hopson | last post by:
I'm using the code below to loop through some images and resize each image twice, once to create a thumbnail and once to create a small image. The page stops loading around the 38th image out of...
12
by: Kamilche | last post by:
I was looking for a way to speed up detecting invalid characters in my TCP string, and thought of yet another use for the translate function! If you were to 'translate out' the bad characters, and...
4
by: Edvard Majakari | last post by:
Hi, I just found py.test and converted a large unit test module to py.test format (which is actually almost-no-format-at-all, but I won't get there now). Having 348 test cases in the module and...
5
by: Jim | last post by:
I've heard that resizing images through PHP (either GD2 or ImageMagick) is a processor intensive exercise. I'm setting up a site where users will be uploading up to 10 images along with the details...
27
by: Josh | last post by:
We have a program written in VB6 (over 100,000 lines of code and 230 UI screens) that we want to get out of VB and into a better language. The program is over 10 years old and has already been...
5
by: Little | last post by:
I have this program and I need to work on the test portion, which tests if a Val is in the list. It returns false no matter what could you look at the part and see what might need to be done to fix...
10
by: mishrarajesh44 | last post by:
hii all, I am facing a problem currently.. i have a script for image uploading and resizing.. the image uploading takes place properly for every size images.. but, the resizing works for...
22
by: Voodoo Jai | last post by:
I have a page the uses a form to pass a postcode to another page and I want to test it against an SQL Injection. What would be a safe (i.e NO DELETING of data ) statement to try and how would I...
2
by: hcaptech | last post by:
This is my Test.can you help me ? 1.Which of the following statement about C# varialble is incorrect ? A.A variable is a computer memory location identified by a unique name B.A variable's name...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.