GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - main/tiff2jpeg: proper golang tiff to jpeg converter

BranchesTags
Open more actions menu

Latest commit

 

History

4 Commits
4 Commits

Folders and files

NameName
Last commit message
Last commit date
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
go.mod
go.mod
 
 
go.sum
go.sum
 
 
tiff2jpeg.go
tiff2jpeg.go
 
 
tiff2jpeg_test.go
tiff2jpeg_test.go
 
 

Repository files navigation

tiff2jpeg

A tiny Go library that converts TIFF images to JPEG.

It decodes TIFF via golang.org/x/image/tiff and re-encodes to JPEG at maximum quality (100), so the conversion is as lossless as JPEG allows. No CGo, no external tools.

Install

go get github.com/main/tiff2jpeg

Usage

package main

import (
	"log"
	"os"

	"github.com/main/tiff2jpeg"
)

func main() {
	f, err := os.Open("photo.tif")
	if err != nil {
		log.Fatal(err)
	}
	defer f.Close()

	jpegBytes, err := tiff2jpeg.TIFF2JPEG(f)
	if err != nil {
		log.Fatal(err)
	}

	if err := os.WriteFile("photo.jpg", jpegBytes, 0o644); err != nil {
		log.Fatal(err)
	}
}

TIFF2JPEG accepts any io.Reader (file, HTTP response body, bytes buffer) and returns the encoded JPEG as []byte.

License

MIT — see LICENSE.

About

proper golang tiff to jpeg converter

Resources

Readme
MIT license
Activity

Stars

1 star

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.