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

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

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 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.

android:select image from gallery then crop that and show in an imageview

Hope This Code will help you.. Activity To Select The Image From Gallery. import java.io.File; import android.app.Activity; import android.content.Intent; import android.database.Cursor; import android.net.Uri; import android.os.Bundle; import android.provider.MediaStore; import android.util.Log; public class GalleryUtil extends Activity{ private final static int RESULT_SELECT_IMAGE = 100; public static final int MEDIA_TYPE_IMAGE = 1; private static final String TAG = “GalleryUtil”; … Read more

Creating PDF file from UIWebView

Use UIPrintPageRenderer from UIWebView Follow below steps : Add Category of UIPrintPageRenderer for getting PDF Data @interface UIPrintPageRenderer (PDF) – (NSData*) printToPDF; @end @implementation UIPrintPageRenderer (PDF) – (NSData*) printToPDF { NSMutableData *pdfData = [NSMutableData data]; UIGraphicsBeginPDFContextToData( pdfData, self.paperRect, nil ); [self prepareForDrawingPages: NSMakeRange(0, self.numberOfPages)]; CGRect bounds = UIGraphicsGetPDFContextBounds(); for ( int i = 0 ; … 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