DSFImageTools

main

Conveniences for handling images and colors in AppKit, UIKit, SwiftUI and CoreGraphics (Swift/Objective-C)
dagronf/DSFImageTools

DSFImageTools

Swift Package Manager

DSFImageSource

A wrapper around CGImageSource to provide conveniences for dealing with multi-image images, location and gps and more.

Why DSFImageSource?

  • Provides lower-level information access to an image. For example, GPS data cannot be loaded from an NSImage.
  • Support for images with multiple frames (like gifs, multipage tiff files etc.)
  • Create a image file with multiple frames.

Information about DSFImageSource

WCGImage

A CGImage convenience library ('Wrapped' CGImage) providing ability to modify/draw on an image

Why WCGImage?

There has been quite a few times where I've had to do some form of image manipulation. While it can be relatively straight forward, now we have UIImage, NSImage and CGImage (let alone SwiftUI's Image type) to deal with.

I very often find myself falling down into CGImage to provide cross-platform support for image manipulations, as all of the platform-specific classes have easy methods for converting to/from CGImage.

I've collated a number of these CGImage routines in this simple library.

  • loading from file/data
  • flipping
  • scaling (aspect fill, aspect fit, axes independent)
  • rotating
  • image orientation
  • cropping
  • tinting
  • adjusting hsb
  • masking to an image
  • drawing on an image
  • converting to grayscale
  • converting to cmyk
  • exporting to png/jpg/tiff

If you're performing a lot of these functions one after the other it is definitely not as performant as creating all the functions in a single context, BUT, for my needs this library is simple and easy way to avoid re-writing the same code over and over again. Also means bug fixes happen in a single place and fix across the board.

Information about WCGImage

License

MIT License

Copyright (c) 2022 Darren Ford

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Description

  • Swift Tools 5.4.0
View More Packages from this Author

Dependencies

Last updated: Mon Nov 25 2024 14:14:52 GMT-1000 (Hawaii-Aleutian Standard Time)