Skip to content

GDUT-ADSec/TweakPNG-Mac

Repository files navigation

TweakPNG

Native macOS port of TweakPNG for viewing and editing PNG chunk metadata, while keeping the original project source in this repository.

This repository now contains two parts:

  • the original Windows TweakPNG source in the repository root
  • a native macOS app built with SwiftUI/AppKit and a reusable C++ PNG core

Requirements

Runtime and build requirements for the macOS port:

  • macOS 13 or newer
  • Xcode Command Line Tools
  • Swift 6 toolchain (swift)
  • uv for the packaging helper environment
  • Python 3.12 for the icon-generation helper managed by uv

Optional tools used by packaging:

  • iconutil
  • codesign
  • hdiutil

Repository layout

  • Sources/TweakPNGCore - portable C++ PNG parsing and editing layer
  • Sources/TweakPNGMac - native macOS UI
  • macos/build-app.sh - app bundle, zip, and dmg packaging script
  • macos/tools - uv-managed Python helper for icon generation
  • macos/Assets/AppIconSource.png - source image used for the macOS app icon
  • root *.cpp / *.h files - original Windows codebase

Development build

Build the macOS app:

swift build

Run it directly from SwiftPM:

swift run TweakPNG

Release build

Build an optimized executable:

swift build -c release

The executable is emitted at:

  • .build/release/TweakPNG

Packaging

Create a local distributable app bundle, zip archive, and dmg:

chmod +x macos/build-app.sh
./macos/build-app.sh

Packaging outputs:

  • dist/TweakPNG.app
  • dist/TweakPNG-macos.zip
  • dist/TweakPNG.dmg
  • dist/TweakPNG.dSYM

The packaging flow does the following:

  1. creates or reuses the uv Python environment in macos/tools
  2. generates a macOS .iconset from macos/Assets/AppIconSource.png
  3. converts the iconset into AppIcon.icns
  4. builds the Swift release executable
  5. assembles the .app bundle
  6. applies ad-hoc signing by default
  7. emits a .zip and .dmg

Signing

This repository is currently configured to work without a paid Apple Developer certificate. By default, the packaging script performs ad-hoc signing so the app can still be built and shared for local testing.

If you later install a real signing identity, you can override the signer:

SIGN_IDENTITY="Developer ID Application: GamerNoTitle" ./macos/build-app.sh

Without a real Developer ID certificate and notarization, macOS may warn users on first launch. That is expected for the current release flow.

Dependencies

Project dependencies by layer:

  • TweakPNGCore
    • C++17
    • system zlib
  • TweakPNG
    • SwiftUI
    • AppKit
    • Swift/C++ interoperability
  • macos/tools
    • Python 3.12
    • Pillow

Current macOS feature set

  • open PNG files
  • inspect chunk rows with type, length, CRC, attributes, and summary
  • preview the current image in a native macOS inspector pane
  • add tEXt chunks
  • delete and reorder chunks
  • save and save as
  • package as .app, .zip, and .dmg

Notes

  • The original Windows code is intentionally preserved and remains in the repo.
  • The macOS port is a native implementation, not a Win32 compatibility layer.
  • Some advanced Windows-era editing dialogs and chunk-specific editors are not yet ported.

Credit

  • Original TweakPNG project by Jason Summers
  • Original project page: https://entropymine.com/jason/tweakpng/
  • Original source repository: https://github.com/jsummers/tweakpng

About

Mac 版本的 TweakPNG

Resources

License

Stars

1 star

Watchers

0 watching

Forks

Packages

 
 
 

Contributors