crop

Find the rectangle area of image to Crop

微笑、不失礼 提交于 2019-12-04 05:48:55
问题 I've image with the size of (352 x 240) And I want to crop the white area (the selected area as show below). I use this code to crop image , private static Image cropImage(Image img, Rectangle cropArea) { Bitmap bmpImage = new Bitmap(img); Bitmap bmpCrop = bmpImage.Clone(cropArea, bmpImage.PixelFormat); return (Image)(bmpCrop); } But I can't find the exact rectangle area for my need ! How can I find Rectangle value of selected area ? I just want to crop this area !! Thanks ! 回答1: If you want

Cropping Shape of Square Image Android In App

▼魔方 西西 提交于 2019-12-04 05:47:12
I want to create an application which allows the user to resize an image in shape of square (length = width). I know that it is possible to use the gallery to make that in this way: private void crop(Uri photoUri) { Intent intent = new Intent("com.android.camera.action.CROP"); intent.setData(photoUri); intent.putExtra("outputX", 200); intent.putExtra("outputY", 200); intent.putExtra("aspectX", 1); intent.putExtra("aspectY", 1); intent.putExtra("scale", true); intent.putExtra("return-data", true); startActivityForResult(intent, RESULT_CROP); } But I would like to know if there is a library

Crop image using a fixed-size draggable picturebox

☆樱花仙子☆ 提交于 2019-12-04 05:03:05
问题 I'm working on a winforms project that involves cropping an image. My goal is to do this by using a fixed-size draggable picturebox control, allowing the user to select the area they want to preserve. My problem is when I crop the image; it "works" , but the crop area offsets a little. Here's the result I get: To clarify, I'm not talking about the zooming, that's per design. Notice the orange box is mostly focusing on the eye of the storm, but the cropped image is not. This is my code for the

Crop image in c#

我们两清 提交于 2019-12-04 03:54:58
问题 I have a image that I want to crop it when I press a button on the form. I have the following code that is run when the button is pressed, but it doesn't do anything to the image: try { Image image = Image.FromFile("test.jpg"); Bitmap bmp = new Bitmap(200, 200, PixelFormat.Format24bppRgb); bmp.SetResolution(80, 60); Graphics gfx = Graphics.FromImage(bmp); gfx.SmoothingMode = SmoothingMode.AntiAlias; gfx.InterpolationMode = InterpolationMode.HighQualityBicubic; gfx.PixelOffsetMode =

How do I make java's ImageBuffer to read a PNG file correctly?

删除回忆录丶 提交于 2019-12-04 00:37:50
问题 For some reason, opening up some PNG files using ImageBuffer and ImageIO does not work. Here's some code I am using that works fine for resizing/cropping JPGs: BufferedImage image = ImageIO.read(new File(location)); BufferedImage croppedImage = image.getSubimage( cropInfo.getX(), cropInfo.getY(), cropInfo.getW(), cropInfo.getH()); BufferedImage resizedImage = new BufferedImage( TARGET_WIDTH, TARGET_HEIGHT, croppedImage.getType()); Graphics2D g = resizedImage.createGraphics(); g.drawImage

Android - Crop image taken from camera with resizable ,independant height and width of cropped area

早过忘川 提交于 2019-12-03 21:53:01
I am developing app where i want to crop image taken from camera and upload to sftp server. I am using following code to crop image: BitmapFactory.Options opts = new BitmapFactory.Options(); opts.inSampleSize = 1; Bitmap bm = BitmapFactory.decodeFile(imagePath, opts); Intent intent = new Intent("com.android.camera.action.CROP"); intent .setDataAndType(outputFileUri, "image/*"); intent.putExtra("outputX",bm.getWidth()); intent.putExtra("outputY", bm.getHeight()); intent.putExtra("aspectX", 1); intent.putExtra("aspectY", 1); intent.putExtra("scale", true); intent.putExtra("return-data", false);

Cropping a UIImage according to the viewport inside a UIScrollView

≡放荡痞女 提交于 2019-12-03 21:14:37
I have a UIImageView (initialized with Aspect Fill) inside a UIScrollView. The user shall use that to resize and position a UIImage to his like, press a button and then exactly what he sees on screen would be sent to a server, only in the original image coordinates. In other words, the resulting image would be bigger than the image on screen. Here's the essential part of my code so far: // select the original CGFloat imageRatio = self.imageView.image.size.width / self.imageView.image.size.height; CGFloat viewRatio = self.imageView.frame.size.width / self.imageView.frame.size.height; CGFloat

What java library should I use for image cropping/ letterboxing? [closed]

时光毁灭记忆、已成空白 提交于 2019-12-03 20:30:28
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed last year . I'm looking for a Java library to do image cropping / resizing. I had planned to use jmagick, but it doesn't seem to have been maintained since 2009. Is this the best library to use? Any recommendations?! Edit One thing I want to do is to be able to pad an image to resize as well as crop it. i.e. if I have a 4x2

Android 4.3 crop gallery resultCode Cancel

限于喜欢 提交于 2019-12-03 20:25:15
问题 My Galaxy Nexus is now running on Android 4.3 allowing me to test my application with this new version. Everything seems fine except cropping. I have an application that uses the camera to take picture and then crop the image through the gallery app. I am also able to choose a picture from the gallery and crop it after. Since Android 4.3, the gallery application changed. If i take a picture with the camera api and then ask the gallery to crop it in my onActivityResult method the resultCode is

Android: Calling crop activity after taking photo

北慕城南 提交于 2019-12-03 17:50:01
问题 I'm facing a problem with parsing a uri of taken photo to crop activity. In my application, users can take a photo or select one from gallery and then crop it and upload it. Everything sounds straightforward. When pick from Gallery, Gallery app return an uri for selected photo like this: content://media/external/images/media/20 I start crop activity with this uri by following code, everything seems ok: Intent intent = new Intent("com.android.camera.action.CROP"); intent.setData(uri); intent