crop

How to convert all images to JPG format in PHP?

陌路散爱 提交于 2019-11-27 05:29:51
I am developing a website in PHP that let the user to upload images and then let him to decide how the image should be using jQuery - PHP integeration to select the area that wanted to be the picture and then click the crop button to crop it and save it. The problem that I am facing is that not all images type are good to crop and save so I noticed that the easy solution for it to convert the image to JPG and then let the user to crop it because it's the easy way to do it in JPG format. How I can do it? Is this the best solution for images types problem? EDIT: I am using this code to crop

Cropping image in PHP

只谈情不闲聊 提交于 2019-11-27 05:02:05
I'd like crop an image in PHP and save the file. I know your supposed to use the GD library but i'm not sure how. Any ideas? Thanks Andris You could use imagecopy to crop a required part of an image. The command goes like this: imagecopy ( resource $dst_im - the image object , resource $src_im - destination image , int $dst_x - x coordinate in the destination image (use 0) , int $dst_y - y coordinate in the destination image (use 0) , int $src_x - x coordinate in the source image you want to crop , int $src_y - y coordinate in the source image you want to crop , int $src_w - crop width , int

Crop image by polygon area in Java

跟風遠走 提交于 2019-11-27 04:48:46
问题 by using Canvas and JS I can draw a shape like this and have the x,y of each point : Tha area can be choosen by more than 4 points, look at this link to have an idea. I need to save and crop the image of the selected area by using the points. I can not use BufferedImage as it is just rectangular. Which lib in java I can use? 回答1: Okay, so starting with... I used... BufferedImage source = ImageIO.read(new File("Example.jpg")); GeneralPath clip = new GeneralPath(); clip.moveTo(65, 123); clip

Crop video before encoding with MediaCodec for Grafika's “Continuous Capture” Activity

人走茶凉 提交于 2019-11-27 04:33:47
I am learning about Grafika's "Continuous Capture" Activity, It is about recording a video with MediaCodec. The activity source code is at https://github.com/google/grafika/blob/master/src/com/android/grafika/ContinuousCaptureActivity.java The program uses a SurfaceTexture obj to receive data from camera and creates 2 EGLSurface obj with this SurfaceTexture obj, one EGLSurface obj feeds the data to MediaCodec and the other feeds data to SurfaceView for camera preview. MediaCodec encodes the data to h264 data and the MediaMuxer obj writes h264 data to a mp4 file. But there is a problem, the

PHP crop image to fix width and height without losing dimension ratio

﹥>﹥吖頭↗ 提交于 2019-11-27 04:32:56
im looking to create thumbnails that has 100px by 100px dimension. i've seen many articles explaining the methods but most end up having the width!=height if the dimension ratio is to be kept. for example, i have a 450px by 350px image. i would like to crop to 100px by 100px. if i were to keep the ratio, i would end up having 100px by 77px. this makes it ugly when im listing these images in a row and column. however, a image without dimension ratio will look terrible as well. i've seen images from flickr and they look fantastic. for example: thumbnail: http://farm1.static.flickr.com/23

Let user crop image

﹥>﹥吖頭↗ 提交于 2019-11-27 04:28:38
问题 I am having a hard time in figuring out how to let the user crop the picture. I would like to give bitmap variable with loaded bitmap to crop the picture before setting it as wallpaper. But I'm failing to do so... Here is that i tried. First version. = Works as expected BUT the returned image is in poor resolution. Changing the output to higher value doesn't help. As I saw in some post it is not recommended to use camera as not all devices support this. Intent intent = new Intent("com.android

How can I crop a bitmap for ImageView?

笑着哭i 提交于 2019-11-27 04:08:16
I know this should be simple , but android:scaleType="centerCrop" doesn't crop Image I got image 1950 pixels wide and need it to be cropped by parent's width. But android:scaleType="centerCrop" doesn't crop Image. What do I need to do in layout to show only first 400 pixels , for instance or whatever screen/parent width is Sorry for simple question - tried to Google it - only complicated questions there. And I'm new, so don't downvote please) <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/rl1" android

How to crop huge image

两盒软妹~` 提交于 2019-11-27 03:33:54
问题 I need to process large images (20,000x20,000pixels) in C#. Opening these images directly isn't the way to go because of memory limitations, but what I want to do is split the image into smaller pieces (cropping). I was looking for a 3rd party library that could the trick, but so far no result. I tried FreeImage and ImageMagick, but they cannot open an 20,000x20x000 pixel image. How can I achieve this? 回答1: My current project at work consists of an image viewer/analyzing program capable of

Creating PDF file from UIWebView

筅森魡賤 提交于 2019-11-27 03:01:47
-(void)createPDFfromUIView:(UIView*)aView saveToDocumentsWithFileName:(NSString*)aFilename { // Creates a mutable data object for updating with binary data, like a byte array UIWebView *webView = (UIWebView*)aView; NSString *heightStr = [webView stringByEvaluatingJavaScriptFromString:@"document.body.scrollHeight;"]; int height = [heightStr intValue]; // Get the number of pages needed to print. 9 * 72 = 648 int pages = ceil(height / 648.0); NSMutableData *pdfData = [NSMutableData data]; UIGraphicsBeginPDFContextToData( pdfData, CGRectZero, nil ); CGRect frame = [webView frame]; for (int i = 0;

crop center portion of a numpy image

社会主义新天地 提交于 2019-11-27 02:34:53
问题 Let's say I have a numpy image of some width x and height y. I have to crop the center portion of the image to width cropx and height cropy. Let's assume that cropx and cropy are positive non zero integers and less than the respective image size. What's the best way to apply the slicing for the output image? 回答1: Something along these lines - def crop_center(img,cropx,cropy): y,x = img.shape startx = x//2-(cropx//2) starty = y//2-(cropy//2) return img[starty:starty+cropy,startx:startx+cropx]