crop
Crop an Image by passing the image file path in Android
I have solved this by create a new file before calling Intent and passing this file path to store the cropped image through intent. Here is the solution for this. private Uri mCropImagedUri; private final int CROP_IMAGE = 100;//unique request code number. Which is used to identify the request result in onActivityResult() /**Crop the image … Read more
Image Cropping using Python
I took a quick look and fixed a few other problems along the way. Essentially my changes do this: Draw the bounding box on a temporary image, set its alpha transparency, and then blit this over top of the main image. Avoid extraneous drawing cycles (when the mouse isn’t moving, no sense in drawing the … Read more
How to animate ImageView from center-crop to fill the screen and vice versa (facebook style)?
Ok, i’ve found a possible way to do it. i’ve made the layoutParams as variables that keep changing using the ObjectAnimator of the nineOldAndroids library. i think it’s not the best way to achieve it since it causes a lot of onDraw and onLayout, but if the container has only a few views and doesn’t … Read more
Crop square image to circle – Programmatically
Once the bitmap is retrieved RoundedBitmapDrawableFactory can be used to generate a RoundedBitmapDrawable from the v4 Support Library. That Drawable can then be applied to an ImageView or directly drawn to a Canvas. // Create the RoundedBitmapDrawable. RoundedBitmapDrawable roundDrawable = RoundedBitmapDrawableFactory.create(getResources(), bitmap); roundDrawable.setCircular(true); // Apply it to an ImageView. ImageView imageView = (ImageView)findViewById(R.id.imageView); imageView.setImageDrawable(roundDrawable); // … Read more
Automatically cropping an image with python/PIL
Install Pillow pip install Pillow and use as from PIL import Image image=Image.open(‘L_2d.png’) imageBox = image.getbbox() cropped = image.crop(imageBox) cropped.save(‘L_2d_cropped.png’) When you search for boundaries by mask=imageComponents[3], you search only by blue channel.
Cropping image in PHP
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) … Read more
iOS Audio Trimming
Here’s the code that I’ve used to trim audio from a pre-existing file. You’ll need to change the M4A related constants if you’ve saved or are saving to another format. – (BOOL)trimAudio { float vocalStartMarker = <starting time>; float vocalEndMarker = <ending time>; NSURL *audioFileInput = <your pre-existing file>; NSURL *audioFileOutput = <the file you … Read more
How to “crop” a rectangular image into a square with CSS?
A pure CSS solution with no wrapper div or other useless code: img { object-fit: cover; width: 230px; height: 230px; }
Crop whitespace from image in PHP
To trim all whitespace, as you call it, surrounding the interesting part of the image, first we find out where the “whitespace” stops, and then we copy everything inside of those borders. //load the image $img = imagecreatefromjpeg(“http://ecx.images-amazon.com/images/I/413XvF0yukL._SL500_AA280_.jpg”); //find the size of the borders $b_top = 0; $b_btm = 0; $b_lft = 0; $b_rt = … Read more