Bitmap cropImg = new Bitmap(747, 591, System.Drawing.Imaging.PixelFormat.Format24bppRgb);

            cropImg.SetResolution(300, 300);

            //create a new graphics object from our image and set properties

            using (Graphics grPhoto = Graphics.FromImage(cropImg))
            {
                grPhoto.CompositingMode = CompositingMode.SourceCopy;
                grPhoto.SmoothingMode = SmoothingMode.AntiAlias;

                grPhoto.InterpolationMode = InterpolationMode.HighQualityBicubic;

                grPhoto.PixelOffsetMode = PixelOffsetMode.HighQuality;

                //now do the crop

               // grPhoto.DrawImage(loadedImage1, new Rectangle(0, 0, pictureBox1.Width, pictureBox1.Height), imageBounds1.Location.X - SizeOfImageOffset1.Width, imageBounds1.Location.Y - SizeOfImageOffset1.Height, loadedImage1.Width, loadedImage1.Height, GraphicsUnit.Pixel);
                grPhoto.DrawImage(loadedImage1, loadedImage1.Width - SizeOfImageOffset1.Width, loadedImage1.Height - SizeOfImageOffset1.Height, 747, 591);
            
            }

loadedimage is the image which the user controls, sizeofImageOffset is how much the user has moved this picture within the picturebox.

so if picture is 1000px wide, and the user moves it 200 left, sizeofimageofset would be -200...
hence the cropping of the image.
when i try to capture this image as above, to get the highest quality, it renders blank..

any ideas?

got it,

imagebounds.location.x

not

loadedImage1.Width - SizeOfImageOffset1.Width
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.