473,739 Members | 6,655 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.second s."
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
Imagecopyresamp led 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
Imagecopyresamp led 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 1883

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

Similar topics

2
2699
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 40+. Not always the same place but it's either 38th or 39th image, which I find strange as it's not consistent. At first I thought it was a timeout problem so I added - set_time_limit(0); and ignore_user_abort (true); to prevent it timing out,...
12
4056
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 compare string lengths afterwards, you would know whether or not the line contained invalid characters. The new method is more than 10x faster than the standard 'if char in string' test! So - here's the code plus sample timings: ''' Translate...
4
3080
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 huge test classes, I started to think about splitting classes. Basically you have at least three obvious choises, if you are going for consistency in your test modules: Choise a:
5
4728
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 of their product. For each image uploaded (max 500Kb), I'll be resizing it to create a small, medium and large version after which I'll discard the original. My worry is that as the site becomes more popular, the processor time spent resizing...
27
3787
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 ported from VB3 to VB6, a job which took over two years. We would like to port it to Python, but we need to continue to offer upgrades and fixes to the current VB6 version. Does anybody know of ways we could go about rewriting this, one screen at a...
5
2394
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 it. It reads in the file and sorts out the files into the four different lists. F.txt int main 2 " " help
10
7070
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 only small sized iamages.. for eg. resizing takes place for 70 kb sized images but fails for 600kb or more.. my code is below..
22
2649
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 format this to try in the form. I have limited the field to 10 chars so I know i would have to test it with a larger field because a hacker could just rewrite the form and use a lerger field for the attempted attack. Many thanks in advance
2
10040
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 is used to access and read the value stored in it C.A variable is allocated or deallocated in memory during runtime D.A variable can be initialized at the time of its creation or later 2. The.……types feature facilitates the definition of classes...
0
8792
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9479
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9337
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9209
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8215
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4570
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3280
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2748
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2193
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.