WP7 crop text area from image - c#

I need to crop an image such that it contains only text, no blank area..
eg. below..
Like this image contains a lot of space on all the four sides
and this one is the cropped version of the image.
is there something (library) that can automate this process.

Related

Retrieve original image from thumbnail

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.

Convert two images into a pdf

I want to convert 2 images into a single pdf file.One image is big in size and small image on the top of the big image.
So In generated pdf also I need to show the small image on the top of the big image and also in the same position where it is in case of image.
I use pdfSharp to convert image to pdf.It will convert the images into pdf file but not able to position the second image on the top of the first image.
Can any one help me on that.Thanks in advance.
Check out the sample below and see if it's what you need:
http://pdfsharp.com/PDFsharp/index.php?option=com_content&task=view&id=34&Itemid=45

How to crop and resize an image for a LiveTile

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.

Extract size of the image embedded in a PDF

I have an image embedded in a PDF file. I was able to extract the resolution of the image. However, if i crop the PDF using iTextsharp and a part of the image is cropped in the process. The new image continues to have the same resolution. By resolution I mean the dimension in the form of Width x Height. The cropped image is supposed to have a smaller size. How can I extract the size of the image in inches, if possible, so that I can differentiate the original image from the cropped pdf?
Embedded images in PDFs are never "cropped" in the sense that the "cropped-away" parts are gone forever. They are only cropped in the sense that these parts are hidden or masked.
If the image data inside the PDF say /Height 216 and /Width 288 then this is the size in Pixels (not inches or any other length unit). And "resolution" is then secondary:
if the PDF environment commands that this image should be rendered onto a square of 3x4 inches, its resolution in this moment is 72x72 dpi.
if the PDF environment commands that this image should be rendered onto a square of 1.5x2 inches, its resolution in this moment is 144x144 dpi.
However it can well be that the image is only partially visible ("cropped"), maybe because half of it is rendering beyond the page borders...

Crop excess white space from scanned TIFF

I have documents that are being scanned that are less than 8.5 x 11. They are probably more like 8.5 x 5. The scanners being used are centering the documents vertically and still making 8.5 x 11 TIFFs. I'm looking for a way to automatically remove the white space from the top and bottom of the images. If the image's orientation is changed, there could potentially be excess white space on all 4 sides of the image. Assume there is no setting on the scanner to prevent it from doing this.
tl;dr
Does anyone know of a decent TIFF library that can auto crop images?
You don't necessarily need a "tiff library" to do this. you could do it in c#, something like this...
convert the tiff to a bitmap
inspect the bitmap, pixel by pixel to determine where the whitespace starts/ends
once you know the pixel coordinates of the surrounding whitespace, you can then crop the bitmap image
save the new image
Reference these pages for more information:
http://msdn.microsoft.com/en-us/library/system.drawing.bitmap.getpixel%28v=vs.85%29.aspx
http://msdn.microsoft.com/en-us/library/system.windows.media.imaging.croppedbitmap%28v=vs.85%29.aspx

Categories

Resources