- Notifications
You must be signed in to change notification settings - Fork2
Conveniences for handling images and colors in AppKit, UIKit, SwiftUI and CoreGraphics (Swift/Objective-C)
License
dagronf/DSFImageTools
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
A wrapper around CGImageSource to provide conveniences for dealing with multi-image images, location and gps and more.
- 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
A CGImage convenience library ('Wrapped' CGImage) providing ability to modify/draw on an image
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 intoCGImage
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 theseCGImage
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.
MIT LicenseCopyright (c) 2022 Darren FordPermission is hereby granted, free of charge, to any person obtaining a copyof this software and associated documentation files (the "Software"), to dealin the Software without restriction, including without limitation the rightsto use, copy, modify, merge, publish, distribute, sublicense, and/or sellcopies of the Software, and to permit persons to whom the Software isfurnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in allcopies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ORIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THEAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERLIABILITY, 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 THESOFTWARE.
About
Conveniences for handling images and colors in AppKit, UIKit, SwiftUI and CoreGraphics (Swift/Objective-C)