![]() |
|
|||||||
| Notice |
| Off topic Chat about anything not related to EntropiaUniverse. |
![]() |
|
|
LinkBack | Thread Tools |
|
|
#1 | ||||||
|
Elite
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Maybe anyone here has experience with this. When create thumbs in ASP.NET using the standard bitmap class the result will look like this:
![]() When I zoom out the picture in PSP it looks like this: ![]() I also tried using the internal resize methods (Smartsize, Bicubic, Bilinear etc) in PSP but those all have worse results. It seems when zooming out, PSP is using windows resizing algorithms or something. Does anyone know what method is used? And does anyone know if I can also use that method in ASP.NET? I tried searching on google but didnt realy know where to start looking. |
||||||
|
|
|
| Sponsored Links |
|
|
#2 | |||||||
|
Old Alpha
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Quote:
Are you saying that the asp.net bitmap class produces rubbish results when you scale an image down to a smaller (thumbnail) size, and you want to get better results? I'm pretty sure PSP uses an antialiased technique to scale images down, whereas the .net Bitmap.GetThumbnailImage will most likely not. Can you maybe do the scaling youself - create a Graphics object associated with an in-memory DC (ie your target thumbnail bitmap) and set the Graphics.SmoothingMode property to achieve antialised/smoothed drawing. Render your original onto the new Graphics object using the DrawImage method, with the target rectangle specified to scale it down, then you have your new scaled thumbnail bitmap. I don't know if this is what you were after, but it might help. |
|||||||
|
__________________
![]() KP's current objective: looting pixie feet, 1200SG Achieved objectives: 1000 SG, 200 Conc What is weapon economy
|
||||||||
|
|
|
|
|
#3 | |||||||
|
Elite
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Quote:
I will give your suggestion a try, tnx. I will report later if it works.EDIT: Hmm I cant find this SmoothingMode property at all. Is is a standard property? EDIT2: nm, found it ![]() Last edited by Witte; 08-03-2007 at 11:14.. |
|||||||
|
|
|
|
|
#4 | ||||||||||
|
Nakia's Property & l t;3 Love You
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
Posts:
Gender:
Ingame: ![]() Avatar Name:
Loke MrSmith Smith Soc: Novus Ordo Seclorum
Location: In the arms of Nakia
|
Use the System.Drawing.Imaging library
Quote:
Quote:
Quote:
Saving the thumbnail to disk Quote:
![]() Last edited by MrSmith; 08-03-2007 at 11:16.. |
||||||||||
|
|
|
|
|
#5 | |||||||
|
Old Alpha
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Quote:
Hence why I thought set g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias But I could be wrong here. Maybe it only uses antialiasing for drawing primitives like lines and not for bmp scaling. I'd be interested to know what you find works. |
|||||||
|
|
|
|
|
#6 | ||||||
|
Elite
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Tnx for all input. I will try the different modes and see what gives the best result. Although I am currently figuring out how to write the graphics object to a stream
(I know im noob at this hehe)My code so far: Code:
using (Bitmap bmp = new Bitmap(img, width, height))
{
Graphics g = Graphics.FromImage(bmp);
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
g.FillRectangle(Brushes.Transparent, 0, 0, fwidth, fheight);
g.DrawImage(img, (fwidth-width)/2, (fheight-height)/2, width, height);
MemoryStream mstream = new MemoryStream();
\
return mstream;
}
|
||||||
|
|
|
|
|
#7 | |||||||
|
Nakia's Property & l t;3 Love You
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
Posts:
Gender:
Ingame: ![]() Avatar Name:
Loke MrSmith Smith Soc: Novus Ordo Seclorum
Location: In the arms of Nakia
|
Quote:
Most image manipulation programs like Photoshop and PaintShop Pro support many of the same Interpolation modes. So both for making image smaller and larger ![]() |
|||||||
|
|
|
|
|
#8 | |||||||
|
Old Alpha
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Quote:
![]() To save it to a stream witte bmp.Save(mstream, ImageFormat.xxxxxx) ought to work. I used this to write an on-the-fly created bmp directly to the output stream in asp.net. ie you can put Response.OutputStream where I put mstream above. But I think using your memory stream would work too. xxxxx can be whatever format you want - see the ImageFormat enum. Jpeg, gif, whatever. hf ![]() |
|||||||
|
|
|
|
|
#9 | |||||||
|
Elite
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Quote:
![]() Tnx allot all. |
|||||||
|
|
|
|
|
#10 | ||||||
|
Elite
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
It doesnt realy work as it should, the resulting image doesnt resize. My code looks like this:
Code:
using (Bitmap bmp = new Bitmap(img))
{
Graphics g = Graphics.FromImage(bmp);
//g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
g.FillRectangle(Brushes.Transparent, 0, 0, fwidth, fheight);
g.DrawImage(bmp, (fwidth-width)/2, (fheight-height)/2, width, height);
MemoryStream mstream = new MemoryStream();
bmp.Save(mstream, ImageFormat.Png);
return mstream;
}
![]() ![]() ![]() EDIT ow i think i see it now looking at MRsmiths example one mom ![]() |
||||||
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
|
|
| EntropiaTracker.com Global Trends | ||
| Hunting Globals: -22.19 % | Mining Globals: -29.36 % | Crafting Globals: + 5.04 % |
| EntropiaTracker.com Latest Uber Loots |