All Projects → kelvin13 → Png

kelvin13 / Png

Licence: mpl-2.0
decode, inspect, edit, and encode png images in pure swift

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Png

Photosauce
MagicScaler high-performance, high-quality image processing pipeline for .NET
Stars: ✭ 291 (+22.27%)
Mutual labels:  image-processing, png
Govips
A lightning fast image processing and resizing library for Go
Stars: ✭ 442 (+85.71%)
Mutual labels:  image-processing, png
Imaginary
Fast, simple, scalable, Docker-ready HTTP microservice for high-level image processing
Stars: ✭ 4,107 (+1625.63%)
Mutual labels:  image-processing, png
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 (+8778.57%)
Mutual labels:  image-processing, png
Flyimg
Dockerized PHP7 application runs as a Microservice to resize and crop images on the fly. Get optimised images with MozJPEG, WebP or PNG using ImageMagick. Includes face detection, cropping, face blurring, image rotation and many other options. Abstract storage based on FlySystem in order to store images on any provider (local, AWS S3...).
Stars: ✭ 762 (+220.17%)
Mutual labels:  image-processing, png
Crunch
Crunch is a tool for lossy PNG image file optimization. It combines selective bit depth, color type, and color palette reduction with zopfli DEFLATE compression algorithm encoding using the pngquant and zopflipng PNG optimization tools. This approach leads to a significant file size gain relative to lossless approaches at the expense of a relatively modest decrease in image quality (see example images below).
Stars: ✭ 3,074 (+1191.6%)
Mutual labels:  image-processing, png
Mort
Storage and image processing server written in Go
Stars: ✭ 420 (+76.47%)
Mutual labels:  image-processing, png
Selene
A C++17 image representation, processing and I/O library.
Stars: ✭ 266 (+11.76%)
Mutual labels:  image-processing, png
Libvips
A fast image processing library with low memory needs.
Stars: ✭ 6,094 (+2460.5%)
Mutual labels:  image-processing, png
Imagesharp
📷 A modern, cross-platform, 2D Graphics library for .NET
Stars: ✭ 5,186 (+2078.99%)
Mutual labels:  image-processing, png
Imgproxy
Fast and secure standalone server for resizing and converting remote images
Stars: ✭ 5,688 (+2289.92%)
Mutual labels:  image-processing, png
Png To Ico
convert png to ico format
Stars: ✭ 88 (-63.03%)
Mutual labels:  image-processing, png
Imageviewer
HDR, PFM, DDS, KTX, EXR, PNG, JPG, BMP image viewer and manipulator
Stars: ✭ 71 (-70.17%)
Mutual labels:  image-processing, png
Essential Image Optimization
Essential Image Optimization - an eBook
Stars: ✭ 1,950 (+719.33%)
Mutual labels:  image-processing, png
Obs Kinect
OBS Plugin to use a Kinect (all models supported) in OBS (and setup a virtual green screen based on depth and/or body detection).
Stars: ✭ 217 (-8.82%)
Mutual labels:  image-processing
Dehazezoo
DehazeZoo for collecting dehazing methods, datasets, and codes.
Stars: ✭ 228 (-4.2%)
Mutual labels:  image-processing
Relion
Image-processing software for cryo-electron microscopy
Stars: ✭ 219 (-7.98%)
Mutual labels:  image-processing
Gwu data mining
Materials for GWU DNSC 6279 and DNSC 6290.
Stars: ✭ 217 (-8.82%)
Mutual labels:  image-processing
Limitpng
PNG image compression tool (GUI use Electron)
Stars: ✭ 232 (-2.52%)
Mutual labels:  png
Image Compress Without Backend
Pure frontend solution to compress images
Stars: ✭ 224 (-5.88%)
Mutual labels:  image-processing

platforms: all releases build status documentation status issues language license: mpl2

Swift PNG
4.0.0

Swift PNG is a pure, cross-platform Swift framework for decoding, inspecting, editing, and encoding PNG images. The framework does not depend on Foundation or any other packages, and will compile and provide consistent behavior on all Swift platforms. Swift PNG also comes with built-in file system support on Linux and MacOS.

Swift PNG is available under the Mozilla Public License 2.0. The example programs are public domain and can be adapted freely.

tutorials and example programs

  1. basic decoding (sources)
  2. basic encoding (sources)
  3. using indexed images (sources)
  4. using iphone-optimized images (sources)
  5. working with metadata (sources)
  6. using in-memory images (sources)
  7. online decoding (sources)
  8. custom color targets (sources)

api reference

getting started

To use Swift PNG in a project, add this descriptor to the dependencies list in your Package.swift file:

.package(url: "https://github.com/kelvin13/png", .exact("4.0.0")) 

basic usage

Decode an image:

import PNG 
func decode(png path:String) throws 
{
    guard let image:PNG.Data.Rectangular = try .decompress(path: path)
    else 
    {
        // failed to access file from file system
    }

    let rgba:[PNG.RGBA<UInt8>] = image.unpack(as: PNG.RGBA<UInt8>.self), 
        size:(x:Int, y:Int)    = image.size
    // ...
}

Encode an image:

func encode(png path:String, size:(x:Int, y:Int), pixels:[PNG.RGBA<UInt8>]) throws
{
    let image:PNG.Data.Rectangular = .init(packing: pixels, size: size, 
        layout: .init(format: .rgba8(palette: [], fill: nil)))
    try image.compress(path: path, level: 9)
}

features

infrastructure

A list of build flags can be found here. Project automation scripts live in the utils/ directory, and are invoked as follows:

  • utils/examples [-c/--configuration debug | release]

    Builds and runs the example programs in the examples/ directory. The --configuration argument specifies the Swift build mode to use.

  • utils/benchmark [-t/--trials n0 n1 n2] [-s/--save] [-l/--load]

    Runs library performance and compression benchmarks, and generates a performance report.

    The --trials argument specifies the number of trials to run, for decompression, compression, and historical toolchain benchmarks, respectively. The --save argument makes this script store benchmark measurements in cache files; the --load argument makes this script use cached measurements instead of re-running the benchmarks.

  • utils/generate-documentation [-l/--local]

    Generates documentation pages for the library using Entrapta. A Github action invokes this script and deploys the output to the Swift PNG API reference website on every commit.

The CI runs Swift PNG’s test suites with the following invocations:

swift run            unit-test 
swift run -c release integration-test --compact
swift run -c release compression-test 

The integration-test product accepts a -c/--compact option, which specifies the output verbosity, and an -e/--print-expected-failures option, which makes it print the error messages for expected failures.

see also

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].