ppi

package module
v0.0.0-...-3d972f4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 18, 2021 License: Apache-2.0 Imports: 8 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

ppi

Generate draw.Image from PSD (PhotoShop Document) and PFV (PSDToolFavorites)

Usage

package main

import (
	"fmt"
	"image/png"
	"os"
	"strings"

	"github.com/oov/psd"
	"github.com/raa0121/pfv"
	"github.com/raa0121/ppi"
)

func main() {
	s := `
[PSDToolFavorites-v1]
root-name/お気に入り
faview-mode/1

//Heart
マーク/ハート
アクセサリ/オタマン帽普
眉/*普通
目/*普通
口/*笑い
本体/*普段着
手/*手
ツインテール/*通常

//hoge/Heart2
マーク/ハート
アクセサリ/オタマンベレー帽
眉/*普通
目/*普通
口/*笑い
本体/*普段着
手/*手
ツインテール/*通常

`
	config := pfv.Decode(s)

	file, err := os.Open("image.psd")
	if err != nil {
		panic(err)
	}
	defer file.Close()
	img, _, err := psd.Decode(file, &psd.DecodeOptions{})
	imgs := ppi.CreateImage(img, config, "sjis")
	for _, v := range imgs {
		out, err := os.Create(fmt.Sprintf("%s.png", strings.Replace(v.Name, "/", "_", -1)))
		if err != nil {
			panic(err)
		}
		defer out.Close()
		err := png.Encode(out, v.Image)
		if err != nil {
			panic(err)
		}
	}
}

Requirements

go 1.16 or later

Installation

go get github.com/raa0121/ppi

License

Apache License 2.0

Author

raa0121 raa0121@gmail.com

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Image

type Image struct {
	Name  string
	Image draw.Image
}

func CreateImage

func CreateImage(img *psd.PSD, conf *pfv.Pfv, layerNameEncoding string) ([]Image, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址