I have the following C# code to print 8x6 photos in a desktop application.
It works on regular printer with regular letter size paper.
But my client is using kodak printer with 8x6 paper, the photos are printing but their size is different, they are not printing in full 8x6 size, I'm doing something wrong.
Can someone please guide me in right direction.
public void Print(List ListToBePrinted)
{
PrintDialog SelectedPrinter = new PrintDialog();
if (SelectedPrinter.ShowDialog() == true)
{
PrintCapabilities printerCapabilities = SelectedPrinter.PrintQueue.GetPrintCapabilities();
Size PageSize = new Size(printerCapabilities.PageImageableArea.ExtentWidth, printerCapabilities.PageImageableArea.ExtentHeight);
Size PrintableImageSize = new Size();
foreach (Uri aUri in ListToBePrinted)
{
DrawingVisual drawVisual = new DrawingVisual();
ImageBrush imageBrush = new ImageBrush();
imageBrush.ImageSource = new BitmapImage(aUri);
imageBrush.Stretch = Stretch.Fill;
imageBrush.TileMode = TileMode.None;
imageBrush.AlignmentX = AlignmentX.Center;
imageBrush.AlignmentY = AlignmentY.Center;
if (imageBrush.ImageSource.Width > imageBrush.ImageSource.Height)
PrintableImageSize = new Size(768, 576); //8x6
else PrintableImageSize = new Size(576, 768); //6x8
double xcor = 0; double ycor = 0;
if (imageBrush.ImageSource.Width > imageBrush.ImageSource.Height)
{
if ((PageSize.Width - PrintableImageSize.Height) > 0)
xcor = (PageSize.Width - PrintableImageSize.Height) / 2;
if ((PageSize.Height - PrintableImageSize.Width) > 0)
ycor = (PageSize.Height - PrintableImageSize.Width) / 2;
}
else
{
if ((PageSize.Width - PrintableImageSize.Width) > 0)
xcor = (PageSize.Width - PrintableImageSize.Width) / 2;
if ((PageSize.Height - PrintableImageSize.Height) > 0)
ycor = (PageSize.Height - PrintableImageSize.Height) / 2;
}
using (DrawingContext drawingContext = drawVisual.RenderOpen())
{
if (imageBrush.ImageSource.Width > imageBrush.ImageSource.Height)
{
drawingContext.PushTransform(new RotateTransform(90, PrintableImageSize.Width / 2, PrintableImageSize.Height / 2));
}
drawingContext.DrawRectangle(imageBrush, null, new Rect(xcor, ycor, PrintableImageSize.Width, PrintableImageSize.Height));
}
SelectedPrinter.PrintVisual(drawVisual, "Print");
}
}
}
Checkout the HardMarginX and HardMarginY values, if you can find them.
I have this code in one of my apps (where e is a PrintPageEventArgs)
e.Graphics.DrawImage(nextImage, e.PageSettings.PrintableArea.X - e.PageSettings.HardMarginX, e.PageSettings.PrintableArea.Y - e.PageSettings.HardMarginY, e.PageSettings.Landscape ? e.PageSettings.PrintableArea.Height : e.PageSettings.PrintableArea.Width, e.PageSettings.Landscape ? e.PageSettings.PrintableArea.Width : e.PageSettings.PrintableArea.Height);
My printing function is a bit primitive, but maybe you can adjust your xcor and ycor based on the hard margins.
Related
I am trying to automate something with my C# application, for which I use a bitmap detection system to detect if an icon has appeared on screen. This works perfectly on a PC. However, when I put the application on a server, it never works. I am using a Google Cloud instance with a Tesla K80, 2 vcpus running Windows server 2012.
Here is my code:
// Capture the current screen as a bitmap
public static Bitmap CaptureScreen()
{
// Bitmap format
Bitmap ScreenCapture = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
// Capture screen
Graphics GFX = Graphics.FromImage(ScreenCapture);
GFX.CopyFromScreen(Screen.PrimaryScreen.Bounds.X,
Screen.PrimaryScreen.Bounds.Y, 0, 0,
ScreenCapture.Size, CopyPixelOperation.SourceCopy);
return ScreenCapture;
}
// Find a list of all the points of a bitmap within another bitmap
public static List<Point> FindBitmapsEntry(Bitmap SourceBitmap, Bitmap SearchedBitmap)
{
#region Arguments check
if (SourceBitmap == null || SearchedBitmap == null)
throw new ArgumentNullException();
if (SourceBitmap.PixelFormat != SearchedBitmap.PixelFormat)
throw new ArgumentException("Pixel formats aren't equal.");
if (SourceBitmap.Width < SearchedBitmap.Width || SourceBitmap.Height < SearchedBitmap.Height)
throw new ArgumentException("Size of SearchedBitmap is bigger than SourceBitmap!");
#endregion
var PixelFormatSize = Image.GetPixelFormatSize(SourceBitmap.PixelFormat) / 8;
// Copy SourceBitmap to byte array
var SourceBitmapData = SourceBitmap.LockBits(new Rectangle(0, 0, SourceBitmap.Width, SourceBitmap.Height),
ImageLockMode.ReadOnly, SourceBitmap.PixelFormat);
var SourceBitmapByteLength = SourceBitmapData.Stride * SourceBitmap.Height;
var SourceBytes = new byte[SourceBitmapByteLength];
Marshal.Copy(SourceBitmapData.Scan0, SourceBytes, 0, SourceBitmapByteLength);
SourceBitmap.UnlockBits(SourceBitmapData);
// Copy SearchedBitmap to byte array
var SearchingBitmapData =
SearchedBitmap.LockBits(new Rectangle(0, 0, SearchedBitmap.Width, SearchedBitmap.Height),
ImageLockMode.ReadOnly, SearchedBitmap.PixelFormat);
var SearchingBitmapByteLength = SearchingBitmapData.Stride * SearchedBitmap.Height;
var SearchingBytes = new byte[SearchingBitmapByteLength];
Marshal.Copy(SearchingBitmapData.Scan0, SearchingBytes, 0, SearchingBitmapByteLength);
SearchedBitmap.UnlockBits(SearchingBitmapData);
var PointsList = new List<Point>();
// Searching entries, minimizing searching zones
// SourceBitmap.Height - SearchedBitmap.Height + 1
for (var MainY = 0; MainY < SourceBitmap.Height - SearchedBitmap.Height + 1; MainY++)
{
var SourceY = MainY * SourceBitmapData.Stride;
for (var MainX = 0; MainX < SourceBitmap.Width - SearchedBitmap.Width + 1; MainX++)
{
// MainY & MainX - pixel coordinates of SourceBitmap
// SourceY + SourceX = pointer in array SourceBitmap bytes
var SourceX = MainX * PixelFormatSize;
var IsEqual = true;
for (var c = 0; c < PixelFormatSize; c++)
{
// Check through the bytes in pixel
if (SourceBytes[SourceX + SourceY + c] == SearchingBytes[c])
continue;
IsEqual = false;
break;
}
if (!IsEqual) continue;
var ShouldStop = false;
// Find first equation and search deeper
for (var SecY = 0; SecY < SearchedBitmap.Height; SecY++)
{
var SearchY = SecY * SearchingBitmapData.Stride;
var SourceSecY = (MainY + SecY) * SourceBitmapData.Stride;
for (var SecX = 0; SecX < SearchedBitmap.Width; SecX++)
{
// SecX & SecY - coordinates of SearchingBitmap
// SearchX + SearchY = pointer in array SearchingBitmap bytes
var SearchX = SecX * PixelFormatSize;
var SourceSecX = (MainX + SecX) * PixelFormatSize;
for (var c = 0; c < PixelFormatSize; c++)
{
// Check through the bytes in pixel
if (SourceBytes[SourceSecX + SourceSecY + c] == SearchingBytes[SearchX + SearchY + c]) continue;
// Not equal - abort iteration
ShouldStop = true;
break;
}
if (ShouldStop) break;
}
if (ShouldStop) break;
}
if (!ShouldStop) // Bitmap is found
{
PointsList.Add(new Point(MainX, MainY));
}
}
}
return PointsList;
}
And here is how I use it:
Bitmap HighlightBitmap = new Bitmap(Resources.icon);
Bitmap CurrentScreen = CaptureScreen();
List<Point> HighlightPoints = FindBitmapsEntry(CurrentScreen, HighlightBitmap);
with this HighlightPoints[0] is supposed to give me the first point the two bitmaps (icon, screenshot) collide. But as mentioned before, it just doesn't work on the server.
Thanks in advance!
P.S. I am using the server with a RDP so it does have a visual interface to work with
I need to specify a region on where motion detection will occur. What I am trying to do is count the number of vehicles that passes a certain region. Below is my code:
private static void ProcessFrame(Mat backgroundFrame, int threshold, int erodeIterations, int dilateIterations)
{
// Find difference between background (first) frame and current frame
CvInvoke.AbsDiff(backgroundFrame, rawFrame, diffFrame);
// Apply binary threshold to grayscale image (white pixel will mark difference)
CvInvoke.CvtColor(diffFrame, grayscaleDiffFrame, ColorConversion.Bgr2Gray);
CvInvoke.Threshold(grayscaleDiffFrame, binaryDiffFrame, threshold, 255, ThresholdType.Binary);
// Remove noise with opening operation (erosion followed by dilation)
CvInvoke.Erode(binaryDiffFrame, denoisedDiffFrame, null, new Point(-1, -1), erodeIterations, BorderType.Default, new MCvScalar(1));
CvInvoke.Dilate(denoisedDiffFrame, denoisedDiffFrame, null, new Point(-1, -1), dilateIterations, BorderType.Default, new MCvScalar(1));
rawFrame.CopyTo(finalFrame);
//Rectangle rec = new Rectangle(100, 100, 100, 100);
//finalFrame = crop_color_frame(rawFrame, rec);
var img = crop_color_frame(denoisedDiffFrame, rec);
DetectObject(denoisedDiffFrame, finalFrame);
}
static int vnum = 0;
private static void DetectObject(Mat detectionFrame, Mat displayFrame)
{
using (VectorOfVectorOfPoint contours = new VectorOfVectorOfPoint())
{
// Build list of contours
CvInvoke.FindContours(detectionFrame, contours, null, RetrType.List, ChainApproxMethod.ChainApproxSimple);
// Selecting largest contour
if (contours.Size > 0)
{
double maxArea = 0;
int chosen = 0;
for (int i = 0; i < contours.Size; i++)
{
VectorOfPoint contour = contours[i];
double area = CvInvoke.ContourArea(contour);
if (area > maxArea)
{
maxArea = area;
chosen = i;
}
}
// Draw on a frame
MarkDetectedObject(displayFrame, contours[chosen], maxArea, contours.Size, maxArea);
}
}
}
private static void MarkDetectedObject(Mat frame, VectorOfPoint contour, double area, double contourSize, double maxArea)
{
// Getting minimal rectangle which contains the contour
Rectangle box = CvInvoke.BoundingRectangle(contour);
// Drawing contour and box around it
CvInvoke.Polylines(frame, contour, true, drawingColor);
CvInvoke.Rectangle(frame, box, drawingColor);
// Write information next to marked object
Point center = new Point(box.X + box.Width / 2, box.Y + box.Height / 2);
Point center2 = new Point(box.Width, box.Height);
var info = new string[] {
$"Area: {area}",
$"Position: {center.X}, {center.Y}"
};
Console.WriteLine($"X: {center.X} | Y: {center.Y} | Area: {area} | Count: {vnum} | Status: {vehicleState} | contour: {contour.Size}");
switch (vehicleState)
{
case VehicleState.Entering:
if(_startCount)
{
//if(((maxArea > 15000 && maxArea <= 20000) && center.Y <= 120) || ((maxArea >= 5000 && maxArea < 10000) && center.Y >= 150))
if(center.Y >= 100 && maxArea > 20000)
{
CountVehicle();
vehicleState = VehicleState.Exiting;
_startCount = false;
}
}
break;
case VehicleState.Exiting:
if (!_startCount)
{
//if(maxArea < 12000 && center.Y <= 120)
if(center.Y <= 130 && center.X <= 100 && maxArea <= 15000)
{
vehicleState = VehicleState.Entering;
_startCount = true;
}
}
break;
}
WriteMultilineText(frame, info, new Point(box.Right + 5, center.Y));
}
As of the moment, this code works on detecting vehicles but I am just using the
if(center.Y >= 100 && maxArea > 20000) condition to start counting the vehicles
the problem with that approach is, all movements in the frame are being monitored. That is why I need to set an specific region only.
Could you please show me how to do this?
You can set ROI for the input image
public static Mat crop_roi(Mat input_img)
{
Image<Gray, byte> img = input_img.ToImage<Gray, byte>();
double w = input_img.Width;
double h = input_img.Height;
Rectangle r = new Rectangle((int)(w * 0.2), (int)(h * 0.4), (int)(w * 0.6), (int)(h * 0.6));
Image<Gray, byte> output = img.Copy(r);
return output.Mat;
}
//USE
private static void DetectObject(Mat detectionFrame, Mat displayFrame)
{
using (VectorOfVectorOfPoint contours = new VectorOfVectorOfPoint())
{
//set roi to the frame
Mat roi = new Mat()
roi = set_roi(detectionFrame);
// Build list of contours
CvInvoke.FindContours(roi , contours, null, RetrType.List, ChainApproxMethod.ChainApproxSimple);
// Selecting largest contour
...
MarkDetectedObject(roi , contours[chosen], maxArea, contours.Size, maxArea);
}
Below is the image I draw the ROI in an image, you can adjust the ROI by changing the parameter in this line Rectangle r = new Rectangle((int)(w * 0.2), (int)(h * 0.4), (int)(w * 0.6), (int)(h * 0.6));
Hi everybody I wrote a code for text detection with opencv But I have got a mistake My code cant entire the forecah Here is my code
public int FindWrite()
{
// aimg = new IplImage(img.Size, BitDepth.U8, 1);
IplImage labelImage = new IplImage(img.Size, CvBlobLib.DepthLabel, 1);
labelImage = new IplImage(img.Size, BitDepth.U8,1);
blob = new CvBlobs();
text.Clear();
CvBlobLib.Label(labelImage,blob);
CvBlobLib.FilterByArea(blob, 600, 10000);
IplImage imgtemp = img.Clone();
// CvBlobLib.RenderBlobs(blob, img, imgtemp, RenderBlobsMode.BoundingBox | RenderBlobsMode.Angle);
// CvBlobLib.RenderBlobs(blob,img, imgtemp, RenderBlobsMode.BoundingBox | RenderBlobsMode.Angle);
CvBlobLib.RenderBlobs(blob,labelImage, imgtemp, RenderBlobsMode.BoundingBox | RenderBlobsMode.Angle);
// CvBlobLib.RenderBlobs(blob, labelImage, imgtemp, RenderBlobsMode.BoundingBox | RenderBlobsMode.Angle);
foreach (var item in blob)
{
item.Value.SetImageRoiToBlob(bimg);
// ratio values of plate between 3.5 and 5.4
double ratio = (double)item.Value.Rect.Width / item.Value.Rect.Height;
double angle = (double)item.Value.Angle();
if (ratio > 3.5 && ratio < 5.4 && angle > -15 && angle < 15)
{
IplImage texttemp = new IplImage(new CvSize(140, 27), bimg.Depth, bimg.NChannels);
Cv.Resize(bimg, texttemp);
text.Add(texttemp);
img.Rectangle(item.Value.Rect, new CvScalar(0, 0, 255), 2, LineType.Link4);
}
}
img.ResetROI();
return text.Count;
}
thanks your advance
I've looked all over for something to help me with this, but so far nothing. I am trying to create a program that allows a user to print a collection of pdfs. I am using ABCPDF9 to get my pdfs (most of which are stored as html) and append them all to a single ABCPDF.Doc object. The problem I'm getting is when I have these multiple pages I end up with only one page of the pdf printing. Here are some code snippets below.
private void ProcessAndPrintSelected()
{
var selectedForm = SubSonicRepository.Instance.CommunicationRepository.GetMessageTemplateByID((int)cmboChooseForm.SelectedValue);
_currentItemIndex = 0;
int itemsCount = dataGridViewLoans.RowCount;
_currentPrintPageIndex = 1;
foreach (DataGridViewRow row in this.dataGridViewLoans.Rows)
{
lblPrinterProgress.Text = "Printing document " + _currentItemIndex + " of " + itemsCount + ".";
lblPrinterProgress.Refresh();
Application.DoEvents();
BulkPrinterLoanModel loan = row.DataBoundItem as BulkPrinterLoanModel;
try
{
if (selectedForm.MailMessageContent != null)
{
byte[] formBytes = GetFormBytes(selectedForm.ID, loan.ApplicantID, loan.LoanID);
doc.Read(formBytes);
appendedDocs.Append(doc);
}
else
{
throw new InvalidOperationException("No PDF data to print.");
}
}
catch (Exception x)
{
//for now, don't do anything, not even logging, but don't halt queue either.
MessageBox.Show(x.ToString());
}
}
printDoc.PrintPage += new PrintPageEventHandler(pd_PrintPage);
printDoc.PrinterSettings.FromPage = 1;
printDoc.PrinterSettings.ToPage = appendedDocs.PageCount;
printDoc.PrinterSettings.MinimumPage = 1;
printDoc.PrinterSettings.MaximumPage = appendedDocs.PageCount;
PrintDialog pDialog = new PrintDialog();
pDialog.Document = printDoc;
pDialog.AllowSomePages = true;
if (pDialog.ShowDialog() == DialogResult.OK)
{
pDialog.Document.Print();
}
}
and my printpage event.
void pd_PrintPage(object sender, PrintPageEventArgs e)
{
XRect cropBox = appendedDocs.CropBox;
double srcWidth = (cropBox.Width / 72) * 100;
double srcHeight = (cropBox.Height / 72) * 100;
double pageWidth = e.PageBounds.Width;
double pageHeight = e.PageBounds.Height;
double marginX = e.PageSettings.HardMarginX;
double marginY = e.PageSettings.HardMarginY;
//center it
double x = (pageWidth - srcWidth) / 2;
double y = (pageHeight - srcHeight) / 2;
x -= marginX;
y -= marginY;
RectangleF rect = new RectangleF((float)x, (float)y, (float)srcWidth, (float)srcHeight);
appendedDocs.Rect.SetRect(cropBox);
int rez = e.PageSettings.PrinterResolution.X;
appendedDocs.Rendering.DotsPerInch = rez;
Graphics g = e.Graphics;
using (Bitmap bitmap = appendedDocs.Rendering.GetBitmap())
{
g.DrawImage(bitmap, rect);
}
}
I've looked in the ABCPDF manual, but all the help on printing is presented in their sample project which I'm having a hard time understanding. Any help on this matter would be appreciated. Thanks :)
I got it, mostly from looking at the following question. I needed to use the Doc.PageNumber to access each page of the pdf. Here's the print page event where I changed the code.
void pd_PrintPage(object sender, PrintPageEventArgs e)
{
_currentItemIndex++;//added index to keep track of page. default to 1
appendedDocs.PageNumber = _currentItemIndex;//set to current page for printing
XRect cropBox = appendedDocs.CropBox;
double srcWidth = (cropBox.Width / 72) * 100;
double srcHeight = (cropBox.Height / 72) * 100;
double pageWidth = e.PageBounds.Width;
double pageHeight = e.PageBounds.Height;
double marginX = e.PageSettings.HardMarginX;
double marginY = e.PageSettings.HardMarginY;
//center it
double x = (pageWidth - srcWidth) / 2;
double y = (pageHeight - srcHeight) / 2;
x -= marginX;
y -= marginY;
RectangleF rect = new RectangleF((float)x, (float)y, (float)srcWidth, (float)srcHeight);
appendedDocs.Rect.SetRect(cropBox);
int rez = e.PageSettings.PrinterResolution.X;
appendedDocs.Rendering.DotsPerInch = rez;
Graphics g = e.Graphics;
using (Bitmap bitmap = appendedDocs.Rendering.GetBitmap())
{
g.DrawImage(bitmap, rect);
}
e.HasMorePages = _currentItemIndex < appendedDocs.PageCount;//check for more pages.
}
Feel silly having asked this question and then answering myself. But it feels good knowing that this question is now out there for anyone else that gets stuck on the issue.
Basically, I have an image which could be large (couple of thousand pixels in both height and width), and can vary quite a bit in width's and height's.
What I need to do is display these images at approximately 500 pixels in height and width - but I want to keep the aspect ratio of these intact, so the values would just be fairly close. But I'm a bit confused on what calculations I could use on the original width's and heights to get them to the right figures.
Any ideas?
Try this:
Size original = new Size(5000,4000);
double ratio = (double)original.Height/original.Width;
int resizePercent = 50;
int newWidth = Convert.ToInt32(original.Width*resizePercent/100);
int newHeight = Convert.ToInt32(newWidth * ratio);
Size resized = new Size(newWidth,newHeight);
Of course simply set original variable to your images size and determine your resize percentage. You could calculate the resize percentage if you had a target width like this:
int targetWidth = 500;
int resizePercent = Convert.ToInt32((double)original.Width/targetWidth);
I ran into this problem a couple weeks ago. Check out this article https://web.archive.org/web/20200508200042/http://www.4guysfromrolla.com:80/articles/012203-1.2.aspx
You create a Generic Handler (.ashx) that finds the image, resizes it, and returns it
Here is what I ended up using (you can resize on the fly):
public void ProcessRequest (HttpContext context) {
TimeSpan refresh = new TimeSpan(168, 0, 0);
HttpContext.Current.Response.Cache.SetExpires(DateTime.Now.Add(refresh));
HttpContext.Current.Response.Cache.SetMaxAge(refresh);
HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.Public);
HttpContext.Current.Response.Cache.SetValidUntilExpires(true);
string dir = HttpContext.Current.Request.QueryString["dir"];
string img = HttpContext.Current.Request.QueryString["img"];
bool force = HttpContext.Current.Request.QueryString["force"] == "yes";
double w = 0;
double h = 0;
string path = null;
Image orig = null;
Image thumb = null;
//make sure we have a directory and image filename
if (string.IsNullOrEmpty(dir))
return;
//make sure that we allow access to that directory, could do some extra sneaky security stuff here if we had to... (only accept a DirectoryID so the user doesn't know the actual path)
switch (dir)
{
case "user":
dir = "assets/images/users";
if (string.IsNullOrEmpty(img) || img == "undefined") img = "0.jpg";
break;
break;
case "icon":
dir = "assets/images/icons";
break;
default:
dir = "assets/images";
break;
}
//make sure that the image filename is just a filename
if (img.IndexOf("/") > -1 | img.IndexOf("\\") > -1)
return;
//make sure the image exists
path = HttpContext.Current.Server.MapPath("~/" + dir + "/" + img);
if (System.IO.File.Exists(path))
{
orig = Image.FromFile(path);
}
else
{
return;
}
//if there is a max width or height
if (double.TryParse(HttpContext.Current.Request.QueryString["w"], out w) | double.TryParse(HttpContext.Current.Request.QueryString["h"], out h))
{
//thumb is the resized image
double s = 1;
if (w > 0 & h > 0)
{
double ratio = h / w;
if (orig.Height / (double)orig.Width > ratio)
{
if (orig.Height > h)
{
if (force)
s = w / (double)orig.Width;
else
s = h / (double)orig.Height;
}
}
else
{
if (orig.Width > w)
{
if (force)
s = h / (double)orig.Height;
else
s = w / (double)orig.Width;
}
}
}
else if (w > 0)
{
if (orig.Width > w)
{
s = w / (double)orig.Width;
}
}
else if (h > 0)
{
if (orig.Height > h)
{
s = h / (double)orig.Height;
}
}
//double flip gets it to lose the embedded thumbnail
//https://web.archive.org/web/20200508200042/http://www.4guysfromrolla.com:80/articles/012203-1.2.aspx
orig.RotateFlip(RotateFlipType.Rotate180FlipNone);
orig.RotateFlip(RotateFlipType.Rotate180FlipNone);
thumb = orig.GetThumbnailImage(Convert.ToInt32(orig.Width * s), Convert.ToInt32(orig.Height * s), null, IntPtr.Zero);
if (force && w > 0 & h > 0)
thumb = cropImage(thumb, (int)w, (int)h);
}
else
{
//thumb is the image at it's original size
thumb = orig;
}
HttpContext.Current.Response.ContentType = "image/jpeg";
thumb.Save(HttpContext.Current.Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg);
}
private Image cropImage(Image img, int w, int h)
{
if (w > img.Width && h > img.Height)
return img;
Rectangle cropArea = new Rectangle((img.Width - w) / 2, (img.Height - h) / 2, w, h);
Bitmap bmpImage = new Bitmap(img);
Bitmap bmpCrop = bmpImage.Clone(cropArea, bmpImage.PixelFormat);
return (Image)(bmpCrop);
}
public bool IsReusable {
get {
return false;
}
}