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

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

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