Search Results

Search found 350 results on 14 pages for 'crop'.

Page 3/14 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • How to crop the UIImage?

    - by Rajendra Bhole
    Hi, I develop an application in which i process the image using its pixels but in that image processing it takes a lot of time. Therefore i want to crop UIImage (Only middle part of image i.e. removing/croping bordered part of image).I have the develop code are, - (NSInteger) processImage1: (UIImage*) image { CGFloat width = image.size.width; CGFloat height = image.size.height; struct pixel* pixels = (struct pixel*) calloc(1, image.size.width * image.size.height * sizeof(struct pixel)); if (pixels != nil) { // Create a new bitmap CGContextRef context = CGBitmapContextCreate( (void*) pixels, image.size.width, image.size.height, 8, image.size.width * 4, CGImageGetColorSpace(image.CGImage), kCGImageAlphaPremultipliedLast ); if (context != NULL) { // Draw the image in the bitmap CGContextDrawImage(context, CGRectMake(0.0f, 0.0f, image.size.width, image.size.height), image.CGImage); NSUInteger numberOfPixels = image.size.width * image.size.height; NSMutableArray *numberOfPixelsArray = [[[NSMutableArray alloc] initWithCapacity:numberOfPixelsArray] autorelease]; } How i take(croping outside bordered) the middle part of UIImage?????????

    Read the article

  • GAE images.resize with fixed proportional crop

    - by user288541
    I need to resize and crop to exactly 60x80px from various size and aspect ratio. Just before i put into Datastore. Anyone already got this issue resolved. Currently i already succed to just transform it to exact height (80px) with various width which nott look so good when i try to display it on a list. e.g jcaroussel. My db.put code is like bellow: if users.get_current_user(): personal.personal_id = int(self.request.get('personal_id')) personal.name = self.request.get('name') personal.latitude = self.request.get('latitude') personal.info = self.request.get('info') photo = images.resize(self.request.get('img'), 0, 80) personal.photo = db.Blob(photo) personal.lc_id = int(self.request.get('lc_id')) personal.put() self.redirect('/admin/personal') else: self.response.out.write('I\'m sorry, you don\'t have permission to add this LP Personal Data.') I just want to do similar result when we upload our avatar on google talk/google chat. Anyone solved this? Thx

    Read the article

  • Crop & Resize Images in Wordpress

    - by Thomas
    I have gone through several plugins and I can't find a plugin that simply resizes and crops images to a specific size when they get uploaded. This is different from simply resizing one side of the image, I need it to resize the smallest side and then crop the largest side so that the image fits in a specific space. WP already does this by default with thumbnails but I need to do this with full-sized images as well. I was going to use: http://wordpress.org/extend/plugins/scissors/ but it doesn't work with my installation. Can anyone think of another plugin that does this? Is there a simple way to enable this behavior for full size images by modifying wordpress?

    Read the article

  • PHP/GD - Cropping and Resizing Images

    - by Alix Axel
    I've coded a function that crops an image to a given aspect ratio and finally then resizes it and outputs it as JPG: <?php function Image($image, $crop = null, $size = null) { $image = ImageCreateFromString(file_get_contents($image)); if (is_resource($image) === true) { $x = 0; $y = 0; $width = imagesx($image); $height = imagesy($image); /* CROP (Aspect Ratio) Section */ if (is_null($crop) === true) { $crop = array($width, $height); } else { $crop = array_filter(explode(':', $crop)); if (empty($crop) === true) { $crop = array($width, $height); } else { if ((empty($crop[0]) === true) || (is_numeric($crop[0]) === false)) { $crop[0] = $crop[1]; } else if ((empty($crop[1]) === true) || (is_numeric($crop[1]) === false)) { $crop[1] = $crop[0]; } } $ratio = array ( 0 => $width / $height, 1 => $crop[0] / $crop[1], ); if ($ratio[0] > $ratio[1]) { $width = $height * $ratio[1]; $x = (imagesx($image) - $width) / 2; } else if ($ratio[0] < $ratio[1]) { $height = $width / $ratio[1]; $y = (imagesy($image) - $height) / 2; } /* How can I skip (join) this operation with the one in the Resize Section? */ $result = ImageCreateTrueColor($width, $height); if (is_resource($result) === true) { ImageSaveAlpha($result, true); ImageAlphaBlending($result, false); ImageFill($result, 0, 0, ImageColorAllocateAlpha($result, 255, 255, 255, 127)); ImageCopyResampled($result, $image, 0, 0, $x, $y, $width, $height, $width, $height); $image = $result; } } /* Resize Section */ if (is_null($size) === true) { $size = array(imagesx($image), imagesy($image)); } else { $size = array_filter(explode('x', $size)); if (empty($size) === true) { $size = array(imagesx($image), imagesy($image)); } else { if ((empty($size[0]) === true) || (is_numeric($size[0]) === false)) { $size[0] = round($size[1] * imagesx($image) / imagesy($image)); } else if ((empty($size[1]) === true) || (is_numeric($size[1]) === false)) { $size[1] = round($size[0] * imagesy($image) / imagesx($image)); } } } $result = ImageCreateTrueColor($size[0], $size[1]); if (is_resource($result) === true) { ImageSaveAlpha($result, true); ImageAlphaBlending($result, true); ImageFill($result, 0, 0, ImageColorAllocate($result, 255, 255, 255)); ImageCopyResampled($result, $image, 0, 0, 0, 0, $size[0], $size[1], imagesx($image), imagesy($image)); header('Content-Type: image/jpeg'); ImageInterlace($result, true); ImageJPEG($result, null, 90); } } return false; } ?> The function works as expected but I'm creating a non-required GD image resource, how can I fix it? I've tried joining both calls but I must be doing some miscalculations. <?php /* Usage Examples */ Image('http://upload.wikimedia.org/wikipedia/commons/4/47/PNG_transparency_demonstration_1.png', '1:1', '600x'); Image('http://upload.wikimedia.org/wikipedia/commons/4/47/PNG_transparency_demonstration_1.png', '2:1', '600x'); Image('http://upload.wikimedia.org/wikipedia/commons/4/47/PNG_transparency_demonstration_1.png', '2:', '250x300'); ?> Any help is greatly appreciated, thanks.

    Read the article

  • detect face from image and crop face from that photo

    - by Siddhpura Amit
    I have done coding in that i am successfully getting face with rectangle drawing now i want to crop that rectangle area. if there are many rectangle( mean many faces) than user can select one of the face or rectangle and that rectangle areal should be cropped can any body help me... Below is my code class AndroidFaceDetector extends Activity { public String path; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Bundle bundle = this.getIntent().getExtras(); path = bundle.getString("mypath"); setContentView(new myView(this)); } class myView extends View { private int imageWidth, imageHeight; private int numberOfFace = 5; private FaceDetector myFaceDetect; private FaceDetector.Face[] myFace; float myEyesDistance; int numberOfFaceDetected; Bitmap myBitmap; public myView(Context context) { super(context); System.out.println("CONSTRUCTOR"); System.out.println("path = "+path); if (path != null) { BitmapFactory.Options BitmapFactoryOptionsbfo = new BitmapFactory.Options(); BitmapFactoryOptionsbfo.inPreferredConfig = Bitmap.Config.RGB_565; myBitmap = BitmapFactory.decodeFile(path, BitmapFactoryOptionsbfo); imageWidth = myBitmap.getWidth(); imageHeight = myBitmap.getHeight(); myFace = new FaceDetector.Face[numberOfFace]; myFaceDetect = new FaceDetector(imageWidth, imageHeight, numberOfFace); numberOfFaceDetected = myFaceDetect.findFaces(myBitmap, myFace); } else { Toast.makeText(AndroidFaceDetector.this, "Please Try again", Toast.LENGTH_SHORT).show(); } } @Override protected void onDraw(Canvas canvas) { System.out.println("ON DRAW IS CALLED"); if (myBitmap != null) { canvas.drawBitmap(myBitmap, 0, 0, null); Paint myPaint = new Paint(); myPaint.setColor(Color.GREEN); myPaint.setStyle(Paint.Style.STROKE); myPaint.setStrokeWidth(3); for (int i = 0; i < numberOfFaceDetected; i++) { Face face = myFace[i]; PointF myMidPoint = new PointF(); face.getMidPoint(myMidPoint); myEyesDistance = face.eyesDistance(); canvas.drawRect((int) (myMidPoint.x - myEyesDistance), (int) (myMidPoint.y - myEyesDistance), (int) (myMidPoint.x + myEyesDistance), (int) (myMidPoint.y + myEyesDistance), myPaint); } } } } }

    Read the article

  • How to create an image from a UIView / UIScrollView

    - by Andre
    Hi, I have an image in an UIScrollView, that can be scrolled and zoomed. When the user presses a button, I want the code to create an image from whatever part of the UIScrollView is inside an area I specify with a CGRect. I've seen code to crop UIImages, but I can't adapt it to do the same for a view, because it uses CGContextDrawImage. Any thoughts? Cheers, Andre

    Read the article

  • Croping images with no loss using .NET

    - by zaladane
    I am trying to understand why after croping an image in .NET i end up with an image 3 times the size of the original image. Listed below is the code i am using to crop the image Private Shared Function CropImage(ByVal img As Image, ByVal cropArea As Rectangle) As Image Dim bmpImage As Bitmap = New Bitmap(img) Dim bmpCrop As Bitmap = bmpImage.Clone(cropArea, img.PixelFormat) Return CType(bmpCrop, Image) End Function where img is the original image loaded from file into an image object. How can i achieve a loss less cropping of my image?

    Read the article

  • Cropped thumbnails in WordPress

    - by codethief
    Quote from Wordpress' image editor: The thumbnail image can be cropped differently. For example it can be square or contain only a portion of the original image to showcase it better. Here you can select whether to apply changes to all image sizes or make the thumbnail different. This is exactly what I'd like to do, except for the fact that I don't want Wordpress to scale it down to 150x150 pixels (or another predefined resolution). I'd just like to display a cropped (and therefore smaller) version of the picture which is then linked to the (uncropped) original. I also tried to set the thumbnails' width and height to 0 in the preferences. Then, however, I don't even get the chance to assign a cropped version as thumbnail in the editor. Could you tell me how to achieve that? Or isn't it possible at all?

    Read the article

  • Word 2010 is automatically cropping image being insterted

    - by truthseeker
    Word 2010 is automatically cropping image being insterted like this: The million dollar question is why? I have this problem only in this particular section of this document. There is no such problem in another sections of document. The one possibility how to display whole area of image is to use floating layout like the first image in presented screenshot. But this solution has disadvantage that I have to manually format image positions after changes in text before.

    Read the article

  • Image cropping in PHP is producing blank result

    - by thinkswan
    I'm simply trying to crop a JPEG image (no scaling) using PHP. Here is my function, along with the inputs. function cropPicture($imageLoc, $width, $height, $x1, $y1) { $newImage = imagecreatetruecolor($width, $height); $source = imagecreatefromjpeg($imageLoc); imagecopyresampled($newImage,$source,0,0,$x1,$y1,$width,$height,$width,$height); imagejpeg($newImage,$imageLoc,90); } When I call it as follows--cropPicture('image.jpg', 300, 300, 0, 0)--the function completes properly, but I'm left with a black image that is 300x300 px (in other words, a blank canvas). Am I passing in the wrong arguments? The image exists and is writeable.

    Read the article

  • Image jQuery scroller in a container. (like facebook cropper) can't get values of position.

    - by Stefan
    Hey all. Having a reallllll mind pain. I have a php image uploader which is all good and sotring the file and the jquery ajax is returning the image in an ammended html div with a div set up like this: #crop-holder { width:80px; height:80px; margin:10px 10px 20px 10px; border:1px #c0c0c0 solid; overflow:hidden; cursor:move; } The image is viewing fine and I am using the jquery scrollview plugin: http://code.google.com/p/jquery-scrollview/ I have tried adding a few lines to the plugin to store variables of scrollTop and Left and then replacing two hidden input values with x and y in my page. And then on the returned ajax html in the div I am trying to on a button click (for example) retrieve the values of the two hidden inputs.... Heres what i added to the plugin (i'm no js expert!): .mouseout(function(){ var _m = this.m; var lasty = _m.scrollTop(); getElementById("ycord").value = lasty; var lastx = _m.scrollLeft(); getElementById("xcord").value = lastx; self.stopgrab(); }) Still no luck!! How can I get the scrollTop and scrollLeft and successfully prepare them for sending onto another php script!? Thanks:) stefpretty

    Read the article

  • Crop and Resize Image to Specific Dimensions

    - by Crunchy
    I need some help cropping and resizing images using CSharp.net. My goal here is to take an image and reduce it to 50px by 50px. The following code I found here will do that, however it's scaling the image as well. Ideally I want to scale the image down to as close to 50px by 50px as possible and then remove the parts of the image that are outside 50px by 50px. public Image ResizeImage(Image img, int width, int height) { Bitmap b = new Bitmap(width, height); using (Graphics g = Graphics.FromImage((Image)b)) { g.DrawImage(img, 0, 0, width, height); } return (Image)b; }

    Read the article

  • UIImage resize and crop to fit

    - by Amit Hagin
    I read a lot, also here, but couldn't find a simple way to do it: In objective c - I have a big UIImage and a small UIImageView. I want to programmatically shrink the content of a UIImage just enough to fit the smaller dimension within the UIImageView. The larger dimension will be cropped, and the result will be the maximum I can get from an image without changing the proportion. can you please help me?

    Read the article

  • css to crop an image instead of stretching it

    - by amit
    i am taking an image from a source, say, facebook. now when i want to insert that image in a container with fixed width and height, the image stretches to fit that space. is there a way the image can display in its normal size and the rest of the area clipped out?

    Read the article

  • imagecopyresampled to resize and crop an image - not returning the expected result

    - by David
    imagecopyresized ( resource $dst_image , resource $src_image , int $dst_x , int $dst_y , int $src_x , int $src_y , int $dst_w , int $dst_h , int $src_w , int $src_h ) This is what I want to do: I have an image that's 600x1000px in size, and I want to create a thumb that's 100x100px after resizing that image to 300x500px, the x coordinate for the top left point of the thumb square should be at 100(src x) and 120(src y). According to what I understand from the manual, the command should be $dst_image = imagecreatetruecolor(100,100); $src_image = imagecreatefromjpeg('/home/sandbox/imagetoresize.jpg'); imagecopyresized ($dst_image, $src_image, 0, 0, 100, 120, **300 , 500 , 600 , 1000** ) It is cropping the image just fine, but it isn't resizing it correctly. I never got it to match what I see in my image editor (the GIMP). What am I doing wrong? I confirmed that all the numbers are correct, but it's always shifted up or down no matter what I do. Your help would really be appreciated!

    Read the article

  • Looking for a Toolbox (Crop/Position/Rotate) for a Website

    - by VIRTUALWEB
    I'm looking for a Toolbox for a Website that can do the following things: Write Text in a Text Editor (change its color/font size/font) and display it over an product image (plus drag&drop, do rotation). As Texteditor i could use TinyMCE but how to rotate/drag&drop? the same with images (upload a logo, display it over an existing product image) where the user could drag&drop it around or rotate it left/right in 90 degrees, and change its size. are there any tools outside that can handle that requirements? They could be AJAX, Flash, jQuery, JavaScript, ... tia

    Read the article

  • iPhone - How do you make a resizable rectangle for cropping images?

    - by 0SX
    Hi everyone, I'm having a trouble making a re-sizable rectangle for cropping my images. I'm trying to achieve something like this picture: http://img192.imageshack.us/img192/8930/customcropbox.jpg Well, the only problem is I have no clue where to actually start. I need some advice to how I can achieve this effect of cropping. What documentation should I read up on? Core Graphics or Quartz 2d? Both? I've been coding for the iPhone since it's release date but I've never actually used core graphics and etc. Any help or advice would be much appreciated. I'll throw my code up here as I progress to show how it's done when I achieve it. :-) Also, this rectangular box is moveable across the screen in a UIImageView which just makes it more interesting. Thanks for the help and I look forward to achieving this goal.

    Read the article

  • PHP image resize and rounded image corners dynamically

    - by Dan
    I'm working of a script that dynamically ads rounded edges to an image then crops it down to a certain size. At the moment the script ads the rounded edges to the picture but i cannot get it so the original image is resized to fit within the dimensons of the final outputted image (140px x 120px) The problem is that the orginal uploaded image depending on it's orginal dimensions change the size it is in the final PNG { $image_file = $_FILES['image']['tmp_name']; $corner_radius = isset($_GET['radius']) ? $_GET['radius'] : 20; // The default corner radius is set to 20px $topleft = (isset($_GET['topleft']) and $_GET['topleft'] == "no") ? false : true; // Top-left rounded corner is shown by default $bottomleft = (isset($_GET['bottomleft']) and $_GET['bottomleft'] == "no") ? false : true; // Bottom-left rounded corner is shown by default $bottomright = (isset($_GET['bottomright']) and $_GET['bottomright'] == "no") ? false : true; // Bottom-right rounded corner is shown by default $topright = (isset($_GET['topright']) and $_GET['topright'] == "no") ? false : true; // Top-right rounded corner is shown by default $imagetype=$_FILES['image']['type']; $endsize=$corner_radius; $startsize=$endsize*3-1; $arcsize=$startsize*2+1; if (($imagetype=='image/jpeg') or ($imagetype=='jpg')) { $image = imagecreatefromjpeg($image_file); } else { if (($imagetype=='GIF') or ($imagetype=='gif')) { $image = imagecreatefromgif($image_file); } else { $image = imagecreatefrompng($image_file); } } $forecolor ='#ffffff'; $size = getimagesize($image_file); // Top-left corner $background = imagecreatetruecolor($size[0],$size[1]); imagecopymerge($background, $image, 0, 0, 0, 0, $size[0], $size[1], 100); $startx=$size[0]*2-1; $starty=$size[1]*2-1; $im_temp = imagecreatetruecolor($startx,$starty); imagecopyresampled($im_temp, $background, 0, 0, 0, 0, $startx, $starty, $size[0], $size[1]); $bg = imagecolorallocate($im_temp, 255,255,255); $fg = imagecolorallocate($im_temp, 255,255,255); if ($topleft == true) { if(!imagearc($im_temp, $startsize, $startsize, $arcsize, $arcsize, 180,270,$bg))echo "nope"; imagefilltoborder($im_temp,0,0,$bg,$bg); } // Bottom-left corner // Top-right corner if ($topright == true) { imagearc($im_temp, $startx-$startsize, $startsize,$arcsize, $arcsize, 270,360,$bg); imagefilltoborder($im_temp,$startx,0,$bg,$bg); } $image = imagecreatetruecolor(140,120); imagecopyresampled($image, $im_temp, 0, 0, 0, 0, $size[0],$size[1],$starty+1310,$startx+1500); // Output final image if(!imagepng($image,'hello.png')) echo "boo"; if(!imagedestroy($image)) echo "2"; if(!imagedestroy($background)) echo "3"; if(!imagedestroy($im_temp)) echo "4"; } EDIT: My question is how to get the orginal image reized so it fits into the 140 x 120 image that is processed with the rounded edges?

    Read the article

  • An image cropper: How to prevent the default drag n' drop action?

    - by David Gore
    I am developing an image cropper and would like to ask you the following question: In order to prevent the default drag n' drop action when you press the left button on an image and keeping it pressed try to move the mouse, wouldn't it be cross-browser if to just use the picture as a background to a div box? Just like so: <div id="theDiv" style="background:url(pic.png) no-repeat;"></div> How do you think? Is it acceptable? Not too ugly? Or should be done with JS?

    Read the article

  • Differentiate A Section/Portion of 3D object From Other Parts

    - by Ramshad
    I am trying to write a WPF windows application that dynamically creates a 3 D object for an existing 3D Image. The senerio is as follows. Mark the points randomly on the existing 3D Image. Create a 3D object based on the points already marked. Check the below Sample Screenshots. Screenshot 1 and Screenshot 2 I am successfully able to load the 3D file to the WPF form. And was able to perform the rotation using TrackballDecorator 3D Tools library. I have just read this related post. however i didn't get it exactly :) So,can you suggest some efficient methods to achieve it.

    Read the article

  • Why does my Image stretch when I crop it?

    - by q234e
    I am using the following code snippet in order to crop a image? function crop($width,$height) { $new_image = imagecreatetruecolor($width, $height); imagecopyresampled($new_image, $this->image, 0, 0, 0, 0, $this->getWidth(), $this->getHeight(), $width, $height ); $this->image = $new_image; } Here, $this->image is the original image $this->getWidth() and $this->getHeight() holds the original dimensions of the picture, where as $width and $height, is the crop area. But for some reason, the crop image is resized(we can almost say it is resized). How to fix this?

    Read the article

  • How can I crop every page of a large PDF file?

    - by Andrew
    I have a 1300 page PDF file of a scanned book that was unfortunately not cropped when scanned. The actual book page dimensions are around 6x9", but each scanned page is 8.5x11", the size of the scanner bed. For much smaller PDF files I could throw it into Photoshop and crop the page, but this is a huge file. What is the best way to losslessly crop all of the pages of the file, in either Windows or OS X?

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >