Skip to content

About

A small Flutter desktop app for loading an image, previewing it, resizing it, and exporting it to another format.

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

Flutter Image Resizer

A small Flutter desktop app for loading an image, previewing it, resizing it, and exporting it to another format.

Features

  • Loads and previews image files, including HEIC and HEIF (primary still image).
  • Default resize preset is 1200x scale.
  • Custom resize mode accepts width, height, or both.
  • Default export format is WEBP.
  • Exports automatically to the configured export directory, currently defaulting to the user's Downloads folder.
  • Output filenames are lower-case, hyphen-separated (or underscore-separated via Settings), and capped by the configured max base filename length.
  • Bundles cwebp binaries for WEBP export on Linux, macOS, and Windows desktop builds.
  • Registers image file handling metadata for Linux and macOS so the app can appear in Open With....
  • Supports Ctrl+O / Cmd+O to open an image and Ctrl+S / Cmd+S to export.
  • Persists app settings for defaults such as export directory, format, resize, filename length, and export quality.
  • Settings can be reset to defaults; click Save to apply or Cancel to discard.
  • An Overwrite existing files checkbox in Settings controls filename collisions and persists between launches; unchecked by default, exports auto-increment.
  • Includes a simple About dialog with version, author, license, and repository URL.

Defaults

Defaults are centralized in AppSettings in lib/main.dart:

  • defaultFormat: WEBP
  • defaultResizePreset: 1200x scale
  • defaultExportDirectory: system Downloads folder when unset
  • maxBaseFilenameLength: 32
  • webpQuality: 80
  • jpegQuality: 80

These defaults can be changed from the Settings dialog.

The default export behavior is equivalent to:

convert -quality 80 -resize 1200x input.jpg input.webp

Run

flutter run -d macos
flutter run -d linux
flutter run -d windows

Build

flutter build macos
flutter build linux
flutter build windows

Tagged Releases

GitHub Actions builds release artifacts for every pushed tag:

git tag v1.0.0
git push origin v1.0.0

The workflow publishes:

  • notarized macOS .dmg
  • Linux .AppImage
  • Windows setup .exe

macOS signing and notarization use these repository secrets:

  • MACOS_CERTIFICATE: base64-encoded Developer ID Application .p12
  • MACOS_CERTIFICATE_PASSWORD: password for that .p12
  • AC_APPLE_ID: Apple ID used for notarization
  • AC_TEAM_ID: Apple Developer Team ID
  • AC_PASSWORD: app-specific password for the Apple ID

Launcher Icons

Launcher icons are generated from assets/icons/icon-1024.png.

macOS and Windows assets are generated with:

dart run flutter_launcher_icons

Linux hicolor PNG assets live under linux/icons/hicolor and are installed by the Linux CMake bundle step.

macOS may cache app icons by bundle path. If a rebuilt app shows an old icon in Finder or Dock, the bundle can still contain the correct AppIcon.icns; moving the .app to a fresh path or clearing the old Dock entry refreshes the displayed icon.

Linux Open With...

The project includes linux/com.example.flutter_image_resizer.desktop with image MIME types and %f file launching.

Development Linux installs use the desktop entry in a user applications directory, followed by a desktop database refresh:

desktop-file-install --dir="$HOME/.local/share/applications" linux/com.example.flutter_image_resizer.desktop
update-desktop-database "$HOME/.local/share/applications"

The Exec path in the installed desktop file points to the built flutter_image_resizer executable. Nautilus can then show the app in Open With..., and the app can be selected as the default image handler from file properties.

macOS Open With...

The macOS bundle declares image document types in macos/Runner/Info.plist. Finder uses this metadata to show the built .app in Open With....

The macOS app is intentionally not sandboxed. WEBP export launches the bundled cwebp encoder process, and the app sandbox blocks that subprocess with Operation not permitted. file_picker entitlement checks are skipped at startup on macOS for this non-sandboxed distribution model.

Finder default-app registration uses the standard Open with section in Get Info. Once the built .app is installed in /Applications or ~/Applications, Finder can assign Image Resizer as the handler for a selected image type with Change All....

Finder open events are bridged from AppDelegate.swift to Flutter through the image_resizer/open_file method channel.

HEIC / HEIF import

HEIC and HEIF files are decoded to PNG in memory for preview and export. The original file is unchanged, and its name is used for output naming. Export formats remain WEBP, JPEG, and PNG.

Decoding uses heic_native: macOS uses ImageIO; Linux x64 and Windows x64 bundle libheif and libde265 through the plugin. Linux builds require libpng-dev (included in the release workflow). For Linux architectures without bundled libraries, install libheif-dev and libpng-dev.

Resize presets configuration

The app creates resize-presets.json in its application-support directory. Settings shows the full file path. Edit this file and restart the app to update both resize menus:

{
  "widths": [1200, 1600, 800, 1920]
}

Widths are in pixels and preserve aspect ratio. Order follows the array; Original size and Custom are always appended. Use up to 50 unique integer widths from 1 to 100000. An empty array leaves only Original size and Custom. If a saved default is removed, the app uses 1200x when available, otherwise the first option. Invalid configuration falls back to built-in presets with a message in Settings and leaves your file unchanged. Reset to defaults resets saved settings, including overwrite, but does not rewrite this file.

About

A small Flutter desktop app for loading an image, previewing it, resizing it, and exporting it to another format.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages