HomeHome Product Discus... Product Discus...SmithCartSmithCartThumbnail GenerationThumbnail Generation
Previous
 
Next
New Post
11/2/2010 6:27 AM
 

Certainly not a show-stopper, but thumbnail generation isn't working well. New products added through the store administration screen that generate thumbnails automatically are "Fuzzy". Customer-complaint fuzzy. I ended up re-generating my thumbnails manually using the Image Resizer PowerToy.

Just an FYI. Like I said, in the grand scheme of things, it's certainly not a show-stopper, just something that could perhaps be looked at when you guys get some down time.

 
New Post
11/2/2010 8:19 AM
 
We've been using Paint Shop Pro to automate our image generation. FYI. I think it's like $50 or something phenomenally low. But there's a free 30 day trial I've installed on my client's PC so she can learn the process.

Basically, I have a folder OriginalImages set up on www.dropbox.com for her where we share images and store the images from the source.

Then using PSP, go into Files>Batch Process... pick the images to resize from OriginalImages select the Thumbnail_150 script, then select the output directory as Thumbnails and click start. This creates all the thumbnails at once.

I noticed the thumbnail script isn't provided with the current version so you will have to search for thumbnail_150.pspscript online... or I can send it to you.
 
New Post
11/2/2010 8:53 AM
 

Here is the image resizing routine the cart uses for generating thumbnails its in its third generation so if anyone has any suggestions how to improve it please post back:

public void ResizeImage(string originalName, string originalPath, string newPath, int NewWidth, int MaxHeight)
{
if (!System.IO.File.Exists(Server.MapPath(string.Concat(newPath, originalName))))
{
string ThumbFormat = Path.GetExtension(originalName);

System.Drawing.Image original = System.Drawing.Image.FromFile(Server.MapPath(string.Concat(originalPath, originalName)));

//Calculate thumb dimensions maintaining aspect ratio
if (original.Width <= NewWidth)
{
NewWidth = original.Width;
}

int NewHeight = original.Height * NewWidth / original.Width;
if (NewHeight > MaxHeight)
{
// Resize with height instead
NewWidth = original.Width * MaxHeight / original.Height;
NewHeight = MaxHeight;
}

System.Drawing.Image result = new Bitmap(NewWidth, NewHeight);

using (Graphics g = Graphics.FromImage(result))
{
g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
g.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality;
g.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;

g.DrawImage(original, 0, 0, NewWidth, NewHeight);

using (System.IO.FileStream fs =
new System.IO.FileStream(Server.MapPath(string.Concat(string.Concat(newPath, originalName))), System.IO.FileMode.CreateNew, System.IO.FileAccess.Write))
{
switch (ThumbFormat.ToLower())
{
case ".gif":
result.Save(fs, System.Drawing.Imaging.ImageFormat.Gif);
break;
case ".jpg":
result.Save(fs, System.Drawing.Imaging.ImageFormat.Jpeg);
break;
case ".png":
result.Save(fs, System.Drawing.Imaging.ImageFormat.Png);
break;
}
}
}
}
}


Scott Kelly
Project Manager
DotNetNuke Consulting, DotNetNuke Store and DNN Ecommerce
 
New Post
11/2/2010 12:46 PM
 

Here is something that we are testing out now:

// Shrink the image using high-quality interpolation.
e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
e.Graphics.DrawImage(
image,
new Rectangle(290, 250, (int)(0.6 * width), (int)(0.6 * height)),
// destination rectangle
0,
0, // upper-left corner of source rectangle
width, // width of source rectangle
height, // height of source rectangle
GraphicsUnit.Pixel);


http://msdn.microsoft.com/en-us/library/k0fsyd4e.aspx


At your service,
Dave Smith
DotNetNuke Consulting, DotNetNuke Store and DNN Ecommerce
 
Previous
 
Next
HomeHome Product Discus... Product Discus...SmithCartSmithCartThumbnail GenerationThumbnail Generation