Atalasoft
Welcome to Atalasoft Community Sign in | Join | Help

Regarding Image Resizing...

  •  12 Apr 2007, 12:21 PM

    Regarding Image Resizing...

    Hello,

    I need some help. I am trying to resize an image using Atalasoft v4.0. I am running into a problem where the Image is saved but there is no color information in the image, just a solid black background.

    Here is the code I'm using...

    AtalaImage imgOrig = new AtalaImage(strFileLocation + "16.JPG");

    Width = 450;

    Height = 300;

    AtalaImage bmPhoto = new AtalaImage(Width, Height, Atalasoft.Imaging.PixelFormat.Pixel32bppBgr);

    Graphics grPhoto = imgPhoto.GetGraphics(); // bmPhoto.GetGraphics does not work either
    grPhoto.Clear(Color.Transparent);
    grPhoto.InterpolationMode = InterpolationMode.HighQualityBicubic;

    bmPhoto.Draw(grPhoto, new Rectangle(destX, destY, destWidth, destHeight),
                                       new Rectangle(sourceX, sourceY, sourceWidth, sourceHeight));

    grPhoto.Dispose();
               
    bmPhoto.Save(p450Directory + strFileName + "-450.jpg", Atalasoft.Imaging.Codec.ImageType.Jpeg, null);

    This executes. The image is saved and the size is correct but there is no image.

    Perhaps I'm going at this the wrong way.

View Complete Thread