473,721 Members | 2,254 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

High(er) speed thumbnail generation

Im looking for a way to generate thumbnails from an image as fast as
possible. Currently I'm using GDI+ however going from 1024x768 to
100x100 takes too long. I'd imagine the whole process can be
optimized by using hardware acceleration (ie DirectX), however I am
not all that familar with the DirectX API. What I'm looking for is
some direction, or even some sample/psuedo code, that might point me
in the right direction.

If not DirectX can anyone recommend a more efficient method?

In short I want to replace the following code, with something that is
faster:

using (Bitmap newImg = new Bitmap(width, height,
PixelFormat.For mat16bppRgb555) )
{
newImg.SetResol ution(72, 72);

using (Graphics g = Graphics.FromIm age(newImg))
{
g.Clear(Color.W hite);
g.Interpolation Mode = InterpolationMo de.HighQualityB ilinear;
g.SmoothingMode = SmoothingMode.H ighSpeed;
g.PixelOffsetMo de = PixelOffsetMode .HighSpeed;
g.CompositingQu ality = CompositingQual ity.HighSpeed;

g.DrawImage(img , new Rectangle(0, 0, width, height), new
Rectangle(0, 0, img.Width, img.Height), GraphicsUnit.Pi xel);
}

ImageCodecInfo[] info = ImageCodecInfo. GetImageEncoder s();
EncoderParamete rs parameters = new EncoderParamete rs(1);
parameters.Para m[0] = new
EncoderParamete r(System.Drawin g.Imaging.Encod er.Quality, 85L);
newImg.Save(thu mbnailPath, info[1], parameters);
}

Feb 12 '07 #1
4 6565
de*******@gmail .com wrote:
Im looking for a way to generate thumbnails from an image as fast as
possible. Currently I'm using GDI+ however going from 1024x768 to
100x100 takes too long. I'd imagine the whole process can be
optimized by using hardware acceleration (ie DirectX), however I am
not all that familar with the DirectX API. What I'm looking for is
some direction, or even some sample/psuedo code, that might point me
in the right direction.

If not DirectX can anyone recommend a more efficient method?

In short I want to replace the following code, with something that is
faster:

using (Bitmap newImg = new Bitmap(width, height,
PixelFormat.For mat16bppRgb555) )
{
newImg.SetResol ution(72, 72);

using (Graphics g = Graphics.FromIm age(newImg))
{
g.Clear(Color.W hite);
g.Interpolation Mode = InterpolationMo de.HighQualityB ilinear;
g.SmoothingMode = SmoothingMode.H ighSpeed;
g.PixelOffsetMo de = PixelOffsetMode .HighSpeed;
g.CompositingQu ality = CompositingQual ity.HighSpeed;

g.DrawImage(img , new Rectangle(0, 0, width, height), new
Rectangle(0, 0, img.Width, img.Height), GraphicsUnit.Pi xel);
}

ImageCodecInfo[] info = ImageCodecInfo. GetImageEncoder s();
EncoderParamete rs parameters = new EncoderParamete rs(1);
parameters.Para m[0] = new
EncoderParamete r(System.Drawin g.Imaging.Encod er.Quality, 85L);
newImg.Save(thu mbnailPath, info[1], parameters);
}
Have you tried the GetThumbnailIma ge method?

--
Göran Andersson
_____
http://www.guffa.com
Feb 13 '07 #2
On Feb 12, 4:35 pm, Göran Andersson <g...@guffa.com wrote:
dean.g...@gmail .com wrote:
Im looking for a way to generate thumbnails from an image as fast as
possible. Currently I'm using GDI+ however going from 1024x768 to
100x100 takes too long. I'd imagine the whole process can be
optimized by using hardware acceleration (ie DirectX), however I am
not all that familar with the DirectX API. What I'm looking for is
some direction, or even some sample/psuedo code, that might point me
in the right direction.
If not DirectX can anyone recommend a more efficient method?
In short I want to replace the following code, with something that is
faster:
using (Bitmap newImg = new Bitmap(width, height,
PixelFormat.For mat16bppRgb555) )
{
newImg.SetResol ution(72, 72);
using (Graphics g = Graphics.FromIm age(newImg))
{
g.Clear(Color.W hite);
g.Interpolation Mode = InterpolationMo de.HighQualityB ilinear;
g.SmoothingMode = SmoothingMode.H ighSpeed;
g.PixelOffsetMo de = PixelOffsetMode .HighSpeed;
g.CompositingQu ality = CompositingQual ity.HighSpeed;
g.DrawImage(img , new Rectangle(0, 0, width, height), new
Rectangle(0, 0, img.Width, img.Height), GraphicsUnit.Pi xel);
}
ImageCodecInfo[] info = ImageCodecInfo. GetImageEncoder s();
EncoderParamete rs parameters = new EncoderParamete rs(1);
parameters.Para m[0] = new
EncoderParamete r(System.Drawin g.Imaging.Encod er.Quality, 85L);
newImg.Save(thu mbnailPath, info[1], parameters);
}

Have you tried the GetThumbnailIma ge method?

--
Göran Andersson
_____http://www.guffa.com- Hide quoted text -

- Show quoted text -
Yeah its just as slow and produces terrible qualtiy images when
resampling from 1024x768 down to 100x100

Feb 13 '07 #3
de*******@gmail .com wrote:
On Feb 12, 4:35 pm, Göran Andersson <g...@guffa.com wrote:
>dean.g...@gmai l.com wrote:
>>Im looking for a way to generate thumbnails from an image as fast as
possible. Currently I'm using GDI+ however going from 1024x768 to
100x100 takes too long. I'd imagine the whole process can be
optimized by using hardware acceleration (ie DirectX), however I am
not all that familar with the DirectX API. What I'm looking for is
some direction, or even some sample/psuedo code, that might point me
in the right direction.
If not DirectX can anyone recommend a more efficient method?
In short I want to replace the following code, with something that is
faster:
using (Bitmap newImg = new Bitmap(width, height,
PixelFormat.F ormat16bppRgb55 5))
{
newImg.SetResol ution(72, 72);
using (Graphics g = Graphics.FromIm age(newImg))
{
g.Clear(Color.W hite);
g.Interpolation Mode = InterpolationMo de.HighQualityB ilinear;
g.SmoothingMode = SmoothingMode.H ighSpeed;
g.PixelOffsetMo de = PixelOffsetMode .HighSpeed;
g.CompositingQu ality = CompositingQual ity.HighSpeed;
g.DrawImage(img , new Rectangle(0, 0, width, height), new
Rectangle(0 , 0, img.Width, img.Height), GraphicsUnit.Pi xel);
}
ImageCodecInfo[] info = ImageCodecInfo. GetImageEncoder s();
EncoderParamete rs parameters = new EncoderParamete rs(1);
parameters.Para m[0] = new
EncoderParame ter(System.Draw ing.Imaging.Enc oder.Quality, 85L);
newImg.Save(thu mbnailPath, info[1], parameters);
}
Have you tried the GetThumbnailIma ge method?

--
Göran Andersson
_____http://www.guffa.com- Hide quoted text -

- Show quoted text -

Yeah its just as slow and produces terrible qualtiy images when
resampling from 1024x768 down to 100x100
The speed depends on the format of the original image. If the original
file contains a thumbnail, the GetThumbnailIma ge method uses that
instead of the entire image to produce the thumbnail that you requested.

As for the quality, you have to choose. Either speed or quality.

--
Göran Andersson
_____
http://www.guffa.com
Feb 13 '07 #4
I would just use VB dotnet

any break things into multiple threads

C# does not support multi-threading, does it??


On Feb 12, 3:36 pm, dean.g...@gmail .com wrote:
Im looking for a way to generate thumbnails from an image as fast as
possible. Currently I'm using GDI+ however going from 1024x768 to
100x100 takes too long. I'd imagine the whole process can be
optimized by using hardware acceleration (ie DirectX), however I am
not all that familar with the DirectX API. What I'm looking for is
some direction, or even some sample/psuedo code, that might point me
in the right direction.

If not DirectX can anyone recommend a more efficient method?

In short I want to replace the following code, with something that is
faster:

using (Bitmap newImg = new Bitmap(width, height,
PixelFormat.For mat16bppRgb555) )
{
newImg.SetResol ution(72, 72);

using (Graphics g = Graphics.FromIm age(newImg))
{
g.Clear(Color.W hite);
g.Interpolation Mode = InterpolationMo de.HighQualityB ilinear;
g.SmoothingMode = SmoothingMode.H ighSpeed;
g.PixelOffsetMo de = PixelOffsetMode .HighSpeed;
g.CompositingQu ality = CompositingQual ity.HighSpeed;

g.DrawImage(img , new Rectangle(0, 0, width, height), new
Rectangle(0, 0, img.Width, img.Height), GraphicsUnit.Pi xel);
}

ImageCodecInfo[] info = ImageCodecInfo. GetImageEncoder s();
EncoderParamete rs parameters = new EncoderParamete rs(1);
parameters.Para m[0] = new
EncoderParamete r(System.Drawin g.Imaging.Encod er.Quality, 85L);
newImg.Save(thu mbnailPath, info[1], parameters);

}- Hide quoted text -

- Show quoted text -

Feb 14 '07 #5

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

Similar topics

6
4734
by: Alexander Muylaert | last post by:
Hi Does anyone know a good starting point about high speed string processing in C#? What I need is a very fast routine for a case insensitive "contains". e == E == é == ë == ... Kind regards
1
1990
by: Nirupam Gupta | last post by:
Hi I have been assigned a Project to develope the interface of DLP Projector the interface should be able to control the functions of Projector lik Contrast Brightness, Volume Mute,
4
1418
by: David Pendrey | last post by:
Greetings, I am writing an application which will need to move around 50 bitmaps on the form at a speed high enough that it appears smooth. I am currently using some custom controls to contain the bitmap and the logic for the movement in the same location and have have a loop which updates all bitmaps each 50ms (20fps). Unfortunatly the time taken to render this is too great and my application does not function correctly. The solution does...
4
1770
by: Dr Warehouse | last post by:
Hi, I am expanding our data warehouse solution with new filegroups on several subsystems. I want to know which idea is better! - create clustered indexes on tables to 'move' them to new filegroups - create these tables on the new filegroups.
2
2508
by: Brian C | last post by:
Hello all, I've been getting back into Windows based graphical applications after working on pure servers for work. I'm working on a utility that connects into my servers at work (they use the same message format) and just simply sends data into them and displays results (one message in from me could result in millions of asynchronous replies back from the server over the course of a day, etc). I use it to test. I currently have a Java...
3
1319
by: herbasher | last post by:
Hello! I'm wondering: I'm really not so much into heavy frameworks like Django, because I need to build a fast, simple python based webservice. That is, a request comes in at a certain URL, and I want to utilize Python to respond to that request. Ideally, I want the script to be "cached" so it doesn't have to be re-
7
502
by: Andrew Wan | last post by:
I found this excellent High Speed Timer (in Pascal). I compiled it (using Turbo Pascal 7 and it runs fine): http://www.sorucevap.com/bilisimteknolojisi/programcilik/pascal/ders.asp?207995 and same High Speed Timer here too: http://groups.google.com/group/comp.lang.pascal/browse_thread/thread/92e9398f16c10ba4/e67ff3cf587648ef?lnk=st&q=inline(%24CD)+inline(%241C)+inline(%249C)&rnum=1&hl=en#e67ff3cf587648ef I converted it to C (using p2c),...
0
8730
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
9367
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...
1
9131
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8007
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...
1
6669
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4484
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...
0
4753
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3189
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
3
2130
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.