How do I edit an image in VS 2003?

Posted on 2006-05-06
Last Modified: 2010-04-16
I need to open and edit a JPG file, but don't know how.

Can anybody please explain?

Question by:ba272
    LVL 85

    Accepted Solution

    Please define what you mean by "edit"...

    You can open an image and modify it using the Graphics class using code like the below:

                String fileName = @"c:\someFile.jpg";

                // open the image and create a copy
                // so that we can release the file lock
                // on the original image
                Image img = Image.FromFile(fileName);
                Bitmap bmp = new Bitmap(img);

                // get a graphics so we can draw
                Graphics g = Graphics.FromImage(bmp);

                // do something with "g"
                g.DrawString("Hello World!", this.Font, Brushes.Black, new PointF(0, 0));

                // release the graphics

                // save the changes in the original fileName
                bmp.Save(fileName, System.Drawing.Imaging.ImageFormat.Jpeg);

    Author Comment

    Thanks. But I'm having a hard time finding the necessary using statements to include.  Have you got them handy?

    Author Comment


    I initially wanted to simply open the image editor in VS 2003, but upon seeing your code, decided to try it and see if I could edit these files programatically.  

    I have it working now.  


    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Suggested Solutions

    Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
    It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    729 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

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now