@titanium/imagefactory v1.0.55
👉 A group of Axway employees, ex-Axway employees, and some developers from Titanium community have created a legal org and now officially decide all matters related to future of these products.
API FAQ:
- API Best Practices
- What is API Security?
- OWASP Top 10 List for API Security
- What is API Security?
- Top API Trends for 2022
- What is a Frankenstein API?
- What is a Zombie API?
- API Developer Experience
- API Cybersecurity 101
- YouTube API Videos
- YouTube API Shorts Videos
@titanium/imagefactory
Titanium native mobile image transformation functions including the ability to scale, crop, and compress images.
- API FAQ:
- 📝 Description
- 🚀 Getting Started
- Accessing the @titanium/imagefactory Module Methods imageWithRotation(blob, options) Arguments imageWithAlpha(blob, options) Arguments imageWithTransparentBorder(blob, options) Arguments imageWithRoundedCorner(blob, options) Arguments imageAsThumbnail(blob, options) Arguments imageAsResized(blob, options) Arguments imageAsCropped(blob, options) Arguments imageTransform(blob, options) Arguments compress(blob, quality) * Arguments
- ✨Features
- 📚Learn More
- 📣 Feedback
- ©️ Legal
📝 Description
Ti.ImageFactory provides a set of image transformation functions including the ability to scale, crop, and compress images. Additionally, this module offers the functionality of adding alpha channels and transparent borders. This is a repackaging of the compiled iOS and Android modules for Ti.ImageFactory to allow for installation via npm.
🚀 Getting Started
- Install
@titanium/imagefactory
in root of project
npm install @titanium/imagefactory
Accessing the @titanium/imagefactory Module
To access this module from JavaScript, you would do the following:
const imageFactory = require('@titanium/imagefactory');
Methods
imageWithRotation(blob, options)
Creates a new image by creating a copy of the given image that is rotated.
Arguments
- Image blobblob: Image to transform
- Optionsdictionary: A dictionary specifying the options for the transformation
- degreesint: The degrees to rotate the image
imageWithAlpha(blob, options)
Creates a new image by creating a copy of the given image, adding an alpha channel if it doesn't already have one.
Arguments
- Image blobblob: Image to transform
- Optionsdictionary: A dictionary specifying the options for the transformation
- iOS: Currently there are no properties for this method -- specify an empty dictionary
- Android: format int: The output format of the image: either ImageFactory.PNG or ImageFactory.JPEG (default: ImageFactory.JPEG)
- Android: qualityfloat: The quality of the resulting JPEG image, expressed as a value from 0.0 to 1.0. The value 0.0 represents the maximum compression (or lowest quality) while the value 1.0 represents the least compression (or best quality). (default: 0.7)
imageWithTransparentBorder(blob, options)
Creates a new image by creating a copy of the given image, adding a transparent border of the given size around its edges. The size of the image will be expanded by the specified border size.
Arguments
- Image blobblob: Image to transform
- Optionsdictionary: A dictionary specifying the options for the transformation
- borderSizeint: The size of the border (default: 1)
- Android: format int: The output format of the image: either ImageFactory.PNG or ImageFactory.JPEG (default: ImageFactory.JPEG)
- Android: qualityfloat: The quality of the resulting JPEG image, expressed as a value from 0.0 to 1.0. The value 0.0 represents the maximum compression (or lowest quality) while the value 1.0 represents the least compression (or best quality). (default: 0.7)
imageWithRoundedCorner(blob, options)
Creates a new image by creating a copy of the given image with rounded corners.
Arguments
- Image blobblob: Image to transform
- Optionsdictionary: A dictionary specifying the options for the transformation
- borderSizeint: The size of the border (default: 1)
- cornerRadiusint: The radius of the corner edges (default: 0)
- Android: format int: The output format of the image: either ImageFactory.PNG or ImageFactory.JPEG (default: ImageFactory.JPEG).
- Android: qualityfloat: The quality of the resulting JPEG image, expressed as a value from 0.0 to 1.0. The value 0.0 represents the maximum compression (or lowest quality) while the value 1.0 represents the least compression (or best quality). (default: 0.7).
imageAsThumbnail(blob, options)
Creates a new image by creating a copy of the given image that is squared to the thumbnail size.
Arguments
- Image blobblob: Image to transform
- Optionsdictionary: A dictionary specifying the options for the transformation
- sizeint: The size of the thumbnail (default: 48)
- borderSizeint: The size of the border (default: 1)
- cornerRadiusint: The radius of the corner edges (default:0)
- iOS: qualityint: The interpolation quality. One of the following constants (default: imagefactory.QUALITY_HIGH)
- imagefactory.QUALITY_DEFAULT
- imagefactory.QUALITY_NONE
- imagefactory.QUALITY_LOW
- imagefactory.QUALITY_MEDIUM
- imagefactory.QUALITY_HIGH
- Android: qualityfloat: The quality of the resulting JPEG image, expressed as a value from 0.0 to 1.0. The value 0.0 represents the maximum compression (or lowest quality) while the value 1.0 represents the least compression (or best quality). (default: 0.7)
- Android: ditherboolean: Indicates if dithering should be applied while scaling. May provide better quality (default: true)
- Android: format int: The output format of the image: either ImageFactory.PNG or ImageFactory.JPEG (default: ImageFactory.JPEG)
imageAsResized(blob, options)
Creates a new image by creating a copy of the given image that is rescaled to the specified size.
Arguments
- Image blobblob: Image to transform
- Optionsdictionary: A dictionary specifying the options for the transformation
- widthint: The width of the new image (default: image width)
- heightint: The height of the new image (default: image height)
- iOS: hiresboolean: Create a hires image (for Retina displays only)
- iOS: qualityint: The interpolation quality. One of the following constants (default: imagefactory.QUALITY_HIGH)
- imagefactory.QUALITY_DEFAULT
- imagefactory.QUALITY_NONE
- imagefactory.QUALITY_LOW
- imagefactory.QUALITY_MEDIUM
- imagefactory.QUALITY_HIGH
- Android. format int: The output format of the image: either ImageFactory.PNG or ImageFactory.JPEG (default: ImageFactory.JPEG)
- qualityfloat: The quality of the resulting JPEG image, expressed as a value from 0.0 to 1.0. The value 0.0 represents the maximum compression (or lowest quality) while the value 1.0 represents the least compression (or best quality). (default: 0.7)
imageAsCropped(blob, options)
Creates a new image by creating a copy of the given image that is cropped to the specified bounds.
Arguments
- Image blobblob: Image to transform
- Optionsdictionary: A dictionary specifying the options for the transformation
- widthint: The width of the new image (default: image width)
- heightint: The height of the new image (default: image height)
- xint: The x-coordinate of the upper-left corner of the bounds (default: image center - width / 2)
- yint: The y-coordinate of the upper-left corner of the bounds (default: image center - height / 2)
- Android: format int: The output format of the image: either ImageFactory.PNG or ImageFactory.JPEG (default: ImageFactory.JPEG)
- Android: qualityfloat: The quality of the resulting JPEG image, expressed as a value from 0.0 to 1.0. The value 0.0 represents the maximum compression (or lowest quality) while the value 1.0 represents the least compression (or best quality). (default: 0.7)
imageTransform(blob, options)
Creates a new image by applying a sequence of transformations to the image.
Arguments
- Image blobblob: Image to transform
- Transformdictionary: A sequence of transform specifications. Transforms are listed as additional parameters to the function and are applied in the order specified. Each transform is a dictionary with the options described above for each transform along with an additional 'type' property included with each dictionary of transform options.
- typeint: The identifier of the transform to apply. One of the following constants
- imagefactory.TRANSFORM_CROP
- imagefactory.TRANSFORM_RESIZE
- imagefactory.TRANSFORM_THUMBNAIL
- imagefactory.TRANSFORM_ROUNDEDCORNER
- imagefactory.TRANSFORM_TRANSPARENTBORDER
- imagefactory.TRANSFORM_ALPHA
- options as described in the above transforms
- typeint: The identifier of the transform to apply. One of the following constants
compress(blob, quality)
Creates a new image by creating a copy of the given image and applying the specified compression quality.
Arguments
- Image blobblob: Image to compress
- Compression Qualityfloat; The quality of the resulting JPEG image, expressed as a value from 0.0 to 1.0. The value 0.0 represents the maximum compression (or lowest quality) while the value 1.0 represents the least compression (or best quality). (default: 1.0)
✨Features
iOS: ti.imagefactory 1.3.0
Android: ti.imagefactory 4.0.0
- Scale images
- Crop images
- Compress images
- Add alpha channel to images
- Add transparent borders to images
📚Learn More
📣 Feedback
Have an idea or a comment? Join in the conversation here!
©️ Legal
Modules are licensed under Apache 2.0 from https://github.com/appcelerator-modules/ti.imagefactory
Alloy is developed by Appcelerator and the community and is Copyright © 2012-Present by Appcelerator, Inc. All Rights Reserved.
Alloy is made available under the Apache Public License, version 2. See their license file for more information.
Appcelerator is a registered trademark of Appcelerator, Inc. Titanium is a registered trademark of Appcelerator, Inc. Please see the LEGAL information about using trademarks, privacy policy, terms of usage and other legal information at http://www.appcelerator.com/legal.
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago