angular2-img-cropper
angular2-img-cropper copied to clipboard
PreserveSize errors with large image
I have been struggling with the cropper on large images.
I have found that the image is not set correctly for large image.
To reproduce:
Modify the sample plunkr to have settings this.cropperSettings1.preserveSize = true;
And upload the following large image https://eoimages.gsfc.nasa.gov/images/imagerecords/73000/73751/world.topo.bathy.200407.3x21600x21600.B2.jpg
The cropped image will not display.
It's true, the plunker shows the cropped image as broken image. However I have tested locally and it works BUT the resulting crop doesn't have the size i want (150x150) but 1700x1700 from an original image of 5292x3528px;
Also, if I use the same image without preserveSize set to true, the resulting thumbnail is pixelated due to the cropping of the compressed image in the canvas.
Here are my cropper settings:
this.cropperSettings = new CropperSettings(); this.cropperSettings.width = 150; this.cropperSettings.height = 150; this.cropperSettings.croppedWidth =150; this.cropperSettings.croppedHeight = 150; this.cropperSettings.canvasWidth = 230; this.cropperSettings.canvasHeight = 200; this.cropperSettings.rounded = true; this.cropperSettings.keepAspect = true; this.cropperSettings.noFileInput = true; this.cropperSettings.preserveSize = true;
Also cannot add this.cropperSettings.cropOnResize as it's not part of my version of code, which I cannot update due to
npm WARN [email protected] requires a peer of @angular/[email protected] but none was installed. npm WARN [email protected] requires a peer of @angular/[email protected] but none was installed. npm WARN [email protected] requires a peer of @angular/[email protected] but none was installed.
yet those 3 are all at 4.3.5 as my package.json says
"@angular/common": "4.3.5", "@angular/compiler": "4.3.5", "@angular/core": "4.3.5",
Any advice from the author?