Take squared images using the camera


I’m using the mdg:camera package and I want to take squared (600px * 600px) images. Something similar to Instagram.

But I don’t find a way to automatically crop them. From the documentation:

options is an optional argument that is an Object with the following possible keys:

width An integer that specifies the minimum width of the returned photo.
height An integer that specifies the minimum height of the returned photo.

I don’t need to set up the minimum size, but the maximum. Are there more options available for the camera?


I’m not sure if you mean your using cordova which I am not. I did it with

var canvas = document.createElement("canvas");
var ctx = canvas.getContext("2d");
ctx.canvas.width = newWidth;
ctx.canvas.height = newHeight;
ctx.drawImage(img ....


imageElement.src = canvas.toDataURL("image/jpeg");

The code above is a bit incomplete but I hope it helps…


I’m trying to do it with the MeteorCamera.getPicture() :blush:


I just used a width and height on them. Depends how exactly you want them cropped though.


But cropping them this way might cut important parts of the image, as the camera is taking portrait pictures and I will display only squared ones…