How to convert all images to JPG format in PHP?

Maybe it’s not working with PNG because PNG only supports compression levels 0 to 9. I’d also rather modify the behaviour based on MIME type, not extension. And I guess you’re checking your POST user input before using it in code 😉 Here’s my variant of the code: $path = “../images/DVDs/”; $img = $path . … Read more

How can I crop a bitmap for ImageView?

Alright, I will paste the comment as answer 🙂 -> RelativeLayout rl = (RelativeLayout) findViewById(R.id.rl1); final Options bitmapOptions=new Options(); DisplayMetrics metrics = getResources().getDisplayMetrics(); bitmapOptions.inDensity = metrics.densityDpi; bitmapOptions.inTargetDensity=1; /*`final` modifier might be necessary for the Bitmap*/ Bitmap bmp= BitmapFactory.decodeResource(getResources(), R.drawable.ver_bottom_panel_tiled_long, bitmapOptions); bmp.setDensity(Bitmap.DENSITY_NONE); bmp = Bitmap.createBitmap(bmp, 0, 0, rl.getWidth(), bmp.getHeight()); Then in the code: ImageView iv = … Read more

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

Take a look at the “texture from camera” activity. Note it allows you to manipulate the image in various ways, notably “zoom”. The “zoom” is done by modifying the texture coordinates. The ScaledDrawable2D class does this; the setScale() call changes the “zoom”, rather than scaling the rect itself. Texture coordinates range from 0.0 to 1.0 … Read more

Crop a Bitmap image

I used this method to crop the image and it works perfect: Bitmap bmp = BitmapFactory.decodeResource(getResources(), R.drawable.xyz); Bitmap resizedBmp = Bitmap.createBitmap(bmp, 0, 0, yourwidth, yourheight); createBitmap() takes bitmap, start X, start Y, width & height as parameters.

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

Set dimensions for UIImagePickerController “move and scale” cropbox

Not possible with UIImagePickerController unfortunately. The solution I recommend is to disable editing for the image picker and handle it yourself. For instance, I put the image in a scrollable, zoomable image view. On top of the image view is a fixed position “crop guide view” that draws the crop indicator the user sees. Assuming … Read more

How to crop the parsed image in android?

I assume you’ve already “got” the images down from the website and want to resize rather than crop? I.e. create thumbnails. If so, you can use the following: // load the origial BitMap (500 x 500 px) Bitmap bitmapOrg = BitmapFactory.decodeResource(getResources(), R.drawable.android); int width = bitmapOrg.width(); int height = bitmapOrg.height(); int newWidth = 200; int … Read more

tech