mirror of
https://github.com/Nexoniarz/YAPF.git
synced 2026-11-03 04:54:26 +00:00
Format (version 1, replaces the earlier experimental versions): - per-tile YCoCg-R or subtract-green colour transform, 8-bit modular - 12 row filters per 8-row band (Left, Gradient, Up-right, Up-average, Up 1-8 rows), none with more than a one-add serial dependency - residuals in groups of 8 at the group's width (w bits x 8 = w bytes), 4-bit control codes with repeat-previous-width runs chosen by DP - constant and stored tiles, independent 64x64 tiles, mips, GPU hints - all sizes validated before decoding; corrupt input is rejected Library: - SIMD on by default: SSSE3 (runtime CPUID check; GCC, Clang, MSVC, MinGW) and NEON on ARM64; -DYAPF_NO_SIMD for plain C - yapf_load_memory, yapf_load_mt, yapf_load_memory_mt - 6-10x faster decoding than PNG (stb_image) on one core; -O2 and -O3 builds perform the same - fixes for macOS (sysconf) and the Windows import library exports Tools and integrations: - `yapf` CLI: convert PNG/JPG/TGA/BMP/PSD/GIF <-> YAPF, info, bench, thumbnail, mips - JavaScript and Python bindings (byte-identical to the C encoder) - GIMP 3 plugin: exports the flattened image, optional mipmaps - Blender extension: import (also as plane), export, drag and drop - VS Code preview, Figma plugin, Photoshop scripts, Linux MIME type and thumbnailer - Makefile, updated build.sh / build.bat, tools/build_release.sh - tests/test_yapf.c (784 checks) and bindings/js/test.js Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
28 lines
1.1 KiB
JavaScript
28 lines
1.1 KiB
JavaScript
// Open YAPF — opens .yapf images in Photoshop.
|
|
// Copyright 2026 Nexoniarz — Apache License 2.0.
|
|
// Install: copy this folder's .jsx / .jsxinc files (and yapf / yapf.exe)
|
|
// into Photoshop's Presets/Scripts folder; then File > Scripts > Open YAPF.
|
|
|
|
#target photoshop
|
|
#include "yapf_common.jsxinc"
|
|
|
|
(function () {
|
|
var filter = YAPF_IS_WINDOWS ? "YAPF images:*.yapf,All files:*.*"
|
|
: function (f) { return f instanceof Folder || /\.yapf$/i.test(f.name); };
|
|
var files = File.openDialog("Open YAPF image", filter, true);
|
|
if (!files) return;
|
|
if (!(files instanceof Array)) files = [files];
|
|
|
|
for (var i = 0; i < files.length; i++) {
|
|
var tmp = yapfTempFile(".png");
|
|
if (!yapfRun([files[i].fsName, tmp.fsName], tmp)) {
|
|
alert("Could not open " + files[i].name + ".\n\n" + YAPF_TOOL_HELP);
|
|
return;
|
|
}
|
|
var doc = app.open(tmp);
|
|
// The temporary PNG is no longer needed once the document is open;
|
|
// use File > Scripts > Save as YAPF to write a .yapf again.
|
|
doc.info.caption = files[i].fsName;
|
|
tmp.remove();
|
|
}
|
|
})();
|