I am creating app that allow user to use pictures from photo hub & take new photo to edit
I know that I can take picture from PhotoChoserTask but I want 2 seperate things.
Now I need to crop taken picture right after capture (like what I can do with PhotoChoserTask)
How can I achieve it?
Unfortunately CameraCaptureTask doesn't have Height and Width properties, so you cannot crop the image right after it is taken.
You can do two things:
1 - (I don't prefer this one!) Allow the user to take a picture using the CamerCaptureTask and then after it is completed, call the PhotoChoserTask so that the user again chooses the clicked image. Using this option you can crop the image using the Height and Width properties of the PhotoChoserTask
2 - Use Nokia Imaging SDK to crop the image. This SDK has many filters including the Crop filter which can be used to crop images. It is not as easy the PhotoChoserTask crop but you can still crop the image. There is sample code to crop an image on this page. Check it out!
Hope this helps!
Same as PhotoChoserTask, CameraCapturTask also has 'completed' event. Both are same so you can apply the same code of PhotoChoserTask 'completed' event to CameraCaptureTask 'completed' event. Use 'e.ChosenPhoto' argument property to get the stream of captured image.
Related
This is a C# winforms question.
The process I am trying to achieve is the following:
Using AxAcroPDFLib I'm loading a pdf file to the form
I want the user to be able to specify a square on that PDF and create a bmp from it
That bmp will then be loaded to a OCR to become text
What is my issue:
Step 1 and 3 are easy to do, the problem is how to allow the user to draw a square on top of the AxAcroPDFLib for a screenshot.
I already got different ways to draw squares on native winform components, but AxAcroPDFLib does not support mouse down, up, move, etc and paint events.
There is the option to convert the PDF to bitmap and display it on a picturebox and deal with events for drawing the square. Problem with that approach is that my PDF's are usually more than two pages, and I would like to avoid the conversion pdf to bmp due to changes to image quality that will impact on OCR.
I came to think that maybe something that works as the windows snippingtool would do the the job. My application would get the screenshot, temporarily save the image on disk (must be a file for OCR), I would then pass it to the OCR and done. Hard part, I could not think on how to take the screenshot of part of the PDF.
Do anyone here have any suggestion to different components or workarounds to deal with the requirement above? I am using Adobe just because it is simple, but maybe there are other components better suited to handle my requirements? I googled but haven't found any free ones, trying to avoid paid options.
Thanks
At some point in this process, the PDF is going to have to be rasterized in order to be passed to the OCR, so I don't totally understand your objection to converting it to a bitmap. If you're okay with Snipping Tool's behavior, then you must be OK with the quality of the PDF control's PDF->screen rasterization. If that resolution is acceptable, why not just capture the control's content to a Bitmap and let the user draw the selection marquee over that Bitmap?
Here is code I'm using to capture a control's contents to a Bitmap in Windows Forms. One caveat is that this is really a screen capture, so any windows or controls that overlap the control's visible area will be captured in the image.
using (Bitmap b = new Bitmap(width, height))
{
using (Graphics g = Graphics.FromImage(b))
{
Point p1 = myControl.PointToScreen(new Point(0, 0));
g.CopyFromScreen(p1.X, p1.Y, 0, 0, size);
}
// do stuff here with your Bitmap
}
I have Panel on windows form containing labels for displaying information and 2 PictureBox controls. One for Company logo & other for captured photo. When i print them either on Printer or just save in PDF format, both images looking very blur. I want to improve quality of images. So they will appear clear even after zoom.
Any suggestion.
You can set this property of the Graphics object.
// g is type of Graphics.
g.InterpolationMode = InterpolationMode.High;
I don't know which technique you are using for printing but if you are using print form it is not good for decent picture or text. Therefore when you send form/PictureBox to the print object it would lose quality.The Solution is to use PrintDocument.
Share your code for more help.
Your printer has better resolution than your monitor. That bitmap won't work. You will have to recreate the print items directly on the e.Graphics of the PrintPageEventArgs.
Other work around is the technique that guy explain in his article.
http://www.dahuatu.com/3vy2K5z5mr.html
I have made a thumbnail of an image using Image.GetThumbnailImage Method.
Now I want to get the original image and display that original image to a different pictureBox when I click on the thumbnail (which is a different pictureBox).
Does anyone know how can we do that? I have search on the Internet and all I found is create a thumbnail, I didn't find any method to retrieve back the original image
If you want to have thumbnails which lead to an original version of the image, you need to at least keep and store the original version of the image.
When the user clicks the thumbnail, display the original version of the image that you stored.
You cannot restore original images from a thumbnail
Given a thumbnail of an image, you can't expand it back into the original image. Scaling it down into a thumbnail is a destructive process which removes the vital information.
Consider... given this thumbnail:
How could you recreate this image?
Most of the information in the larger image is missing in the thumbnail. The cracks in the paint aren't there in the thumbnail. Nor can you spot her veil, make out the background, see the white flecks on the canvas, or notice the waviness of her hair. You can't see the ripples of her dress nor the folds and creases in the fabric. In the thumbnail, all those things no longer exist: the scale down has destroyed all that information.
Trying to reconstruct the larger image from the smaller would be like akin to recreate a 20-page novel from a half-page summary of its major points: you can guess at how the author might have written it, but you'll never know word-for-word what it was originally.
The image of the Mona Lisa was from Wikipedia.
I would like to be able to add an image to a live tile so that there is no stretching and the image looks normal. I am getting my images from the PhotoChooserTask, which contain images from the medialibrary. As of now I can successfully place an image on a live tile, but it is stretched and the aspect ratio is not correct. How would I be able to find the aspect ratio of the image and crop the image so that it ends up being a square with dimensions 173x173 with no streching? I have followed a couple tutorials found online but nothing seems to accomplish this the way I need it to.
I accomplished this by referencing Resize image for Live Tile - WriteableBitmapEx which proved to have the correct implementation.
I would like to know how I can create one image from many. I would like to create a tile in my windows phone application like in this image (specifically, the People tile):
(source: addictivetips.com)
I have nine pictures, and I would create an image, that I will add like tile to background. Does anybody know how can I create an image that looks like the one in that picture?
I have very little experience in this space, but have you considered creating a control that simply displays up to 9 pictures side by side in a grid like that? You then can bind each image independently & change them out however you want. This article touches on how to bind phontos in WP7 nicely:
http://msdn.microsoft.com/en-us/library/hh286418(v=vs.92).aspx
If you're talking about assembling an actual graphic image like a jpeg or bitmap, you'll need to look at the Image Class, Bitmap Class, and Graphics Class. Essentially you'll need to implement the following steps:
Load the relevant images with From method in Image, typically Image.FromFile.
Determine how many rows and columns you'll be using.
Calculate the total width and height for your layout using the widths and heights of the loaded images with appropriate padding added.
Create a new Bitmap of the appropriate size with the correct background color and iamge format.
Have variables for the current drawing location (x & y).
Have variables for the current row and column in your layout.
In a loop, Create your Graphics object.
Use Graphics.DrawImage to add your loaded image to the layout bitmap.
Increment your drawing row and or column as appropriate.
Calculate your new drawing location.
Repeat until done.
One of the options is to use WriteableBitmapEx
Also you can probably find an answer to your question here: How can I merge two images into one?