Croppie icon indicating copy to clipboard operation
Croppie copied to clipboard

Question regarding to crop and zoom value

Open Daargajedan opened this issue 6 years ago • 3 comments

Expected Behavior

Im building an ios app where i want to crop an image as well, i save the original so later on you can crop different. Everthing works fine exept for the zoom value, i dont understand how the zoom works in croppie. Is it the scale size of the image regarding to the view?

My cropper uses the size of the image and the new size to get the zoom value.

zo original width / new widht = zoom value

Daargajedan avatar Nov 28 '18 22:11 Daargajedan

I have the same problem I use

profilePhotoCrop = $('#user-photo').croppie({
	enableExif: true,
	viewport: {
		width: 200,
		height: 200,
		type: 'circle'
	},
	boundary: {
		width: 300,
		height: 300
	},
});
profilePhotoCrop.croppie('setZoom', 1.1);

and whatever value I set in setZoom nothing happens.

gianlucagiacometti avatar Jan 12 '19 10:01 gianlucagiacometti

zoom has to do with relationship between viewport and result size.

Ex.

  • my viewport is 300px X 450px
  • my "result" size: {width: 1200, height: 1800}

if the original image is 2400px X 3600px:

  • zoom of 0 will output the whole picture resized to 1200px X 1800px
  • zoom of 1 will output a crop of the original photo, again 1200px X 1800px. This crop is actually half the original photo.
  • zoom of 1.5 (default maxZoom) will crop a 600px X 900px section of the photo and scale it up to 1200px X 1800px

if you wish to never "scale up" an image, in this scenario, you can set maxZoom to 0.25, the ratio between the viewport & result size. (but there is a small bug, use maxSize of 0.255)

webmasterMeyers avatar May 22 '19 18:05 webmasterMeyers

I don't use the zoom value any more in the app, i only use the new viewport and the sizes of the image to get the zoom value.

Hope this helps

Daargajedan avatar May 24 '19 14:05 Daargajedan