thies/gameboy-camera-image-extractor 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

thies/gameboy-camera-image-extractor

最新稳定版本:1.1.2

Composer 安装命令:

composer require thies/gameboy-camera-image-extractor

包简介

This is a PHP library for extracting Game Boy Camera photos from a save ram (.sav) file and writing them in various image formats.

README 文档

README

This is a PHP library for extracting Game Boy Camera photos from a save ram (.sav) file and writing them in various image formats.

The library requires the GD php extension to work.

To see it in action go to https://gbcamera.net

Basic usage

To just extract the images and store them on disk use the image writer:

$imageWriter = new \GameboyCameraImageExtractor\ImageWriter();
$imageWriter->extractAndStoreToDisk('/path/to/file.sav', '/output/directory');

By default, it outputs the images in PNG format. There are multiple adapter available for different image formats. For example, if you want to output the images in webp format you can use the Webp adapter:

$webpAdapter = new \GameboyCameraImageExtractor\Writer\Webp();
$imageWriter = new \GameboyCameraImageExtractor\ImageWriter($webpAdapter);
$imageWriter->extractAndStoreToDisk('/path/to/file.sav', '/output/directory');

It will output the images in webp format. You can also extend \GameboyCameraImageExtractor\Writer\Writer and write you own implementation for your specific needs.

If you want to get the images without writing them to disk you can use the image extractor:

$imageExtractor = new \GameboyCameraImageExtractor\ImageExtractor();
$imageExtractor->extractFromFile('/path/to/file.sav');

This will return an array of \GdImage objects.

Palettes

You can also use palletes to give the image a bit more color.

Basic usage:

$palette = new \GameboyCameraImageExtractor\Entity\Palette('#ffffff', '#cccccc', '#666666', '#000000');
$imageWriter = new \GameboyCameraImageExtractor\ImageWriter();
$imageWriter->extractAndStoreToDisk('/path/to/file.sav', '/output/directory', $palette);

There are some presets, I might add some more at a later time.

$preset = \GameboyCameraImageExtractor\Enum\PalettePreset::GameboyPlayer;
$palette = \GameboyCameraImageExtractor\Entity\Palette::createForPreset($preset);

Credits

I could not have made this without the works of raphnet: https://github.com/raphnet/gbcam2png

统计信息

  • 总下载量: 6
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-01-02