Thanks to visit codestin.com
Credit goes to github.com

Skip to content

EvgenijLutz/ImageTools

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ImageTools

Collection of tools to load and process image data. Available on macOS 14, iOS 17, tvOS 17 and visionOS 1.

ImageTools uses the following libraries:

  • LibPNG (precompiled libpng) to load .png images.
  • tinyexr v1.0.12 to load .exr images.
  • stb's stb_image.h to load other commonly used image files like .jpg, .png, .tga, .bmp, .psd, .gif, .hdr and .pic.
  • LittleCMS (precompiled Little-CMS) to convert between color profiles.
  • ASTCEncoder to convert loaded images into ASTC-compressed textures.

tinyexr is used without its zlib implementation in miniz.c and miniz.h. Instead, ImageTools uses system provided zlib that is already linked by LibPNG.

Although both libpng and stb_image support loading .png images, libpng is prioritised, since it also loads ICC profile data that gives more color accuracy and allows precise color profile conversion with LittleCMS.

Integration

You can add this package directly to your Xcode project:

  1. In Xcode, open File -> Add Package Dependencies...
  2. Enter the package URL:
https://github.com/EvgenijLutz/ImageTools.git
  1. Choose your dependency rule and you're good to go!

Interface

ImageTools' interface is written in C++ and is available in the ImageToolsC module:

#include <ImageToolsC/ImageToolsC.hpp>

ImageTools is also bridged to Swift using Swift C++ interoperability and is available in the ImageTools module:

import ImageTools

It extends the C++ interface by providing asynchronous interfaces and helper methods to create CoreGraphics' CGImage:

@MainActor
var uiImage: UIImage? // or NSImage

@MainActor
func loadImage(path: String) async throws -> CGImage {
    let image = try await ImageContainer.load(path: path)
    uiImage = try .init(cgImage: image.cgImage)
}
 

Architecture

In the heart of the package lays the ImageContainer. This object is thread-safe.

ImageEditor allows you to perform mutations to a copy of an ImageContainer.

TODO:

Include the following libraries:

About

Process image data

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published