{"id":15050930,"url":"https://github.com/ngageoint/tiff-ios","last_synced_at":"2025-07-01T03:03:56.674Z","repository":{"id":53740942,"uuid":"79610821","full_name":"ngageoint/tiff-ios","owner":"ngageoint","description":"Tagged Image File Format iOS Library","archived":false,"fork":false,"pushed_at":"2025-06-05T17:23:27.000Z","size":52655,"stargazers_count":34,"open_issues_count":1,"forks_count":9,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-06-05T17:24:48.729Z","etag":null,"topics":["cocoapods","geopackage","geopackage-libraries","ios","ios-lib","nga","objective-c","objective-c-library","swift","tiff","tiff-files","tiff-ios","xcode"],"latest_commit_sha":null,"homepage":"http://ngageoint.github.io/tiff-ios","language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ngageoint.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2017-01-20T23:55:13.000Z","updated_at":"2025-06-05T16:13:30.000Z","dependencies_parsed_at":"2025-06-05T17:33:34.567Z","dependency_job_id":null,"html_url":"https://github.com/ngageoint/tiff-ios","commit_stats":{"total_commits":92,"total_committers":3,"mean_commits":"30.666666666666668","dds":0.3369565217391305,"last_synced_commit":"11dad0b26788be183a896cb18f4596e973e7c392"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/ngageoint/tiff-ios","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ngageoint%2Ftiff-ios","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ngageoint%2Ftiff-ios/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ngageoint%2Ftiff-ios/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ngageoint%2Ftiff-ios/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ngageoint","download_url":"https://codeload.github.com/ngageoint/tiff-ios/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ngageoint%2Ftiff-ios/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262887158,"owners_count":23379766,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cocoapods","geopackage","geopackage-libraries","ios","ios-lib","nga","objective-c","objective-c-library","swift","tiff","tiff-files","tiff-ios","xcode"],"created_at":"2024-09-24T21:29:46.870Z","updated_at":"2025-07-01T03:03:56.604Z","avatar_url":"https://github.com/ngageoint.png","language":"Objective-C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TIFF iOS\n\n#### Tagged Image File Format Lib ####\n\nThe [GeoPackage Libraries](http://ngageoint.github.io/GeoPackage/) were developed at the [National Geospatial-Intelligence Agency (NGA)](http://www.nga.mil/) in collaboration with [BIT Systems](https://www.caci.com/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](http://choosealicense.com/licenses/mit/).\n\n### Pull Requests ###\nIf 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.\n\nSoftware 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.\n\n### About ###\n\n[TIFF](http://ngageoint.github.io/tiff-ios/) 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](https://partners.adobe.com/public/developer/en/tiff/TIFF6.pdf) and this JavaScript implementation: https://github.com/constantinius/geotiff.js\n\n### Usage ###\n\nView the latest [Appledoc](http://ngageoint.github.io/tiff-ios/docs/api/)\n\n#### Read ####\n\n```objectivec\n@import TIFF;\n\n// NSData *data = ...;\n// NSString *file = ...;\n// NSInputStream *stream = ...;\n// TIFFByteReader *reader = ...;\n\nTIFFImage *tiffImage = [TIFFReader readTiffFromData:data];\n// TIFFImage *tiffImage = [TIFFReader readTiffFromFile:file];\n// TIFFImage *tiffImage = [TIFFReader readTiffFromStream:stream];\n// TIFFImage *tiffImage = [TIFFReader readTiffFromReader:reader];\nNSArray\u003cTIFFFileDirectory *\u003e *directories = [tiffImage fileDirectories];\nTIFFFileDirectory *directory  = [directories objectAtIndex:0];\nTIFFRasters *rasters = [directory readRasters];\n\n```\n\n#### Write ####\n\n```objectivec\n\nint width = 256;\nint height = 256;\nint samplesPerPixel = 1;\nint bitsPerSample = 32;\n\nTIFFRasters *rasters = [[TIFFRasters alloc] initWithWidth:width andHeight:height andSamplesPerPixel:samplesPerPixel andSingleBitsPerSample:bitsPerSample];\n\nint rowsPerStrip = [rasters calculateRowsPerStripWithPlanarConfiguration:(int)TIFF_PLANAR_CONFIGURATION_CHUNKY];\n\nTIFFFileDirectory *directory = [[TIFFFileDirectory alloc] init];\n[directory setImageWidth: width];\n[directory setImageHeight: height];\n[directory setBitsPerSampleAsSingleValue: bitsPerSample];\n[directory setCompression: TIFF_COMPRESSION_NO];\n[directory setPhotometricInterpretation: TIFF_PHOTOMETRIC_INTERPRETATION_BLACK_IS_ZERO];\n[directory setSamplesPerPixel: samplesPerPixel];\n[directory setRowsPerStrip: rowsPerStrip];\n[directory setPlanarConfiguration: TIFF_PLANAR_CONFIGURATION_CHUNKY];\n[directory setSampleFormatAsSingleValue: TIFF_SAMPLE_FORMAT_FLOAT];\n[directory setWriteRasters: rasters];\n\nfor (int y = 0; y \u003c height; y++) {\n    for (int x = 0; x \u003c width; x++) {\n        float pixelValue = 1.0; // any pixel value\n        [rasters setFirstPixelSampleAtX:x andY:y withValue:[[NSDecimalNumber alloc] initWithFloat:pixelValue]];\n    }\n}\n\nTIFFImage *tiffImage = [[TIFFImage alloc] init];\n[tiffImage addFileDirectory:directory];\nNSData *data = [TIFFWriter writeTiffToDataWithImage:tiffImage];\n// or\n// NSString *file = ...;\n// [TIFFWriter writeTiffWithFile:file andImage:tiffImage];\n\n```\n\n### Build ###\n\n[![Build](https://github.com/ngageoint/tiff-ios/workflows/Build/badge.svg)](https://github.com/ngageoint/tiff-ios/actions/workflows/build.yml)\n\nBuild this repository using Swift Package Manager:\n\n    swift build\n\nRun tests from Xcode or from command line:\n\n    swift test\n\nOpen the Swift Package in Xcode from command line:\n\n    open Package.swift\n\n### Include Library ###\n\nUse this library via SPM in your Package.swift:\n\n    dependencies: [\n        .package(url: \"https://github.com/ngageoint/tiff-ios.git\", branch: \"release/5.0.0\"),\n    ]\n    \nOr as a tagged release:\n\n    dependencies: [\n        .package(url: \"https://github.com/ngageoint/tiff-ios.git\", from: \"5.0.0\"),\n    ]\n\nReference it in your Package.swift target:\n\n    .target(\n        name: \"MyApp\",\n        dependencies: [\n            .product(name: \"TIFF\", package: \"tiff-ios\"),\n        ],\n    ),\n\n### Swift ###\n\nTo use from Swift:\n\n    import TIFF\n\n#### Read ####\n\n```swift\n\n// let data: Data = ...\n// let file: String = ...\n// let stream: NSInputStream = ...\n// let reader: TIFFByteReader = ...\n\nlet tiffImage: TIFFImage = TIFFReader.readTiff(from: data)\n// let tiffImage: TIFFImage = TIFFReader.readTiff(fromFile: file)\n// let tiffImage: TIFFImage = TIFFReader.readTiff(from: stream)\n// let tiffImage: TIFFImage = TIFFReader.readTiff(from: reader)\nlet directories: [TIFFFileDirectory] = tiffImage.fileDirectories()\nlet directory: TIFFFileDirectory = directories[0]\nlet rasters: TIFFRasters = directory.readRasters()\n\n```\n\n#### Write ####\n\n```swift\n\nlet width: UInt16 = 256\nlet height: UInt16 = 256\nlet samplesPerPixel: UInt16 = 1\nlet bitsPerSample: UInt16 = 32\n\nlet rasters: TIFFRasters = TIFFRasters(width: Int32(width), andHeight: Int32(height), andSamplesPerPixel: Int32(samplesPerPixel), andSingleBitsPerSample: Int32(bitsPerSample))\n\nlet rowsPerStrip: UInt16 = UInt16(rasters.calculateRowsPerStrip(withPlanarConfiguration: Int32(TIFF_PLANAR_CONFIGURATION_CHUNKY)))\n\nlet directory: TIFFFileDirectory = TIFFFileDirectory()\ndirectory.setImageWidth(width)\ndirectory.setImageHeight(height)\ndirectory.setBitsPerSampleAsSingleValue(bitsPerSample)\ndirectory.setCompression(UInt16(TIFF_COMPRESSION_NO))\ndirectory.setPhotometricInterpretation(UInt16(TIFF_PHOTOMETRIC_INTERPRETATION_BLACK_IS_ZERO))\ndirectory.setSamplesPerPixel(samplesPerPixel)\ndirectory.setRowsPerStrip(rowsPerStrip)\ndirectory.setPlanarConfiguration(UInt16(TIFF_PLANAR_CONFIGURATION_CHUNKY))\ndirectory.setSampleFormatAsSingleValue(UInt16(TIFF_SAMPLE_FORMAT_FLOAT))\ndirectory.writeRasters = rasters\n\nfor y in 0..\u003cheight {\n    for x in 0..\u003cwidth {\n        let pixelValue: Float = 1.0 // any pixel value\n        rasters.setFirstPixelSampleAtX(Int32(x), andY: Int32(y), withValue: NSDecimalNumber(value: pixelValue))\n    }\n}\n\nlet tiffImage: TIFFImage = TIFFImage()\ntiffImage.addFileDirectory(directory)\nlet data: Data = TIFFWriter.writeTiffToData(with: tiffImage)\n// or\n// let file: String = ...\n// TIFFWriter.writeTiff(withFile: file, andImage: tiffImage)\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fngageoint%2Ftiff-ios","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fngageoint%2Ftiff-ios","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fngageoint%2Ftiff-ios/lists"}