crop

How to crop image and save into ImageSource in WPF?

只谈情不闲聊 提交于 2019-12-03 16:17:46
I am new learner to WPF. here I got a question. I have a image, width:360, height:360. Here I want to crop this image like below: ( 0,0 ) to (120,120) save to the first ImageSource object, (120,0 ) to (240,120) save to the second ImageSource object, (240,0 ) to (360,120) save to the third ImageSource object;, …… pls see more details in below picture: My code sample below: private void CutImage(string img) { int iLeft = 0; int iTop = 0; int count = 0; Image thisImg = new Image(); BitmapImage src = new BitmapImage(); src.BeginInit(); src.UriSource = new Uri(img, UriKind.Relative); src

.Net Core Image Manipulation (Crop & Resize) / File Handling

落爺英雄遲暮 提交于 2019-12-03 15:24:55
问题 I have spent the last 5 hours trying to find a feasible way to accomplish what seems to me quite an easy task if it was a previous version of the .NET family that I was working with: Uploading a picture Resizing & Cropping the picture Saving the new picture into a directory I have come accross to couple of libraries that are either in pre-release stage or in a not-complete stage. Has anyone at all accomplished the above tasks without specifically including the System.Drawing namespace and/or

Crop image ala Google Goggles

那年仲夏 提交于 2019-12-03 14:38:19
I'm trying to do some ROI (region of interest) selection in my app, but I don´t know, how to create some kind of resizable (by fingers) rectangle like you can see in Google Goggles. Can you help me? Is there any source code example? My final solution is to draw and rectangle in the midle of a view and implement onTouchEvent() in my activity to set new corners coordinates like this: @Override public boolean onTouchEvent(MotionEvent me) { if(SETTING_ROI == true){ if (me.getAction() == MotionEvent.ACTION_DOWN) { START_DRAGGING = true; myView.selectCorner((int) me.getRawX(), (int) me.getRawY()); /

How to crop a image and save?

孤街浪徒 提交于 2019-12-03 14:15:59
问题 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

Android Custom Camera - Crop image inside Rectangle

纵饮孤独 提交于 2019-12-03 13:54:21
I have a custom camera app which have a centered rectangle view, as you can see below: When I take a picture I want to ignore everything outside the rectangle. The view hasn't any connection with the Camera Preview or SurfaceView in my XML view, as follows: <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent"> <FrameLayout android:id="@+id/preview" android:layout_width="fill_parent" android:layout_height="fill_parent"> <SurfaceView android:id="@+id/cameraview" android:name="com.kut.camera

Extract a region of a PDF page by coordinates

怎甘沉沦 提交于 2019-12-03 13:42:36
问题 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

Image not cropping

时光毁灭记忆、已成空白 提交于 2019-12-03 13:17:46
I am setting a background image to LinearLayout like this: 1.back_xml: <?xml version="1.0" encoding="UTF-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@drawable/back" > </item> <item> <shape> <solid/> <stroke android:width="1dip" android:color="#225786" /> <corners android:radius="10dip"/> <padding android:left="0dip" android:top="0dip" android:right="0dip" android:bottom="0dip" /> </shape> </item> 2. tile.xml <bitmap xmlns:android="http://schemas.android.com/apk/res/android" android:src="@drawable/pie_chart_background" android:tileMode=

Crop a fixed size image in Android

余生长醉 提交于 2019-12-03 11:35:47
问题 I am trying to crop an image but I want to be able to set the cropped area to exactly 640px x 640px. I want to prevent a user from cropping down to a really small area. So basically I would prefer to have a fixed height and width for the cropping area. I have looked into several third party libraries but don't see solving this problem. How can I do this? 回答1: I'd use one of these solutions: https://github.com/jdamcd/android-crop https://github.com/edmodo/cropper Both seems to be appropriate

Resize and crop images before displaying in UITableViewCells

六眼飞鱼酱① 提交于 2019-12-03 10:22:46
问题 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

iOS : Crop video weird green line left and bottom side in video

孤街浪徒 提交于 2019-12-03 09:42:33
-How to remove green line on the video. when crop a video 2 or 3 times at that time show green or mix green-red blink line in the video, left or bottom or both left and bottom side in the video. video crop method. -(void)cropButton { CGRect cropFrame = self.cropView.croppedImageFrame; //load our movie Asset AVAsset *asset; asset = [AVAsset assetWithURL:[NSURL fileURLWithPath:[self.videoDataArr objectAtIndex:self.selectedIndex-1]]]; //create an avassetrack with our asset AVAssetTrack *clipVideoTrack = [[asset tracksWithMediaType:AVMediaTypeVideo] objectAtIndex:0]; //create a video composition