473,387 Members | 3,781 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

How to Resize Gif Image without losing too much info?

I've got this bit of code:

Image origImage = Image.FromFile("temp.jpg");
Image newImage = new Bitmap(objNewSize.Width, objNewSize.Height,
origImage.Pixelformat);

Graphics objGraphic = Graphics.FromImage(newImage);

objGraphic.CompositingQuality = CompositingQuality.HighQuality;
objGraphic.SmoothingMode = SmoothingMode.HighQuality;
objGraphic.InterpolationMode = InterpolationMode.High;

Rectangle objRect = new Rectangle(0, 0, 200, 200);

objGraphic.DrawImage(origImage, objRect);

newImage.Save("temp_new.jpg", origImage.RawFormat);
It works beautifully for jpgs. As the GRaphics.FromImage does not
accept Indexed pixel formats, such as Format8bppIndexed, I made some
changes to my code:

Image origImage = Image.FromFile("temp.gif");
Image newImage = new Bitmap(objNewSize.Width, objNewSize.Height,
System.Drawing.Imaging.PixelFormat.Format24bppRgb) ;

Graphics objGraphic = Graphics.FromImage(newImage);

objGraphic.CompositingQuality = CompositingQuality.HighQuality;
objGraphic.SmoothingMode = SmoothingMode.HighQuality;
objGraphic.InterpolationMode = InterpolationMode.High;

Rectangle objRect = new Rectangle(0, 0, 200, 200);

objGraphic.DrawImage(origImage, objRect);

newImage.Save("temp_new.gif", origImage.RawFormat);

The result I get is an over-pixelated image. (As opposed to me using
Photoshop to resize the image) I'm running out of ideas. How can I
resize an indexed image wihtout losin too much info?
Nov 16 '05 #1
0 2271

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

Similar topics

0
by: funcSter | last post by:
I've got this bit of code: Image origImage = Image.FromFile("temp.jpg"); Image newImage = new Bitmap(objNewSize.Width, objNewSize.Height, origImage.Pixelformat); Graphics objGraphic =...
14
by: Rudy | last post by:
Hello all! I been trying to get a handle with Images. I have learned alot from the fine people here. So, I also learned that thumbnail images look terrible taken from a digital cam. I know why...
15
by: David Lozzi | last post by:
Howdy, I have a function that uploads an image and that works great. I love ..Nets built in upload, so much easier than 3rd party uploaders! Now I am making a public function that will take the...
2
by: Tim Arnold | last post by:
Hi, I'm using the Image module to resize PNG images from 300 to 100dpi for use in HTML pages, but I'm losing some vertical and horizontal lines in the images (usually images of x-y plots). ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
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...
0
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...
0
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,...
0
jinu1996
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 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.