?
Solved

Image resize

Posted on 2014-04-07
9
Medium Priority
?
383 Views
Last Modified: 2014-04-13
Hello,

I have a collection of images for my Visual Basic.NET app they are in a .png format which are 32x32 pixels in size and I am trying to find a way of resizing them without looing the quality and detail however, I have not been so successful so far.

Can anyone recommend any other method.
0
Comment
Question by:lincstech
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +3
9 Comments
 
LVL 6

Expert Comment

by:xeroxzerox
ID: 39982446
yes ..you can do it on photoshop. make a frame and put it in it.
It's simple.
0
 
LVL 39

Expert Comment

by:Pratima Pharande
ID: 39982460
I think you can try this

using System.Drawing;

Bitmap img = (Bitmap)Bitmap.FromStream(FileUploadPost.PostedFile.InputStream);
Bitmap newImg = new Bitmap(maxWidth, maxHeight, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
newImg.SetResolution(72, 72);
Graphics newGraphic = Graphics.FromImage(newImg);
newGraphic.Clear(Color.Transparent);
newGraphic.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
newGraphic.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
newGraphic.DrawImage(img, 0, 0, maxWidth, maxHeight);
System.Drawing.Imaging.ImageFormat format = default(System.Drawing.Imaging.ImageFormat);
string ext = Path.GetExtension(FileUploadPost.PostedFile.FileName);
switch (ext.ToLower())
{
    case ".gif":
        format = System.Drawing.Imaging.ImageFormat.Gif;
        break;
    case ".png":
        format = System.Drawing.Imaging.ImageFormat.Png;
        break;
    default:
        format = System.Drawing.Imaging.ImageFormat.Jpeg;
        break;
}
newImg.Save(myPath, format);

Open in new window


this is in C# try to convert in VB
refer
http://stackoverflow.com/questions/21367007/asp-net-image-resizing-quality
0
 

Author Comment

by:lincstech
ID: 39982633
@xeroxzerox

Do you have any tutorials on the photo shop method. ?
0
Interactive Way of Training for the AWS CSA Exam

An interactive way of learning that will help you visualize core concepts so that you can be more effective when taking your AWS certification exam.  Built for students by a student to help them understand the concepts that they are being taught.

 
LVL 6

Expert Comment

by:xeroxzerox
ID: 39982637
0
 
LVL 16

Expert Comment

by:Kalpesh Chhatrala
ID: 39983587
you can use below Image Resize Free Library.

http://imageresizer.codeplex.com/
0
 
LVL 38

Expert Comment

by:Tom Beck
ID: 39985780
I am trying to find a way of resizing them without looing the quality and detail however,

How much quality could there be in a 32 x 32 pixel image? How much bigger do you intend to make the images?

You can't get something for nothing. Photoshop can increase the resolution and the size, but the additional pixel information is interpolated based on the original pixels (Google "image interpolation in Photoshop").  When increasing size and/or resolution, Photoshop takes the original pixels, spreads them out over a larger grid and fills in the spaces between with similarly colored pixels. The added image information is computer interpreted rather than real world. Sharpness is also interpreted and you can vary the amount added by playing with the Bicubic Smoother or Bicubic Sharper settings. But computers cannot pick out the edges of objects in the foreground and background the way the human mind can when looking at a photo. As a result, sharpness cannot be added in a way that improves the separation of objects in the image. To the computer it's all two dimensional. It simply looks for contrasts between adjoining pixels and increases those contrasts to make the image appear sharper. You could increase the size of your 32 x 32 images to 64 x 64 or even go to 128 x 128, but more than that, and the quality will probably be unacceptable.
0
 

Author Comment

by:lincstech
ID: 39986739
It's not down to making the image bigger its when I resize the image and make it smaller if you resize a 32x32 icon to 16x16 you'll see what I'm talking about or I can attach an icon that I'm using ?
0
 
LVL 38

Accepted Solution

by:
Tom Beck earned 1000 total points
ID: 39987202
Smaller? Didn't get that from the question.

It definitely depends on your image. Still, there's not much to work with, a 16 x 16 image means 256 pixels total.

Example:
32 x 32 reduced to 16 x 16
0
 
LVL 40

Assisted Solution

by:Jacques Bourgeois (James Burger)
Jacques Bourgeois (James Burger) earned 1000 total points
ID: 39987802
.png being a raster graphics image format / pixel based(http://en.wikipedia.org/wiki/Raster_graphics), you will always lose some quality when you resize an image, except if very specific cases such as the square in a square of Tom's sample.

In order to enlarge, pixels have to be added. In order to make smaller, pixels have to be removed. Since half pixels do not exist, it's impossible for the system to do a good job. The results are usually less worse when you resize by a factor that is a multiple of 2.

They are usually worst when you start with a small image, such as your 32x32 than if you were working from a bigger image, because the resizer has more information to work with.

Images that resize without losing quality are vector based. Instead of being composed of dots as a .png is, they are composed of instructions that tell how to recreate the image. This enables the system to adjust the pixels for the best possible appearance for a given screen or output peripheral.
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to convert a multi-page PDF file into multiple image files, with one image file created for each page of the PDF. It does this by utilizing an excellent, free software package called GraphicsMagick. The solution is amazingly s…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Users will learn how resize a batch of photos from a single command in Photoshop via Photoshop's Image Processor. Open up an Image you'd like to resize in Adobe Photoshop: Adjust the image size according to your preferences. Image > Adjustments > …
The goal of the tutorial is to teach the user how to make his/her own presets while editing so it is easier to edit there photos. Create a preset you like and copy that setting then save it in to your presets folder.
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question