crop

Android: Calling crop activity after taking photo

半城伤御伤魂 提交于 2019-12-03 06:24:52
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.putExtra("outputX", 96); intent.putExtra("outputY", 96); intent.putExtra("aspectX", 1); intent.putExtra(

crop and Save ROI as new image in OpenCV 2.4.2 using cv::Mat

拈花ヽ惹草 提交于 2019-12-03 04:38:30
问题 Working on Face Detection and Recognition, and after successfully detecting a face, I just want to crop the face and save it somewhere in the drive to give it for the recognition code. I am having hard time doing the saving the Region of Interest as a new image. I have got some codes online but it is written in the previous version of OpenCV that uses IplImage* . I am using OpenCV 2.4.2 that uses cv::Mat . Heeeelp!!! I will post my codes(Face detection and Recognition per se) if you guys want

angular-file-upload with ngImgCrop

怎甘沉沦 提交于 2019-12-03 04:33:25
I'm using ( ngImgCrop ) to crop an image and then upload the cropped image to server using ( angular-file-upload ). I can get the $dataURI from the "on-change" option in ngImgCrop. But I need a File instace to call $upload. How can I get the File instance of the cropped image in order to upload : $scope.upload = $upload.upload({ url: '/api/fileupload', file: [**file cropped here**] }).progress(function (evt) { // }).success(function (data, status, headers, config) { // }); I guess you'll find a proper answer in this method. I found it in Github, in the angular-file-upload issues page ( https:/

How to crop a image and save?

巧了我就是萌 提交于 2019-12-03 04:07:10
I have opened a image in a QHBoxLayout . I need to crop the opened image and save the cropped image. How I can do this in PySide? import sys from PySide import QtGui, QtCore class Example(QtGui.QWidget): def __init__(self): super(Example, self).__init__() self.initUI() def initUI(self): hbox = QtGui.QHBoxLayout(self) pixmap = QtGui.QPixmap("re.png") lbl = QtGui.QLabel(self) lbl.setPixmap(pixmap) self.rect = QtCore.QRect() hbox.addWidget(lbl) self.setLayout(hbox) self.setGeometry(300, 300, 280, 170) self.setWindowTitle('Open Image') self.show() # Tried here to implement Qpen #self.painter =

R: Crop GeoTiff Raster using packages “rgdal” and “raster”

半腔热情 提交于 2019-12-03 03:50:17
I'd like to crop GeoTiff Raster Files using the two mentioned packages, "rgdal" and "raster". Everything works fine, except that the quality of the resulting output tif is very poor and in greyscale rather than colour. The original data are high quality raster maps from the swiss federal office of Topography, example files can be downloaded here . This is my code: ## install.packages("rgdal") ## install.packages("raster") library("rgdal") library("raster") tobecroped <- raster("C:/files/krel_1129_2012_254dpi_LZW.tif") ex <- raster(xmn=648000, xmx=649000, ymn=224000, ymx=225000) projection(ex)

Extract a region of a PDF page by coordinates

谁都会走 提交于 2019-12-03 03:40:30
I am looking for a tool to extract a given rectangular region (by coordinates) of a 1-page PDF file and produce a 1-page PDF file with the specified region: # in.pdf is a 1-page pdf file extract file.pdf 0 0 100 100 > out.pdf # out.pdf is now a 1-page pdf file with a page of size 100x100 # it contains the region (0, 0) to (100, 100) of file.pdf I could convert the PDF to an image and use convert , but this would mean that the resulting PDF would not be vectorial anymore, which is not acceptable (I want to be able to zoom). I would ideally like to perform this task with a command-line tool or a

Android Bitmap save without transparent area

安稳与你 提交于 2019-12-03 03:34:08
I want to save bitmap without transparent area. Bitmap has large transparent pixel. So i want to remove that How can i do this? I cant add picture so explain with symbols. I dont want to crop function. I hope use filter ┌────────────────────────┐ │ transparent area │ ┌────────┐ │ crop this └────────┘ └────────────────────────┘ To find the non-transparent area of your bitmap, iterate across the bitmap in x and y and find the min and max of the non-transparent region. Then crop the bitmap to those co-ordinates. Bitmap CropBitmapTransparency(Bitmap sourceBitmap) { int minX = sourceBitmap.getWidth

Freehand Image Crop draw inside bitmap region

醉酒当歌 提交于 2019-12-03 03:03:12
Trying to achieve freehand cropping of an image, so I'm able to draw on the image. But it goes outside bitmap region. I just wanna restrict that user can only draw inside bitmap region, check below screen shot. I am trying to implement functionality like Photoshop lasso tool . Its drawing outside view region, which generates incorrect output. Output Code@ onDraw public void onDraw(Canvas canvas) { final Rect rect = new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight()); canvas.drawBitmap(bitmap, rect, rect, null); // RectF r = new RectF(); // Matrix matrix = new Matrix(); // matrix.mapRect(r);

ImageMagick: how to minimally crop an image to a certain aspect ratio?

女生的网名这么多〃 提交于 2019-12-03 01:28:37
With imagemagick, I'd like to crop an image, in a minimal fashion, so that it fits a given aspect ratio. Example: given an image of, say, 3038 x 2014 px, I want to crop it to have a 3:2 aspect ratio. The resulting image would then be 3021 x 2014 px, cropped from the, say, center of the original image. So looking for a command looking something like convert in.jpg -gravity center -crop_to_aspect_ratio 3:2 out.jpg . 1. Specific target resolution If your goal at the end is to have a certain resolution (for example 1920x1080) then it's easy, using -geometry , the circumflex/hat/roof/house symbol (

Resize and crop images before displaying in UITableViewCells

跟風遠走 提交于 2019-12-03 00:52:19
i have an UITableView in my app and i have to load some images that have a fixed width but different heights. I download the images async using an NSOperationQueue and for resizing and cropping i tried to use the solution provided by Jane Sales in this post link text . i made a custom UITableViewCell class and in it i have a method that is called when the queued operation finishes to download the image. The method is called properly and the images are displayed. When i try to resize the images using the method proposed by Jane the problems appear. When it reaches [sourceImage drawInRect