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.Format16bppRgb555))
{
newImg.SetResolution(72, 72);
using (Graphics g = Graphics.FromImage(newImg))
{
g.Clear(Color.White);
g.InterpolationMode = InterpolationMode.HighQualityBilinear;
g.SmoothingMode = SmoothingMode.HighSpeed;
g.PixelOffsetMode = PixelOffsetMode.HighSpeed;
g.CompositingQuality = CompositingQuality.HighSpeed;
g.DrawImage(img, new Rectangle(0, 0, width, height), new
Rectangle(0, 0, img.Width, img.Height), GraphicsUnit.Pixel);
}
ImageCodecInfo[] info = ImageCodecInfo.GetImageEncoders();
EncoderParameters parameters = new EncoderParameters(1);
parameters.Param[0] = new
EncoderParameter(System.Drawing.Imaging.Encoder.Qu ality, 85L);
newImg.Save(thumbnailPath, info[1], parameters);
} 4 6548 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.Format16bppRgb555))
{
newImg.SetResolution(72, 72);
using (Graphics g = Graphics.FromImage(newImg))
{
g.Clear(Color.White);
g.InterpolationMode = InterpolationMode.HighQualityBilinear;
g.SmoothingMode = SmoothingMode.HighSpeed;
g.PixelOffsetMode = PixelOffsetMode.HighSpeed;
g.CompositingQuality = CompositingQuality.HighSpeed;
g.DrawImage(img, new Rectangle(0, 0, width, height), new
Rectangle(0, 0, img.Width, img.Height), GraphicsUnit.Pixel);
}
ImageCodecInfo[] info = ImageCodecInfo.GetImageEncoders();
EncoderParameters parameters = new EncoderParameters(1);
parameters.Param[0] = new
EncoderParameter(System.Drawing.Imaging.Encoder.Qu ality, 85L);
newImg.Save(thumbnailPath, info[1], parameters);
}
Have you tried the GetThumbnailImage method?
--
Göran Andersson
_____ http://www.guffa.com
On Feb 12, 4:35 pm, Göran Andersson <g...@guffa.comwrote:
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.Format16bppRgb555))
{
newImg.SetResolution(72, 72);
using (Graphics g = Graphics.FromImage(newImg))
{
g.Clear(Color.White);
g.InterpolationMode = InterpolationMode.HighQualityBilinear;
g.SmoothingMode = SmoothingMode.HighSpeed;
g.PixelOffsetMode = PixelOffsetMode.HighSpeed;
g.CompositingQuality = CompositingQuality.HighSpeed;
g.DrawImage(img, new Rectangle(0, 0, width, height), new
Rectangle(0, 0, img.Width, img.Height), GraphicsUnit.Pixel);
}
ImageCodecInfo[] info = ImageCodecInfo.GetImageEncoders();
EncoderParameters parameters = new EncoderParameters(1);
parameters.Param[0] = new
EncoderParameter(System.Drawing.Imaging.Encoder.Qu ality, 85L);
newImg.Save(thumbnailPath, info[1], parameters);
}
Have you tried the GetThumbnailImage 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 de*******@gmail.com wrote:
On Feb 12, 4:35 pm, Göran Andersson <g...@guffa.comwrote:
>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.Format16bppRgb555)) { newImg.SetResolution(72, 72); using (Graphics g = Graphics.FromImage(newImg)) { g.Clear(Color.White); g.InterpolationMode = InterpolationMode.HighQualityBilinear; g.SmoothingMode = SmoothingMode.HighSpeed; g.PixelOffsetMode = PixelOffsetMode.HighSpeed; g.CompositingQuality = CompositingQuality.HighSpeed; g.DrawImage(img, new Rectangle(0, 0, width, height), new Rectangle(0, 0, img.Width, img.Height), GraphicsUnit.Pixel); } ImageCodecInfo[] info = ImageCodecInfo.GetImageEncoders(); EncoderParameters parameters = new EncoderParameters(1); parameters.Param[0] = new EncoderParameter(System.Drawing.Imaging.Encoder. Quality, 85L); newImg.Save(thumbnailPath, info[1], parameters); }
Have you tried the GetThumbnailImage 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 GetThumbnailImage 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
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.Format16bppRgb555))
{
newImg.SetResolution(72, 72);
using (Graphics g = Graphics.FromImage(newImg))
{
g.Clear(Color.White);
g.InterpolationMode = InterpolationMode.HighQualityBilinear;
g.SmoothingMode = SmoothingMode.HighSpeed;
g.PixelOffsetMode = PixelOffsetMode.HighSpeed;
g.CompositingQuality = CompositingQuality.HighSpeed;
g.DrawImage(img, new Rectangle(0, 0, width, height), new
Rectangle(0, 0, img.Width, img.Height), GraphicsUnit.Pixel);
}
ImageCodecInfo[] info = ImageCodecInfo.GetImageEncoders();
EncoderParameters parameters = new EncoderParameters(1);
parameters.Param[0] = new
EncoderParameter(System.Drawing.Imaging.Encoder.Qu ality, 85L);
newImg.Save(thumbnailPath, info[1], parameters);
}- Hide quoted text -
- Show quoted text -
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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...
|
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,
|
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...
|
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...
|
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...
|
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,...
|
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...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
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...
|
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...
|
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...
|
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...
|
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,...
|
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...
|
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...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
| |