منتدى قسم تكنولوجيا المعلومات في مدرسة الدوحة الثانوية المستقلة للبنين
علمت أن رزقي لن يأخذه غيري فاطمأن قلبي

قم وذق طعم الصلاة في دجى الليل الطويل

قم وجاهد في الحياة ان مثوانا قليل
منتدى قسم تكنولوجيا المعلومات في مدرسة الدوحة الثانوية المستقلة للبنين
علمت أن رزقي لن يأخذه غيري فاطمأن قلبي

قم وذق طعم الصلاة في دجى الليل الطويل

قم وجاهد في الحياة ان مثوانا قليل
منتدى قسم تكنولوجيا المعلومات في مدرسة الدوحة الثانوية المستقلة للبنين
هل تريد التفاعل مع هذه المساهمة؟ كل ما عليك هو إنشاء حساب جديد ببضع خطوات أو تسجيل الدخول للمتابعة.

منتدى قسم تكنولوجيا المعلومات في مدرسة الدوحة الثانوية المستقلة للبنين

من أفضل مدارس قطر
 
الرئيسيةأحدث الصورالتسجيلدخول
قال الامام احمد بن حنبل: إن لنا إخوان لانراهم إلا مره كل سنه , نحن اوثق بمودتهم ممن نراهم كل يوم .أسعد الله قلوبا طاهره إن وصلناها شكرت وإن قصرنا عذرت
من العظماء من يشعر المرء فى حضرته أنه صغير ولكن العظيم بحق هو من يشعر الجميع في حضرته بأنهم عظماء
كم في المقابر من يحسدونك على هذه الأيام والليالي التي تعيشها يتمنون لو تسبيحة أو استغفار ينفعهم عند ربهم أو سجدة تنير قبورهم أو صدقة تظلهم بين يدي الملك الجبار .. فقط تذكر .. ولا تضيع الفرصة التي بين يديك

 

 System.Drawing.Image Performance

اذهب الى الأسفل 
2 مشترك
كاتب الموضوعرسالة
A.Tamimi
Admin
A.Tamimi


Posts : 1593
أهمية العضو : 16
Join date : 13/11/2008
Age : 38
Location : Jordan

System.Drawing.Image Performance Empty
مُساهمةموضوع: System.Drawing.Image Performance   System.Drawing.Image Performance Emptyالأربعاء ديسمبر 03, 2008 6:00 am

System.Drawing.Image Performance Jgw23310

System.Drawing.Image Performance


As I mentioned earlier, I wrote an application called JPEG Hammer for manipulating and viewing EXIF data in digital photos. As a .NET Application the single biggest performance bottleneck has been:
Image photo = Image.FromFile(fileName, true);


For a 6.1 megapixel (3008 x 2000) 1.47 MB JPEG it took on the order of 631
milliseconds to load. Multiply this by 50 or so photos and you are
talking about 32 seconds to fully load these pictures. Then add the
time necessary to draw the UI for the app, update thumbnails etc. On a
1.8 ghz Pentium 4 I'd expect more... and lets just say it's no where
near as fast as the XP Shell (or other non .NET phot apps), so what
gives?
Well, after much Googling (with no success) I tried http://support.microsoft.com/ and I came across this gem (Microsoft KB 831419):
FIX: Slow performance when you call System.Drawing.Image.FromStream to load a bitmap image
So, curious as I am, I get my hands on this hotfix which updates:

  • System.Windows.Forms.dll
  • System.Design.dll
  • System.Drawing.dll

Specifically, this update adds a new method to System.Drawing.Imaging:
System.Drawing.Image.FromStream(Stream stream, bool useICM, bool validateImageData)


This is essentially a new signature for an existing method:System.Drawing.Image.FromStream(Stream stream, bool useICM)

As you can see, validateImageData is a new parameter. Setting it to true is the default behavior that we have today (essentially the same as calling FromStream(Stream stream, bool useICM)).
So I made a change to my application. Before my code looked like this:using (Image photo = Image.FromFile(this.fileInfo.FullName, true))
{
//do stuff
}


So I changed it to:
using
(FileStream fs = new FileStream(this.fileInfo.FullName, FileMode.Open, FileAccess.ReadWrite))
{
using (Image photo = Image.FromStream(fs, true, false))
{
// do stuff
}
}


And here are the results. The average time it took to process 37
JPEGs taken from the same camera and roughly the same size went from 631ms to 6.76ms. So, this new method is 93x faster.
Holy Cow!!! I thought that maybe something was wrong, so I re-ran the
tests many times, and always got the same result. Simply mind boggling.
This probably brings the .NET implementation to the same speed as
writing native C code against GDI .
The good news is that the article mentions that this fix will get
rolled into the next Service Pack. However, you'll need to modify your
code as I did to take advantage of this.

System.Drawing.Image Performance Jewels13


الرجوع الى أعلى الصفحة اذهب الى الأسفل
https://falcons.aforumfree.com
M.ALS3OD

M.ALS3OD


Posts : 854
أهمية العضو : 0
Join date : 13/09/2009
Age : 30
Location : AMMAN

System.Drawing.Image Performance Empty
مُساهمةموضوع: رد: System.Drawing.Image Performance   System.Drawing.Image Performance Emptyالسبت سبتمبر 19, 2009 1:30 am

يــعــطــيــك الــعــافــيـــة
الرجوع الى أعلى الصفحة اذهب الى الأسفل
 
System.Drawing.Image Performance
الرجوع الى أعلى الصفحة 
صفحة 1 من اصل 1
 مواضيع مماثلة
-
» how to delete image from foder
» لتغيير احجام الصور مع الحفاظ على جودتها VSO Image Resizer 1.
» System Lockdown Policy
» System Update Policy

صلاحيات هذا المنتدى:لاتستطيع الرد على المواضيع في هذا المنتدى
منتدى قسم تكنولوجيا المعلومات في مدرسة الدوحة الثانوية المستقلة للبنين :: ----§§§§ المنتديات التقنية والبرمجية §§§§---- :: قسم الدوت نت لتطوير الويب والديسكتوب-
انتقل الى: