thies/gameboy-camera-image-extractor
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
thies/gameboy-camera-image-extractor 适用场景与选型建议
thies/gameboy-camera-image-extractor 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 6 次下载、GitHub Stars 达 1, 最近一次更新时间为 2025 年 01 月 02 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 thies/gameboy-camera-image-extractor 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 thies/gameboy-camera-image-extractor 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 6
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 31
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-01-02