ng2-img-tools | Angular 2 tools to resize , crop or compress images | Computer Vision library
kandi X-RAY | ng2-img-tools Summary
kandi X-RAY | ng2-img-tools Summary
Angular 2 tools to resize, crop or compress images
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of ng2-img-tools
ng2-img-tools Key Features
ng2-img-tools Examples and Code Snippets
Community Discussions
Trending Discussions on ng2-img-tools
QUESTION
I have installed ng2-img-max for the purpose of resizing images. I want that every image uploaded get resized to a pre-defined width and length. I see most people uses ng2-img-max when developing with angular 2/4. I tryed playing with that lib and then I faced the following error:
Resize exact fill error:
{resizedFile: File, reason: TypeError: Cannot read property 'resizeCanvas' of undefined
at http://localhost:4200/vendor.bund…, error: "PICA_ERROR"}
I tried to debug and saw that at Ng2PicaService.prototype.resizeCanvas (ng2-pica.service.js) after the following statement:
...ANSWER
Answered 2017-Oct-13 at 02:31you should: npm install pica
or yarn add pica
then:
QUESTION
I'm trying to understand the use of observables,
everything is ok in the simple cases, but in one case I want to compress several images.
I'm using ng2-img-tools
Method to compress an image. This reduces the quality of an image down until it fits a certain fileSize which is given as maxSizeInMB. Set ignoreAlpha to true if you want to ignore the alpha channel for png images and compress them nonetheless (not recommended - the alpha channel will be lost and the resulting image might differ from the original image). Returns an observable that for every file given, onNext receives either a File when everything went as planned or an error Object if something went wrong.
In my code, I'm doing the following :
...ANSWER
Answered 2017-Apr-02 at 19:23The issue is that you need subscribe
to the function, not perform another map. When you subscribe to an observable, you're implicitly receiving the value of onNext()
as result
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install ng2-img-tools
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page