All Projects → ngageoint → tiff-ios

ngageoint / tiff-ios

Licence: MIT license
Tagged Image File Format iOS Library

Programming Languages

objective c
16641 projects - #2 most used programming language
swift
15916 projects

Projects that are alternatives of or similar to tiff-ios

tiff-java
Tagged Image File Format Java Library
Stars: ✭ 65 (+150%)
Mutual labels:  tiff, geopackage-libraries, nga, geopackage
geopackage-ios
GeoPackage iOS Library
Stars: ✭ 45 (+73.08%)
Mutual labels:  geopackage-libraries, nga, geopackage, ios-lib
geopackage-mapcache-ios
GeoPackage MapCache iOS App
Stars: ✭ 20 (-23.08%)
Mutual labels:  geopackage-libraries, nga, geopackage
geopackage-mapcache-android
GeoPackage MapCache Android App
Stars: ✭ 33 (+26.92%)
Mutual labels:  geopackage-libraries, nga, geopackage
geopackage-android-map
GeoPackage Android Map Library
Stars: ✭ 26 (+0%)
Mutual labels:  geopackage-libraries, nga, geopackage
pygeopackage
A Python package to read/write spatial data to a geopackage.
Stars: ✭ 33 (+26.92%)
Mutual labels:  geopackage-libraries, geopackage
TinyTIFF
lightweight TIFF reader/writer library (C/C++)
Stars: ✭ 91 (+250%)
Mutual labels:  tiff-files, tiff-ios
TIFFStack
Load TIFF files into matlab fast, with lazy loading
Stars: ✭ 32 (+23.08%)
Mutual labels:  tiff, tiff-files
Exif Py
Easy to use Python module to extract Exif metadata from digital image files.
Stars: ✭ 561 (+2057.69%)
Mutual labels:  tiff
Tifffile
Read and write TIFF files. Forked from https://pypi.org/project/tifffile
Stars: ✭ 119 (+357.69%)
Mutual labels:  tiff
Exifr
EXIF Reader
Stars: ✭ 450 (+1630.77%)
Mutual labels:  tiff
Libvips
A fast image processing library with low memory needs.
Stars: ✭ 6,094 (+23338.46%)
Mutual labels:  tiff
Metadata Extractor
Extracts Exif, IPTC, XMP, ICC and other metadata from image, video and audio files
Stars: ✭ 1,972 (+7484.62%)
Mutual labels:  tiff
Exifr
📷 The fastest and most versatile JS EXIF reading library.
Stars: ✭ 448 (+1623.08%)
Mutual labels:  tiff
SPWaterWaveProgressIndicatorView
An iOS Custom Water Wave Progress Indicator View with Demo
Stars: ✭ 24 (-7.69%)
Mutual labels:  ios-lib
Govips
A lightning fast image processing and resizing library for Go
Stars: ✭ 442 (+1600%)
Mutual labels:  tiff
Sharp
High performance Node.js image processing, the fastest module to resize JPEG, PNG, WebP, AVIF and TIFF images. Uses the libvips library.
Stars: ✭ 21,131 (+81173.08%)
Mutual labels:  tiff
Iipsrv
iipsrv is an advanced high-performance feature-rich image server for web-based streamed viewing and zooming of ultra high-resolution images.
Stars: ✭ 216 (+730.77%)
Mutual labels:  tiff
Twelvemonkeys
TwelveMonkeys ImageIO: Additional plug-ins and extensions for Java's ImageIO
Stars: ✭ 1,221 (+4596.15%)
Mutual labels:  tiff
Format parser
file metadata parsing, done cheap
Stars: ✭ 46 (+76.92%)
Mutual labels:  tiff

TIFF iOS

Tagged Image File Format Lib

The GeoPackage Libraries were developed at the National Geospatial-Intelligence Agency (NGA) in collaboration with BIT Systems. The government has "unlimited rights" and is releasing this software to increase the impact of government investments by providing developers with the opportunity to take things in new directions. The software use, modification, and distribution rights are stipulated within the MIT license.

Pull Requests

If you'd like to contribute to this project, please make a pull request. We'll review the pull request and discuss the changes. All pull request contributions to this project will be released under the MIT license.

Software source code previously released under an open source license and then modified by NGA staff is considered a "joint work" (see 17 USC § 101); it is partially copyrighted, partially public domain, and as a whole is protected by the copyrights of the non-government authors and must be released according to the terms of the original open source license.

About

TIFF is an iOS Objective-C library for reading and writing Tagged Image File Format files. It was primarily created to provide license friendly TIFF functionality to iOS applications. Implementation is based on the TIFF specification and this JavaScript implementation: https://github.com/constantinius/geotiff.js

Usage

View the latest Appledoc

Read

// NSData *data = ...;
// NSString *file = ...;
// NSInputStream *stream = ...;
// TIFFByteReader *reader = ...;

TIFFImage *tiffImage = [TIFFReader readTiffFromData:data];
// TIFFImage *tiffImage = [TIFFReader readTiffFromFile:file];
// TIFFImage *tiffImage = [TIFFReader readTiffFromStream:stream];
// TIFFImage *tiffImage = [TIFFReader readTiffFromReader:reader];
NSArray<TIFFFileDirectory *> *directories = [tiffImage fileDirectories];
TIFFFileDirectory *directory  = [directories objectAtIndex:0];
TIFFRasters *rasters = [directory readRasters];

Write

int width = 256;
int height = 256;
int samplesPerPixel = 1;
int bitsPerSample = 32;

TIFFRasters *rasters = [[TIFFRasters alloc] initWithWidth:width andHeight:height andSamplesPerPixel:samplesPerPixel andSingleBitsPerSample:bitsPerSample];

int rowsPerStrip = [rasters calculateRowsPerStripWithPlanarConfiguration:(int)TIFF_PLANAR_CONFIGURATION_CHUNKY];

TIFFFileDirectory *directory = [[TIFFFileDirectory alloc] init];
[directory setImageWidth: width];
[directory setImageHeight: height];
[directory setBitsPerSampleAsSingleValue: bitsPerSample];
[directory setCompression: TIFF_COMPRESSION_NO];
[directory setPhotometricInterpretation: TIFF_PHOTOMETRIC_INTERPRETATION_BLACK_IS_ZERO];
[directory setSamplesPerPixel: samplesPerPixel];
[directory setRowsPerStrip: rowsPerStrip];
[directory setPlanarConfiguration: TIFF_PLANAR_CONFIGURATION_CHUNKY];
[directory setSampleFormatAsSingleValue: TIFF_SAMPLE_FORMAT_FLOAT];
[directory setWriteRasters: rasters];

for (int y = 0; y < height; y++) {
    for (int x = 0; x < width; x++) {
        float pixelValue = 1.0; // any pixel value
        [rasters setFirstPixelSampleAtX:x andY:y withValue:[[NSDecimalNumber alloc] initWithFloat:pixelValue]];
    }
}

TIFFImage *tiffImage = [[TIFFImage alloc] init];
[tiffImage addFileDirectory:directory];
NSData *data = [TIFFWriter writeTiffToDataWithImage:tiffImage];
// or
// NSString *file = ...;
// [TIFFWriter writeTiffWithFile:file andImage:tiffImage];

Build

Build & Test

Build this repository using Xcode and/or CocoaPods:

pod install

Open tiff-ios.xcworkspace in Xcode or build from command line:

xcodebuild -workspace 'tiff-ios.xcworkspace' -scheme tiff-ios build

Run tests from Xcode or from command line:

xcodebuild test -workspace 'tiff-ios.xcworkspace' -scheme tiff-ios -destination 'platform=iOS Simulator,name=iPhone 14'

Include Library

Include this repository by specifying it in a Podfile using a supported option.

Pull from CocoaPods:

pod 'tiff-ios', '~> 4.0.1'

Pull from GitHub:

pod 'tiff-ios', :git => 'https://github.com/ngageoint/tiff-ios.git', :branch => 'master'
pod 'tiff-ios', :git => 'https://github.com/ngageoint/tiff-ios.git', :tag => '4.0.1'

Include as local project:

pod 'tiff-ios', :path => '../tiff-ios'

Swift

To use from Swift, import the tiff-ios bridging header from the Swift project's bridging header

#import "tiff-ios-Bridging-Header.h"

Read

// let data: Data = ...
// let file: String = ...
// let stream: NSInputStream = ...
// let reader: TIFFByteReader = ...

let tiffImage: TIFFImage = TIFFReader.readTiff(from: data)
// let tiffImage: TIFFImage = TIFFReader.readTiff(fromFile: file)
// let tiffImage: TIFFImage = TIFFReader.readTiff(from: stream)
// let tiffImage: TIFFImage = TIFFReader.readTiff(from: reader)
let directories: [TIFFFileDirectory] = tiffImage.fileDirectories()
let directory: TIFFFileDirectory = directories[0]
let rasters: TIFFRasters = directory.readRasters()

Write

let width: UInt16 = 256
let height: UInt16 = 256
let samplesPerPixel: UInt16 = 1
let bitsPerSample: UInt16 = 32

let rasters: TIFFRasters = TIFFRasters(width: Int32(width), andHeight: Int32(height), andSamplesPerPixel: Int32(samplesPerPixel), andSingleBitsPerSample: Int32(bitsPerSample))

let rowsPerStrip: UInt16 = UInt16(rasters.calculateRowsPerStrip(withPlanarConfiguration: Int32(TIFF_PLANAR_CONFIGURATION_CHUNKY)))

let directory: TIFFFileDirectory = TIFFFileDirectory()
directory.setImageWidth(width)
directory.setImageHeight(height)
directory.setBitsPerSampleAsSingleValue(bitsPerSample)
directory.setCompression(UInt16(TIFF_COMPRESSION_NO))
directory.setPhotometricInterpretation(UInt16(TIFF_PHOTOMETRIC_INTERPRETATION_BLACK_IS_ZERO))
directory.setSamplesPerPixel(samplesPerPixel)
directory.setRowsPerStrip(rowsPerStrip)
directory.setPlanarConfiguration(UInt16(TIFF_PLANAR_CONFIGURATION_CHUNKY))
directory.setSampleFormatAsSingleValue(UInt16(TIFF_SAMPLE_FORMAT_FLOAT))
directory.writeRasters = rasters

for y in 0..<height {
    for x in 0..<width {
        let pixelValue: Float = 1.0 // any pixel value
        rasters.setFirstPixelSampleAtX(Int32(x), andY: Int32(y), withValue: NSDecimalNumber(value: pixelValue))
    }
}

let tiffImage: TIFFImage = TIFFImage()
tiffImage.addFileDirectory(directory)
let data: Data = TIFFWriter.writeTiffToData(with: tiffImage)
// or
// let file: String = ...
// TIFFWriter.writeTiff(withFile: file, andImage: tiffImage)
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].