Welcome to the official documentation for the AmpOptip library!


Using CocoaPods

  1. Open your project folder in Terminal.
  2. Run the command pod init to create a Podfile.
  3. Open the Podfile and add the following line:
pod 'AmpOptip'
  1. Save the Podfile and run pod install.
  2. Close your Xcode project and open the newly created .xcworkspace file.
  3. You can now import the AmpOptip library using #import <AmpOptip/AmpOptip.h>

Manual Installation

  1. Download the latest AmpOptip framework from the GitHub releases page.
  2. Drag and drop the downloaded framework into your Xcode project.
  3. Make sure to check the “Copy items if needed” checkbox.
  4. In the dialog that appears, choose “Create groups” and ensure your target is selected.
  5. You can now import the AmpOptip library using #import <AmpOptip/AmpOptip.h>


Importing AmpOptip

To use the AmpOptip library in your project, you need to import it first:

#import <AmpOptip/AmpOptip.h>

Optimizing Images

To optimize an image using AmpOptip, follow these steps:

Step 1: Set up AmpOptip

Initialize the AmpOptip framework by calling the ampOptipInit() method:

[AmpOptip ampOptipInit];

Step 2: Optimize an image

To optimize an image, pass the image file URL or a NSData object containing the image data to the ampOptipOptimizeImage method:

NSData *imageData = UIImageJPEGRepresentation(image, 1.0f);
[AmpOptip ampOptipOptimizeImage:imageData completion:^(NSData *optimizedData, NSError *error) {
    if (error) {
        NSLog(@"Image optimization failed: %@", error.localizedDescription);
    } else {
        // Use the optimized image data
        UIImage *optimizedImage = [UIImage imageWithData:optimizedData];
        // ...

Step 3: Handle the optimized image data

In the completion block, you can handle the optimized image data as needed. In the above example, we create a new UIImage object from the optimized data.

Advanced Usage

If you require more control over the optimization process, you can use the ampOptipOptimizeImageWithOptions method. This method accepts an AmpOptipOptions object which allows you to customize various parameters for optimization.

AmpOptipOptions *options = [[AmpOptipOptions alloc] init];
// Customize the options as desired
[AmpOptip ampOptipOptimizeImageWithOptions:imageData options:options completion:^(NSData *optimizedData, NSError *error) {
    // Handle optimized image data
    // ...

Additional Documentation

For more detailed information on the AmpOptip library, check out the official GitHub repository.